def edit_executor(self):
     name = click.prompt("Name")
     if name not in self.executors_dict:
         click.secho(f"There is no {name} executor", fg="yellow")
         return
     new_name = None
     while new_name is None:
         new_name = self.check_executors_name("New name", default=name)
     if new_name != name:
         value = self.executors_dict[name]
         self.executors_dict.pop(name)
         self.executors_dict[new_name] = value
         name = new_name
     section = Sections.EXECUTOR_DATA.format(name)
     repo_executor = self.executors_dict[section].get("repo_executor")
     if repo_executor:
         repo_name = re.search(r"(^[a-zA-Z0-9_-]+)(?:\..*)*$",
                               repo_executor).group(1)
         metadata = executor_metadata(repo_name)
         process_repo_var_envs(name, metadata)
     else:
         cmd = click.prompt("Command to execute",
                            default=self.executors_dict[section]["cmd"])
         self.executors_dict[section]["cmd"] = cmd
         process_var_envs(name)
         process_params(name)
     click.secho("Update repository executor finish", fg="green")
Exemple #2
0
 def edit_executor(self):
     name = click.prompt("Name")
     if name not in self.executors_list:
         print(f"{Bcolors.WARNING}There is no {name} executor{Bcolors.ENDC}")
         return
     new_name = None
     while new_name is None:
         new_name = self.check_executors_name("New name", default=name)
     if new_name != name:
         for unformatted_section in Wizard.EXECUTOR_SECTIONS:
             section = unformatted_section.format(new_name)
             old_section = unformatted_section.format(name)
             config.instance.add_section(section)
             for item in config.instance.items(old_section):
                 config.instance.set(section, item[0], item[1])
             config.instance.remove_section(old_section)
         self.executors_list.remove(name)
         self.executors_list.append(new_name)
         name = new_name
     section = Sections.EXECUTOR_DATA.format(name)
     repo_name = config.instance[section].get("repo_executor", None)
     if repo_name:
         metadata = executor_metadata(repo_name)
         process_repo_var_envs(name, metadata)
     else:
         cmd = click.prompt("Command to execute", default=config.instance.get(section, "cmd"))
         config.instance.set(section, "cmd", cmd)
         process_var_envs(name)
         process_params(name)
     print(f"{Bcolors.OKGREEN}Update repository executor finish" f"{Bcolors.ENDC}")
Exemple #3
0
 def edit_executor(self):
     name = click.prompt("Name")
     if name not in self.executors_list:
         print(
             f"{Bcolors.WARNING}There is no {name} executor{Bcolors.ENDC}")
         return
     new_name = None
     while new_name is None:
         new_name = self.check_executors_name("New name", default=name)
     if new_name != name:
         for unformatted_section in Wizard.EXECUTOR_SECTIONS:
             section = unformatted_section.format(new_name)
             old_section = unformatted_section.format(name)
             config.instance.add_section(section)
             for item in config.instance.items(old_section):
                 config.instance.set(section, item[0], item[1])
             config.instance.remove_section(old_section)
         self.executors_list.remove(name)
         self.executors_list.append(new_name)
         name = new_name
     section = Sections.EXECUTOR_DATA.format(name)
     repo_name = config.instance[section].get("repo_executor", None)
     if repo_name:
         max_buff_size = click.prompt(
             "Max data sent to server",
             type=click.IntRange(min=Wizard.MAX_BUFF_SIZE),
             default=config.instance.get(section, "max_size"),
         )
         config.instance.set(section, "max_size", f"{max_buff_size}")
         metadata = executor_metadata(repo_name)
         process_repo_var_envs(name, metadata)
     else:
         cmd = click.prompt("Command to execute",
                            default=config.instance.get(section, "cmd"))
         max_buff_size = click.prompt(
             "Max data sent to server",
             type=click.IntRange(min=Wizard.MAX_BUFF_SIZE),
             default=config.instance.get(section, "max_size"),
         )
         config.instance.set(section, "cmd", cmd)
         config.instance.set(section, "max_size", f"{max_buff_size}")
         process_var_envs(name)
         process_params(name)
 def new_custom_executor(self, name):
     cmd = click.prompt("Command to execute", default="exit 1")
     Wizard.set_generic_data(name, cmd=cmd)
     process_var_envs(name)
     process_params(name)