Example #1
0
 def _order(self) -> int:
     if self.__order is None:
         try:
             self.__order = STEPS.index(self)
         except ValueError:
             raise errors.InvalidStepError(self.name)
     return self.__order
Example #2
0
    def working_directory_for_step(self, step: steps.Step) -> str:
        if step == steps.PULL:
            return self.plugin.sourcedir
        elif step == steps.BUILD:
            return self.plugin.builddir
        elif step == steps.STAGE:
            return self.stagedir
        elif step == steps.PRIME:
            return self.primedir

        raise errors.InvalidStepError(step.name)
Example #3
0
def get_step_by_name(step_name):
    """Get the lifecycle step that has the given name.

    :param str step_name: Name of the step in question.
    :return: The Step in the lifecycle that has the given name.
    :rtype: Step
    :raises: errors.InvalidStepError if there is no step with the given name.
    """
    if step_name:
        for step in STEPS:
            if step.name == step_name:
                return step
        raise errors.InvalidStepError(step_name)
    else:
        return STEPS[0]