Пример #1
0
 def resolve(self, value=True):
     """Returns the YAML boolean value. """
     value = yaml.load(str(value))
     if not isinstance(value, bool):
         raise exceptions.IRException("--{} expects boolean values".format(
             self.arg_name))
     return value
Пример #2
0
    def activate(self, name):
        """Activates the workspace."""

        if os.environ.get(ACTIVE_WORKSPACE_ENV_NAME):
            raise exceptions.IRException(
                message="'workspace checkout' command is disabled while "
                "{} environment variable is set.".format(
                    ACTIVE_WORKSPACE_ENV_NAME))

        if self.has_workspace(name):
            with open(self.active_file, 'w') as prf_file:
                prf_file.write(name)
            LOG.debug("Activating workspace %s in %s", name,
                      os.path.join(self.workspace_dir, name))
        else:
            raise exceptions.IRWorkspaceMissing(workspace=name)
Пример #3
0
    def activate(self, name):
        """Activates the workspace.

        :param name: Name of the workspace to activate
        """

        if os.environ.get(ACTIVE_WORKSPACE_ENV_NAME):
            raise exceptions.IRException(
                message="'workspace checkout' command is disabled while "
                "{} environment variable is set.".format(
                    ACTIVE_WORKSPACE_ENV_NAME))

        if name == self.active_basename:
            raise exceptions.IRWorkspaceInvalidName(workspace=name)

        if self.has_workspace(name):
            self._create_active_path(name)
            LOG.debug("Activating workspace %s in %s", name,
                      os.path.join(self.workspace_dir, name))
        else:
            raise exceptions.IRWorkspaceMissing(workspace=name)