Moving the 'export_data' dict into constants

The 'export_data' variable in the 'tripleoclient.export.export_stack'
is accessed in read-only manner and is used to determine
parameters selected for export.

It is, effectivelly, a constant, but placed within a function
body, without declaration of it's exact contents in the docstrings.

By moving the 'export_data' among constants, we expose the information
about exported parameters, with minimal change to the original code,
as the 'tripleoclient.constants' is already imported by the module.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I408560ffbecd145b476aa5205c4fd1c780491d0c
This commit is contained in:
Jiri Podivin 2021-06-24 10:35:40 +02:00
parent e8dae35edd
commit 2400624bd4
2 changed files with 22 additions and 21 deletions

View File

@ -230,6 +230,27 @@ EXPORT_PASSWORD_EXCLUDE_PATTERNS = [
'ceph.*'
]
EXPORT_DATA = {
"EndpointMap": {
"parameter": "EndpointMapOverride",
},
"HostsEntry": {
"parameter": "ExtraHostFileEntries",
},
"GlobalConfig": {
"parameter": "GlobalConfigExtraMapData",
},
"AllNodesConfig": {
"file": "group_vars/overcloud.json",
"parameter": "AllNodesExtraMapData",
"filter": ["oslo_messaging_notify_short_bootstrap_node_name",
"oslo_messaging_notify_node_names",
"oslo_messaging_rpc_node_names",
"memcached_node_ips",
"ovn_dbs_vip",
"redis_vip"]},
}
# Package that need to be to the latest before undercloud
# update/update
UNDERCLOUD_EXTRA_PACKAGES = [

View File

@ -60,31 +60,11 @@ def export_stack(heat, stack, should_filter=False,
# output.File is relative to <config-download-dir>/stack.
# filter: in case only specific settings should be
# exported from parameter data.
export_data = {
"EndpointMap": {
"parameter": "EndpointMapOverride",
},
"HostsEntry": {
"parameter": "ExtraHostFileEntries",
},
"GlobalConfig": {
"parameter": "GlobalConfigExtraMapData",
},
"AllNodesConfig": {
"file": "group_vars/overcloud.json",
"parameter": "AllNodesExtraMapData",
"filter": ["oslo_messaging_notify_short_bootstrap_node_name",
"oslo_messaging_notify_node_names",
"oslo_messaging_rpc_node_names",
"memcached_node_ips",
"ovn_dbs_vip",
"redis_vip"]},
}
data = {}
heat_stack = oooutils.get_stack(heat, stack)
for export_key, export_param in export_data.items():
for export_key, export_param in constants.EXPORT_DATA.items():
param = export_param["parameter"]
if "file" in export_param:
# get file data