- # Check if the authentication token is valid. The earlier the better
- if options.token is not None:
+ # Check if the authentication info is valid. The earlier the better
+ if options.token is not None and options.url is not None:
+ try:
+ account = Kamaki.create_account(options.url, options.token)
+ if account is None:
+ raise FatalError("The authentication token and/or URL you "
+ "provided is not valid!")
+ else:
+ kamaki = Kamaki(account, out)
+ except ClientError as e:
+ raise FatalError("Astakos client: %d %s" % (e.status, e.message))
+ elif options.cloud:
+ avail_clouds = Kamaki.get_clouds()
+ if options.cloud not in avail_clouds.keys():
+ raise FatalError(
+ "Cloud: `%s' does not exist.\n\nAvailable clouds:\n\n\t%s\n"
+ % (options.cloud, "\n\t".join(avail_clouds.keys())))