From 604943fea79f42f0df743500462dce62fb6fd27c Mon Sep 17 00:00:00 2001 From: Przemyslaw Kaminski Date: Mon, 1 Jun 2015 16:12:11 +0200 Subject: [PATCH] glance: registry & api fixes --- example.py | 14 +++++++------- resources/glance_api_service/actions/run.yml | 7 +------ resources/glance_config/actions/remove.yml | 5 +++++ resources/glance_registry_service/actions/run.yml | 11 +---------- resources/glance_registry_service/meta.yaml | 6 ++++++ 5 files changed, 20 insertions(+), 23 deletions(-) create mode 100644 resources/glance_config/actions/remove.yml diff --git a/example.py b/example.py index e01427bb..070b2cbd 100644 --- a/example.py +++ b/example.py @@ -48,7 +48,7 @@ def deploy(): glance_config = resource.create('glance_config', 'resources/glance_config/', {'ip': '', 'ssh_key': '', 'ssh_user': '', 'keystone_ip': '', 'keystone_port': '', 'config_dir': {}, 'api_port': '', 'registry_port': '', 'mysql_ip': '', 'mysql_db': '', 'mysql_user': '', 'mysql_password': '', 'keystone_admin_user': '', 'keystone_admin_password': '', 'keystone_admin_tenant': ''}) glance_api_container = resource.create('glance_api_container', 'resources/glance_api_service/', {'image': 'cgenie/centos-rdo-glance-api', 'ports': [{'value': [{'value': 9292}]}], 'host_binds': [], 'volume_binds': [], 'db_password': '', 'keystone_password': '', 'keystone_admin_token': '', 'keystone_host': '', 'ip': '', 'ssh_key': '', 'ssh_user': ''}) - glance_registry_container = resource.create('glance_registry_container', 'resources/glance_registry_service/', {'image': 'cgenie/centos-rdo-glance-registry', 'ports': [{'value': [{'value': 9191}]}], 'host_binds': [], 'volume_binds': [], 'db_host': '', 'db_root_password': '', 'db_password': '', 'db_name': '', 'db_user': '', 'keystone_password': '', 'keystone_admin_token': '', 'keystone_host': '', 'ip': '', 'ssh_key': '', 'ssh_user': ''}) + glance_registry_container = resource.create('glance_registry_container', 'resources/glance_registry_service/', {'image': 'cgenie/centos-rdo-glance-registry', 'ports': [{'value': [{'value': 9191}]}], 'host_binds': [], 'volume_binds': [], 'db_host': '', 'db_root_password': '', 'db_password': '', 'db_name': '', 'db_user': '', 'keystone_admin_tenant': '', 'keystone_password': '', 'keystone_user': '', 'keystone_admin_token': '', 'keystone_host': '', 'ip': '', 'ssh_key': '', 'ssh_user': ''}) #### @@ -125,7 +125,7 @@ def deploy(): signals.connect(mariadb_service1, glance_registry_container, {'ip': 'db_host'}) signals.connect(glance_db, glance_registry_container, {'db_name': 'db_name', 'login_password': 'db_root_password'}) signals.connect(glance_db_user, glance_registry_container, {'new_user_name': 'db_user', 'new_user_password': 'db_password'}) - signals.connect(glance_keystone_user, glance_registry_container, {'user_password': 'keystone_password'}) + signals.connect(glance_keystone_user, glance_registry_container, {'tenant_name': 'keystone_admin_tenant', 'user_name': 'keystone_user', 'user_password': 'keystone_password'}) signals.connect(glance_keystone_user, glance_registry_container, {'login_token': 'keystone_admin_token'}) signals.connect(haproxy_config, glance_registry_container, {'ip': 'keystone_host'}) @@ -206,11 +206,11 @@ def undeploy(): resources = map(resource.wrap_resource, db.get_list('resource')) resources = {r.name: r for r in resources} - actions.resource_action(resources['glance_registry_container'], 'run') - actions.resource_action(resources['glance_api_container'], 'run') - actions.resource_action(resources['glance_config'], 'run') - actions.resource_action(resources['glance_db_user'], 'run') - actions.resource_action(resources['glance_db'], 'run') + actions.resource_action(resources['glance_registry_container'], 'remove') + actions.resource_action(resources['glance_api_container'], 'remove') + actions.resource_action(resources['glance_config'], 'remove') + actions.resource_action(resources['glance_db_user'], 'remove') + actions.resource_action(resources['glance_db'], 'remove') actions.resource_action(resources['haproxy_service'], 'remove') actions.resource_action(resources['haproxy_config'], 'remove') actions.resource_action(resources['keystone_service2'], 'remove') diff --git a/resources/glance_api_service/actions/run.yml b/resources/glance_api_service/actions/run.yml index fa365283..567748b0 100644 --- a/resources/glance_api_service/actions/run.yml +++ b/resources/glance_api_service/actions/run.yml @@ -3,6 +3,7 @@ sudo: yes tasks: - docker: + command: /bin/bash -c "glance-manage db_sync && /usr/bin/glance-api" name: {{ name }} image: {{ image }} state: running @@ -25,9 +26,3 @@ - {{ bind['value']['src'] }}:{{ bind['value']['dst'] }}:{{ bind['value'].get('mode', 'ro') }} {% endfor %} {% endif %} - env: - GLANCE_DB_PASSWORD: {{ db_password }} - GLANCE_KEYSTONE_PASSWORD: {{ keystone_password }} - KEYSTONE_ADMIN_SERVICE_HOST: {{ keystone_host }} - KEYSTONE_ADMIN_TOKEN: {{ keystone_admin_token }} - KEYSTONE_PUBLIC_SERVICE_HOST: {{ keystone_host }} diff --git a/resources/glance_config/actions/remove.yml b/resources/glance_config/actions/remove.yml new file mode 100644 index 00000000..a0a79ad4 --- /dev/null +++ b/resources/glance_config/actions/remove.yml @@ -0,0 +1,5 @@ + +- hosts: [{{ ip }}] + sudo: yes + tasks: + - shell: echo 'removed' diff --git a/resources/glance_registry_service/actions/run.yml b/resources/glance_registry_service/actions/run.yml index 52c68eeb..0235203b 100644 --- a/resources/glance_registry_service/actions/run.yml +++ b/resources/glance_registry_service/actions/run.yml @@ -3,6 +3,7 @@ sudo: yes tasks: - docker: + command: /bin/bash -c "glance-manage db_sync && /usr/bin/keystone-registry" name: {{ name }} image: {{ image }} state: running @@ -25,13 +26,3 @@ - {{ bind['value']['src'] }}:{{ bind['value']['dst'] }}:{{ bind['value'].get('mode', 'ro') }} {% endfor %} {% endif %} - env: - DB_ROOT_PASSWORD: {{ db_root_password }} - GLANCE_DB_PASSWORD: {{ db_password }} - GLANCE_DB_NAME: {{ db_name }} - GLANCE_DB_USER: {{ db_user }} - GLANCE_KEYSTONE_PASSWORD: {{ keystone_password }} - KEYSTONE_ADMIN_SERVICE_HOST: {{ keystone_host }} - KEYSTONE_ADMIN_TOKEN: {{ keystone_admin_token }} - KEYSTONE_PUBLIC_SERVICE_HOST: {{ keystone_host }} - MARIADB_SERVICE_HOST: {{ db_host }} diff --git a/resources/glance_registry_service/meta.yaml b/resources/glance_registry_service/meta.yaml index 4b51f07b..41734322 100644 --- a/resources/glance_registry_service/meta.yaml +++ b/resources/glance_registry_service/meta.yaml @@ -42,6 +42,12 @@ input: keystone_admin_token: schema: str! value: + keystone_admin_tenant: + schema: str! + value: + keystone_user: + schema: str! + value: keystone_password: schema: str! value: