2022-12-21 16:35:58 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from asyncio import run
|
|
|
|
from argparse import ArgumentParser
|
|
|
|
from traceback import print_exc
|
|
|
|
|
|
|
|
from risotto.machine import templates, remove_cache, load, INSTALL_DIR
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
parser = ArgumentParser()
|
|
|
|
parser.add_argument('server_name')
|
|
|
|
parser.add_argument('--nocache', action='store_true')
|
|
|
|
parser.add_argument('--debug', action='store_true')
|
2023-01-23 20:23:32 +01:00
|
|
|
parser.add_argument('--copy_tests', action='store_true')
|
|
|
|
parser.add_argument('--template')
|
2022-12-21 16:35:58 +01:00
|
|
|
args = parser.parse_args()
|
|
|
|
if args.nocache:
|
|
|
|
remove_cache()
|
|
|
|
|
2023-01-23 20:23:32 +01:00
|
|
|
config = await load(copy_tests=args.copy_tests, clean_directories=True)
|
|
|
|
print('fin')
|
|
|
|
print(await config.option('host_example_net.general.copy_tests').value.get())
|
2022-12-21 16:35:58 +01:00
|
|
|
try:
|
|
|
|
await templates(args.server_name,
|
|
|
|
config,
|
2023-01-23 20:23:32 +01:00
|
|
|
template=args.template
|
2022-12-21 16:35:58 +01:00
|
|
|
)
|
|
|
|
except Exception as err:
|
|
|
|
if args.debug:
|
|
|
|
print_exc()
|
|
|
|
exit(err)
|
|
|
|
print(f'templates generated in {INSTALL_DIR} directory')
|
|
|
|
|
|
|
|
|
|
|
|
run(main())
|