How to use the flintrock.exceptions.ClusterInvalidState 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 / tests / test_acceptance.py View on Github external
def test_operations_against_stopped_cluster(stopped_cluster):
    p = subprocess.run(
        ['flintrock', 'run-command', stopped_cluster, 'ls'],
        stderr=subprocess.PIPE)
    expected_error_message = str(
        ClusterInvalidState(
            attempted_command='run-command',
            state='stopped'))
    assert p.returncode == 1
    assert p.stderr.decode('utf-8').strip() == expected_error_message

    p = subprocess.run(
        ['flintrock', 'copy-file', stopped_cluster, __file__, '/remote/path'],
        stderr=subprocess.PIPE)
    expected_error_message = str(
        ClusterInvalidState(
            attempted_command='copy-file',
            state='stopped'))
    assert p.returncode == 1
    assert p.stderr.decode('utf-8').strip() == expected_error_message
github nchammas / flintrock / flintrock / ec2.py View on Github external
def add_slaves_check(self):
        if self.state != 'running':
            raise ClusterInvalidState(
                attempted_command='add-slaves',
                state=self.state)
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 copy_file_check(self):
        if self.state != 'running':
            raise ClusterInvalidState(
                attempted_command='copy-file',
                state=self.state)
github nchammas / flintrock / flintrock / ec2.py View on Github external
def run_command_check(self):
        if self.state != 'running':
            raise ClusterInvalidState(
                attempted_command='run-command',
                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)