Ejemplo n.º 1
0
    def destroy_controller(self, all_models=False):
        """Destroy the environment, with force. Soft kill option.

        :param all_models: Ignored.
        :raises: subprocess.CalledProcessError if the operation fails."""
        retvar, ct = self.juju('destroy-environment',
                               (self.env.environment, '-y'),
                               include_e=False,
                               timeout=get_teardown_timeout(self))
        return retvar, CommandComplete(NoopCondition(), ct)
Ejemplo n.º 2
0
    def kill_controller(self, check=False):
        """Destroy the environment, with force. Hard kill option.

        :return: Subprocess's exit code."""
        retvar, ct = self.juju('destroy-environment',
                               (self.env.environment, '--force', '-y'),
                               check=check,
                               include_e=False,
                               timeout=get_teardown_timeout(self))
        return retvar, CommandComplete(NoopCondition(), ct)
Ejemplo n.º 3
0
 def deploy(self,
            charm,
            repository=None,
            to=None,
            series=None,
            service=None,
            force=False,
            storage=None,
            constraints=None):
     args = [charm]
     if repository is not None:
         args.extend(['--repository', repository])
     if to is not None:
         args.extend(['--to', to])
     if service is not None:
         args.extend([service])
     if storage is not None:
         args.extend(['--storage', storage])
     if constraints is not None:
         args.extend(['--constraints', constraints])
     retvar, ct = self.juju('deploy', tuple(args))
     return retvar, CommandComplete(NoopCondition(), ct)
Ejemplo n.º 4
0
 def enable_command(self, args):
     """Enable a command-set."""
     retvar, ct = self.juju('unblock', args)
     return retvar, CommandComplete(NoopCondition(), ct)
Ejemplo n.º 5
0
 def disable_command(self, command_set, message=''):
     """Disable a command-set."""
     retvar, ct = self.juju('block {}'.format(command_set), (message, ))
     return retvar, CommandComplete(NoopCondition(), ct)
Ejemplo n.º 6
0
 def unset_env_option(self, option):
     """Unset the value of the option in the environment."""
     retvar, ct = self.juju('set-env', ('{}='.format(option), ))
     return retvar, CommandComplete(NoopCondition(), ct)
Ejemplo n.º 7
0
 def set_env_option(self, option, value):
     """Set the value of the option in the environment."""
     option_value = "%s=%s" % (option, value)
     retvar, ct = self.juju('set-env', (option_value, ))
     return retvar, CommandComplete(NoopCondition(), ct)
Ejemplo n.º 8
0
 def set_model_constraints(self, constraints):
     constraint_strings = self._dict_as_option_strings(constraints)
     retvar, ct = self.juju('set-constraints', constraint_strings)
     return retvar, CommandComplete(NoopCondition(), ct)