From c1dc55fcebaed3f702640091c459843a7842512f Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 13 Apr 2015 11:47:18 -0400 Subject: [PATCH] Merging chrismeyers's openstack work branch changes to the core openstack module. Adding python-netifaces dependency for setup packaging --- awx/plugins/inventory/openstack.py | 17 ++++++----------- tools/docker/Dockerfile | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/awx/plugins/inventory/openstack.py b/awx/plugins/inventory/openstack.py index 92a81ac0e9..491c192f99 100755 --- a/awx/plugins/inventory/openstack.py +++ b/awx/plugins/inventory/openstack.py @@ -50,11 +50,11 @@ import shade class OpenStackInventory(object): - def __init__(self, private=False, refresh=False): + def __init__(self, refresh=False): + config_files = [ os.environ.get('OPENSTACK_CONFIG_FILE', None) + or '/etc/ansible/openstack.yml' ] self.openstack_config = os_client_config.config.OpenStackConfig( - os_client_config.config.CONFIG_FILES.append( - '/etc/ansible/openstack.yml'), - private) + config_files) self.clouds = shade.openstack_clouds(self.openstack_config) self.refresh = refresh @@ -92,10 +92,8 @@ class OpenStackInventory(object): hostvars = collections.defaultdict(dict) for cloud in self.clouds: - # Cycle on servers for server in cloud.list_servers(): - meta = cloud.get_server_meta(server) if 'interface_ip' not in meta['server_vars']: @@ -131,9 +129,6 @@ class OpenStackInventory(object): def parse_args(): parser = argparse.ArgumentParser(description='OpenStack Inventory Module') - parser.add_argument('--private', - action='store_true', - help='Use private address for ansible host') parser.add_argument('--refresh', action='store_true', help='Refresh cached information') group = parser.add_mutually_exclusive_group(required=True) @@ -146,7 +141,7 @@ def parse_args(): def main(): args = parse_args() try: - inventory = OpenStackInventory(args.private, args.refresh) + inventory = OpenStackInventory(args.refresh) if args.list: inventory.list_instances() elif args.host: @@ -158,4 +153,4 @@ def main(): if __name__ == '__main__': - main() + main() \ No newline at end of file diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 242ec337b9..863210e7a3 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update RUN apt-get install -y software-properties-common python-software-properties RUN add-apt-repository -y ppa:chris-lea/redis-server; add-apt-repository -y ppa:chris-lea/zeromq; add-apt-repository -y ppa:chris-lea/node.js RUN apt-get update -RUN apt-get install -y tmux git mercurial subversion python-dev python-pip libyaml-dev python-yaml python-paramiko python-jinja2 make postgresql python-psycopg2 python-ldap nodejs redis-server python-gevent libzmq3 python-zmq && rm -rf /var/lib/apt/lists/* +RUN apt-get install -y tmux git mercurial subversion python-dev python-pip libyaml-dev python-yaml python-paramiko python-jinja2 make postgresql python-psycopg2 python-ldap nodejs redis-server python-gevent libzmq3 python-zmq python-netifaces && rm -rf /var/lib/apt/lists/* RUN git clone http://d7f73f8614295715a4777bf15f46d0d486ad0e21:x-oauth-basic@github.com/ansible/ansible-commander.git tower RUN pip install Django==1.6.7 django-devserver django-debug-toolbar django-jenkins ipython ansible RUN cd /tower ; make develop