Add defualt property list

Change-Id: I7e5ae6e8a851813b2892bd4b9a2a33ff3539ce7f
This commit is contained in:
cao.yuan 2019-07-24 18:21:53 +08:00 committed by jacky06
parent 4a0d70ead9
commit 68eb78edcb
2 changed files with 18 additions and 1 deletions

View File

@ -145,8 +145,10 @@ class PropertyApi(object):
property_list = ansible_properties.get_all_unique()
elif property_type == GROUP_TYPE:
property_list = ansible_properties.get_group_list(get_set)
else:
elif property_type == HOST_TYPE:
property_list = ansible_properties.get_host_list(get_set)
else:
property_list = ansible_properties.get_default_unique()
override_flags = ansible_properties.get_all_override_flags()

View File

@ -33,6 +33,13 @@ GLOBALS_PATH = 'ansible/group_vars/__GLOBAL__'
ANSIBLE_ROLES_PATH = 'ansible/roles'
ANSIBLE_DEFAULTS_PATH = 'defaults/main.yml'
DEFAULT_KEYS = ['kolla_base_distro',
'kolla_install_type',
'openstack_release',
'kolla_internal_vip_address',
'network_interface',
'neutron_external_interface']
class AnsibleProperties(object):
@ -239,6 +246,14 @@ class AnsibleProperties(object):
unique_list.append(value)
return sorted(unique_list, key=lambda x: x.name)
def get_default_unique(self):
self._load_properties()
default_list = []
for key, value in self.unique_global_props.items():
if key in DEFAULT_KEYS or key.startswith('enable_'):
default_list.append(value)
return default_list
def get_all_override_flags(self):
self._load_properties()
return self.unique_override_flags