Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
# We pass in obj so we can add attributes to it, like provider, which
# get shared by all commands.
# See: http://click.pocoo.org/6/api/#click.Context
cli(obj={})
except botocore.exceptions.NoCredentialsError:
raise Error(
"Flintrock could not find your AWS credentials. "
"You can fix this is by providing your credentials "
"via environment variables or by creating a shared "
"credentials file.\n"
"For more information see:\n"
" * https://boto3.readthedocs.io/en/latest/guide/configuration.html#environment-variables\n"
" * https://boto3.readthedocs.io/en/latest/guide/configuration.html#shared-credentials-file"
)
except NothingToDo as e:
print(e)
return 0
except UsageError as e:
print(e, file=sys.stderr)
return 2
except Error as e:
print(e, file=sys.stderr)
return 1
def start_check(self):
if self.state == 'running':
raise NothingToDo("Cluster is already running.")
elif self.state != 'stopped':
raise ClusterInvalidState(
attempted_command='start',
state=self.state)
def stop_check(self):
if self.state == 'stopped':
raise NothingToDo("Cluster is already stopped.")
elif self.state != 'running':
raise ClusterInvalidState(
attempted_command='stop',
state=self.state)