Skip to content

Commit 51d9735

Browse files
mdboothEmilienM
authored andcommitted
Use manila client instead of osc
Manila client as installed by RHEL/OSP doesn't have OSC support.
1 parent cab86d7 commit 51d9735

2 files changed

Lines changed: 41 additions & 8 deletions

File tree

playbooks/files/cloud-to-env.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/python3
2+
3+
import itertools
4+
import json
5+
import os
6+
import yaml
7+
8+
def cloud_to_env(d):
9+
return itertools.chain.from_iterable(
10+
cloud_to_env(v) if isinstance(v, dict)
11+
else (("OS_%s" % k.upper(), v),)
12+
for k, v in d.items())
13+
14+
with open("%s/.config/openstack/clouds.yaml" % os.environ['HOME']) as f:
15+
clouds = yaml.safe_load(f)
16+
17+
os_cloud=os.environ['OS_CLOUD']
18+
cloud=clouds['clouds'][os_cloud]
19+
env_vars=dict(cloud_to_env(cloud))
20+
print(json.dumps(env_vars))

playbooks/prepare_stack.yaml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,29 @@
111111
environment:
112112
OS_CLOUD: standalone
113113

114+
# openstack cli doesn't have manila support (no openstack share type ...)in RHEL/OSP
114115
- name: Create Manila share type for CephFS NFS # noqa 301
115-
shell: |
116-
if ! openstack share type show cephfsnfstype; then
117-
openstack share type create --snapshot-support false cephfsnfstype false
118-
fi
119116
when: manila_enabled
120-
environment:
121-
OS_CLOUD: standalone
122-
# https://bugzilla.redhat.com/show_bug.cgi?id=1960710
123-
OS_SHARE_API_VERSION: 2.60
117+
block:
118+
- name: Convert clouds.yaml to legacy environment variables
119+
script: files/cloud-to-env.py
120+
register: os_env_vars
121+
environment:
122+
OS_CLOUD: standalone
123+
124+
# type-show MUST NOT have OS_SHARE_API_VERSION set
125+
# type-create MUST have OS_SHARE_API_VERSION set
126+
- name: Create Manila share type
127+
shell: |
128+
if ! OS_SHARE_API_VERSION= manila type-show cephfsnfstype; then
129+
manila type-create --snapshot_support false cephfsnfstype false
130+
fi
131+
environment: "{{ legacy_vars | combine(extra_vars) }}"
132+
vars:
133+
legacy_vars: "{{ os_env_vars.stdout | from_json }}"
134+
extra_vars:
135+
# https://bugzilla.redhat.com/show_bug.cgi?id=1960710
136+
OS_SHARE_API_VERSION: 2.60
124137

125138
- name: Read clouds.yaml
126139
slurp:

0 commit comments

Comments
 (0)