How to use the flintrock.exceptions.NothingToDo function in Flintrock

To help you get started, we’ve selected a few Flintrock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nchammas / flintrock / flintrock / flintrock.py View on Github external
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
github nchammas / flintrock / flintrock / ec2.py View on Github external
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)
github nchammas / flintrock / flintrock / ec2.py View on Github external
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)