Exemplo n.º 1
0
    def show(self, component: str):
        ''' pretty click.echo existing configuration '''
        print_title(f"{component} Configuration")
        items = [[k, v] for k, v in self.configs[component].items()]
        fields = ["Name", "Configuration"]

        click.echo(add_pretty_table(fields, items))
Exemplo n.º 2
0
    def configure(self, component: str):
        print_title(f"\nConfiguring {component} deployment variables")
        cfgs = self.configs[component]
        # TODO: use a different yaml loader to ensure we load inorder
        # sort the variables to group the inputs together
        config_vars = self.config_vars[component].items()
        for config_key, config_info in sorted(config_vars, key=lambda s: s[0]):
            if not config_info['Required']:
                continue

            config_desc = config_info.get('Description', config_key).strip('.')
            v = cfgs.get(config_key)
            if v:
                inp = get_input(f"{config_key}({config_desc})", v)
            else:
                inp = get_input(f"{config_key}({config_desc})", v)

            if not inp and v is None:
                if not click.confirm(
                        "press 'y' to set empty string and "
                        "'n' to skip",
                        prompt_suffix=': '):
                    continue
                inp = ""

            cfgs[config_key] = input_to_type(inp, config_info.get('Type'))
Exemplo n.º 3
0
 def info(self, component: str):
     ''' pretty click.echo vars yml '''
     print_title(f"{component} Configuration Options")
     fields = ["Name", "Description", "Type", "Required", "Used By"]
     items = []
     for k, v in self.config_vars[component].items():
         items.append([
             k, v["Description"], v["Type"], v["Required"], v["ConfigApps"]
         ])
     click.echo(add_pretty_table(fields, items))