) sys.exit(1) cache = Cache('~/.vscalectl.yml', remove_cache=True) cache.load() api = API(token, cache) cli = Client(api, no_header=True) res = True res = res & bool( cli.do('images', None, None, { 'image': None, 'plan': None, 'location': None })) print('Images: {}'.format(res)) res = res & bool( cli.do('locations', None, None, { 'image': None, 'plan': None, 'location': None })) print('Locations: {}'.format(res)) res = res & bool( cli.do('plans', None, None, { 'image': None,
'VSCALE_API_TOKEN'] if 'VSCALE_API_TOKEN' in os.environ else False if not token: print( 'Please set "VSCALE_API_TOKEN" variable to be able to call API. Exiting.' ) sys.exit(1) parser, args = args_parse(epilog) params = { 'image': args.image, 'plan': args.plan, 'location': args.location } cache = Cache(args.cache_file, remove_cache=args.no_cache) cache.load() api = API(token, cache) cli = Client(api, no_header=args.no_header) res = cli.do(args.object, args.identifier, args.action, params) if isinstance(res, (list)): print("\n".join(res)) elif isinstance(res, (str)): print(res) else: parser.print_help() sys.exit(0)