Skip to content

Commit

Permalink
Quote OS_PASSWORD with single quotes
Browse files Browse the repository at this point in the history
Use single quotes around OS_PASSWORD to prevent shell variable
expansion. Add a test to validate contents of the openrc file.

Closes-Bug: 1663185
Change-Id: I4b1e7b5cb83061ea35108db545fdfa33cef037a5
  • Loading branch information
jimmymccrory committed Feb 15, 2017
1 parent 0738ae8 commit 6848f7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion templates/openrc.j2
Expand Up @@ -11,7 +11,7 @@ export NOVA_ENDPOINT_TYPE={{ openrc_nova_endpoint_type }}
export OS_ENDPOINT_TYPE={{ openrc_os_endpoint_type }}
export OS_INTERFACE={{ openrc_os_endpoint_type }}
export OS_USERNAME={{ openrc_os_username }}
export OS_PASSWORD="{{ openrc_os_password }}"
export OS_PASSWORD='{{ openrc_os_password }}'
export OS_PROJECT_NAME={{ openrc_os_tenant_name }}
export OS_TENANT_NAME={{ openrc_os_tenant_name }}
export OS_AUTH_URL={{ openrc_os_auth_url }}
Expand Down
7 changes: 4 additions & 3 deletions tests/test.yml
Expand Up @@ -18,14 +18,15 @@
roles:
- role: "openstack_openrc"
post_tasks:
- name: Check /root/openrc file
stat:
- name: Slurp /root/openrc file
slurp:
path: /root/openrc
register: openrc_file
- name: Check role functions
assert:
that:
- "openrc_file.stat.exists"
- "'export OS_USER_DOMAIN_NAME=Default' in (openrc_file.content | b64decode)"
- "'export OS_PASSWORD=\\'secrete\\'' in (openrc_file.content | b64decode)"
- name: Check /root/.config/openstack/clouds.yaml file
stat:
path: /root/.config/openstack/clouds.yaml
Expand Down

0 comments on commit 6848f7d

Please sign in to comment.