def specify_upgrade_path(self):
        if self.upgrade_path is None:
            self.upgrade_path = get_user_input(settings.upgrade_path, any_input=True)

        if not get_valid_scenario(self.upgrade_path):
            print ("Scenario '%s' is not valid.\nIt has to be like RHEL6_7 or CentOS7_RHEL7." % self.content_path)
            return None

        message = 'Path %s already exists.\nDo you want to create a content there?' % self.upgrade_path
        if UIHelper.check_path(self.get_upgrade_path(), message) is None:
            return None

        return True
    def specify_upgrade_path(self):
        if self.upgrade_path is None:
            self.upgrade_path = get_user_input(settings.upgrade_path,
                                               any_input=True)

        if not get_valid_scenario(self.upgrade_path):
            print(
                "Scenario '%s' is not valid.\nIt has to be like RHEL6_7 or CentOS7_RHEL7."
                % self.content_path)
            return None

        message = 'Path %s already exists.\nDo you want to create a content there?' % self.upgrade_path
        if UIHelper.check_path(self.get_upgrade_path(), message) is None:
            return None

        return True
Example #3
0
 def get_scenario(self):
     """The function returns scenario"""
     scenario = None
     try:
         sep_content = os.path.dirname(self.content).split('/')
         if self.conf.contents:
             dir_name = utils.get_valid_scenario(self.content)
             if dir_name is None:
                 return None
             check_name = dir_name
         else:
             check_name = self.conf.scan
         scenario = [x for x in sep_content if check_name in x][0]
     except IndexError:
         scenario = None
     return scenario
Example #4
0
    def __init__(self, argument):
        """
        Specify dirname with the on content
        :param argument: dirname where content is
        :return:
        """
        self.result_dir = argument
        self.dir_name = self.result_dir + variables.result_prefix
        if self.result_dir.endswith("/"):
            self.dir_name = self.result_dir[:-1] + variables.result_prefix

        # Delete previous contents if they exist.
        if os.path.exists(self.dir_name):
            shutil.rmtree(self.dir_name)

        if get_valid_scenario(self.dir_name) is None:
            print ('Use valid scenario like RHEL6_7 or CENTOS6_RHEL6')
            sys.exit(1)
Example #5
0
    def __init__(self, argument):
        """
        Specify dirname with the on content
        :param argument: dirname where content is
        :return:
        """
        self.result_dir = argument
        self.dir_name = self.result_dir + variables.result_prefix
        if self.result_dir.endswith("/"):
            self.dir_name = self.result_dir[:-1] + variables.result_prefix

        # Delete previous contents if they exist.
        if os.path.exists(self.dir_name):
            shutil.rmtree(self.dir_name)

        if get_valid_scenario(self.dir_name) is None:
            print('Use valid scenario like RHEL6_7 or CENTOS6_RHEL6')
            sys.exit(1)