diff --git a/resources/hosts_file/actions/run.yaml b/resources/hosts_file/actions/run.yaml index 61876e05..68959684 100644 --- a/resources/hosts_file/actions/run.yaml +++ b/resources/hosts_file/actions/run.yaml @@ -1,11 +1,11 @@ - hosts: [{{host}}] sudo: yes tasks: - {% for ip, host in zip(hosts_ips.value, hosts_names.value) %} - - name: Create hosts entries for {{host['value']}} => {{ip['value']}} + {% for ip, host in zip(hosts_ips, hosts_names) %} + - name: Create hosts entries for {{host}} => {{ip}} lineinfile: dest: /etc/hosts - regexp: '.*{{host["value"]}}$' - line: '{{ip["value"]}} {{host["value"]}}' + regexp: '.*{{host}}$' + line: '{{ip}} {{host}}' state: present {% endfor %} diff --git a/solar/solar/cli/main.py b/solar/solar/cli/main.py index 5be1529d..846eb34c 100644 --- a/solar/solar/cli/main.py +++ b/solar/solar/cli/main.py @@ -262,7 +262,7 @@ def init_cli_resource(): def show(**kwargs): resources = [] - for name, res in sresource.load_all().items(): + for res in sresource.load_all(): show = True if kwargs['tag']: if kwargs['tag'] not in res.tags: diff --git a/solar/solar/core/resource/resource.py b/solar/solar/core/resource/resource.py index 0bb6309e..0f182351 100644 --- a/solar/solar/core/resource/resource.py +++ b/solar/solar/core/resource/resource.py @@ -124,6 +124,21 @@ class Resource(object): return ret + def color_repr(self): + import click + + arg_color = 'yellow' + + return ("{resource_s}({name_s}='{id}', {base_path_s}={base_path} " + "{args_s}={input}, {tags_s}={tags})").format( + resource_s=click.style('Resource', fg='white', bold=True), + name_s=click.style('name', fg=arg_color, bold=True), + base_path_s=click.style('base_path', fg=arg_color, bold=True), + args_s=click.style('args', fg=arg_color, bold=True), + tags_s=click.style('tags', fg=arg_color, bold=True), + **self.to_dict() + ) + def load(name): r = orm.DBResource.load(name)