Skip to content
Snippets Groups Projects
Commit efef07bc authored by ale's avatar ale
Browse files

Make floatup.py print some debugging output

parent 2a05617d
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ def do_request(url, ssh_gw, payload): ...@@ -35,6 +35,7 @@ def do_request(url, ssh_gw, payload):
shlex.quote(data), url) shlex.quote(data), url)
if ssh_gw: if ssh_gw:
cmd = "ssh %s %s" % (ssh_gw, shlex.quote(cmd)) cmd = "ssh %s %s" % (ssh_gw, shlex.quote(cmd))
print(f'running: {cmd}')
return json.loads(subprocess.check_output(cmd, shell=True)) return json.loads(subprocess.check_output(cmd, shell=True))
...@@ -75,6 +76,7 @@ def main(): ...@@ -75,6 +76,7 @@ def main():
req = parse_inventory(args.inventory, host_attrs) req = parse_inventory(args.inventory, host_attrs)
req['ttl'] = args.ttl req['ttl'] = args.ttl
print('creating VM group...')
resp = do_request(args.url + '/api/create-group', args.ssh, req) resp = do_request(args.url + '/api/create-group', args.ssh, req)
with open(args.state_file) as fd: with open(args.state_file) as fd:
fd.write(resp['group_id']) fd.write(resp['group_id'])
...@@ -82,6 +84,7 @@ def main(): ...@@ -82,6 +84,7 @@ def main():
elif args.cmd == 'down': elif args.cmd == 'down':
with open(args.state_file) as fd: with open(args.state_file) as fd:
group_id = fd.read().strip() group_id = fd.read().strip()
print(f'stopping VM group {group_id}...')
do_request(args.url + '/api/stop-group', args.ssh, do_request(args.url + '/api/stop-group', args.ssh,
{'group_id': group_id}) {'group_id': group_id})
os.remove(args.state_file) os.remove(args.state_file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment