Merge pull request #148 from CGenie/cgenie/connections-graph-fix

fix hosts_file run action + color_repr
This commit is contained in:
Jędrzej Nowak 2015-09-15 16:09:44 +02:00
commit 3bb6cafe2b
3 changed files with 20 additions and 5 deletions

View File

@ -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 %}

View File

@ -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:

View File

@ -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)