Metdata was missing section
If there is no section, section will default to DEFAULT. Change-Id: I4d42d0ceac54e923cdb7d62b801336e1f07d258c
This commit is contained in:
parent
e89796ad1c
commit
b04a1b2fb4
@ -8,6 +8,7 @@ def parse_config(serviceName, fileName):
|
|||||||
# stored.
|
# stored.
|
||||||
values = {}
|
values = {}
|
||||||
with open(fileName) as config:
|
with open(fileName) as config:
|
||||||
|
section = None
|
||||||
for line in config:
|
for line in config:
|
||||||
pair = line.replace('#', '')
|
pair = line.replace('#', '')
|
||||||
pair = pair.replace('\n', '')
|
pair = pair.replace('\n', '')
|
||||||
@ -20,9 +21,10 @@ def parse_config(serviceName, fileName):
|
|||||||
# excludes any line without a key/val pair
|
# excludes any line without a key/val pair
|
||||||
valid_line = not line.startswith(
|
valid_line = not line.startswith(
|
||||||
"# ") and '[' not in line and line != '\n' and line != '#\n' and "password" not in line.lower()
|
"# ") and '[' not in line and line != '\n' and line != '#\n' and "password" not in line.lower()
|
||||||
if '#' not in line and valid_line:
|
if line.startswith('['):
|
||||||
values["openstack_" + serviceName + "_" + pair[0]] = pair[1]
|
section = line.replace('[','').replace(']','').replace('\n','')
|
||||||
|
if '#' not in line and valid_line and not section == None:
|
||||||
|
values["openstack_S_" + serviceName + "_S_" + section + "_S_" + pair[0]] = pair[1]
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@
|
|||||||
|
|
||||||
- name: Set keystone httpd worker facts
|
- name: Set keystone httpd worker facts
|
||||||
set_fact:
|
set_fact:
|
||||||
openstack_keystone_admin_workers_processes: "{{ keystone_admin_worker_processes.stdout }}"
|
openstack_S_keystone_S_admin_workers_S_processes: "{{ keystone_admin_worker_processes.stdout }}"
|
||||||
openstack_keystone_admin_workers_threads: "{{ keystone_admin_worker_threads.stdout }}"
|
openstack_S_keystone_S_admin_workers_S_threads: "{{ keystone_admin_worker_threads.stdout }}"
|
||||||
openstack_keystone_main_workers_processes: "{{ keystone_main_worker_processes.stdout }}"
|
openstack_S_keystone_S_main_workers_S_processes: "{{ keystone_main_worker_processes.stdout }}"
|
||||||
openstack_keystone_main_workers_threads: "{{ keystone_main_worker_threads.stdout }}"
|
openstack_S_keystone_S_main_workers_S_threads: "{{ keystone_main_worker_threads.stdout }}"
|
||||||
when: keystone_in_eventlet.stdout|int == 0
|
when: keystone_in_eventlet.stdout|int == 0
|
||||||
|
@ -72,18 +72,35 @@ class Metadata(object):
|
|||||||
software_dict = {}
|
software_dict = {}
|
||||||
for soft in item:
|
for soft in item:
|
||||||
if 'openstack' in soft:
|
if 'openstack' in soft:
|
||||||
service = soft.split('_')
|
"""
|
||||||
key = soft.split('_', 2)[2]
|
Why _S_? Because Ansible doesn't allow for
|
||||||
service_name = service[1]
|
many seperators. The _S_ was used to mimic
|
||||||
|
a seperator.
|
||||||
|
"""
|
||||||
|
service = soft.split('_S_')
|
||||||
|
if len(service) < 2 :
|
||||||
|
service = soft.split('_')
|
||||||
|
key = service[2]
|
||||||
|
section = "DEFAULT"
|
||||||
|
service_name = service[1]
|
||||||
|
else :
|
||||||
|
key = service[3]
|
||||||
|
section = service[2]
|
||||||
|
service_name = service[1]
|
||||||
|
|
||||||
node = item['inventory_hostname']
|
node = item['inventory_hostname']
|
||||||
if service_name in software_dict:
|
|
||||||
if service_name in soft:
|
if service_name in software_dict :
|
||||||
software_dict[service_name][key] = item[soft]
|
if section in software_dict[service_name] :
|
||||||
|
software_dict[service_name][section][key] = item[soft]
|
||||||
|
else :
|
||||||
|
software_dict[service_name][section] = {}
|
||||||
|
software_dict[service_name][section][key] = item[soft]
|
||||||
else:
|
else:
|
||||||
software_dict[service_name] = {}
|
software_dict[service_name] = {}
|
||||||
if service_name in soft:
|
software_dict[service_name]['node_name'] = node
|
||||||
software_dict[service_name]['node_name'] = node
|
software_dict[service_name][section] = {}
|
||||||
software_dict[service_name][key] = item[soft]
|
software_dict[service_name][section][key] = item[soft]
|
||||||
|
|
||||||
soft_all_dict.append(software_dict)
|
soft_all_dict.append(software_dict)
|
||||||
return soft_all_dict
|
return soft_all_dict
|
||||||
|
Loading…
x
Reference in New Issue
Block a user