Adding global secret configs support

Change-Id: I00fab3d6926eb1fa0a8c6817d2b6f698ea930e6d
Depends-On: Ie6a9833cdf73b076e24204d47e5898dfb24de43e
This commit is contained in:
Andrey Pavlov 2017-03-03 14:35:24 +04:00
parent 9812b2a158
commit 10dcd1bdb3
2 changed files with 7 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import six
VARIABLES = {}
GLOBALS_PATH = '/etc/ccp/globals/globals.json'
GLOBALS_SECRETS_PATH = '/etc/ccp/global-secrets/global-secrets.json'
NODES_CONFIG_PATH = '/etc/ccp/nodes-config/nodes-config.json'
SERVICE_CONFIG_PATH = '/etc/ccp/service-config/service-config.json'
META_FILE = "/etc/ccp/meta/meta.json"
@ -505,6 +506,10 @@ def get_variables(role_name):
LOG.info("Getting global variables from %s", GLOBALS_PATH)
with open(GLOBALS_PATH) as f:
variables = json.load(f)
LOG.info("Getting secret variables from %s", GLOBALS_SECRETS_PATH)
with open(GLOBALS_SECRETS_PATH) as f:
secrets = json.load(f)
merge_configs(variables, secrets)
if os.path.isfile(SERVICE_CONFIG_PATH):
LOG.info("Getting service variables from %s", SERVICE_CONFIG_PATH)
with open(SERVICE_CONFIG_PATH) as f:

View File

@ -89,7 +89,7 @@ class TestGetVariables(base.TestCase):
@mock.patch('json.load')
@mock.patch('fuel_ccp_entrypoint.start_script.create_network_topology')
def test_get_variables(self, m_create_network_topology, m_json_load):
m_json_load.side_effect = [{'glob': 'glob_val'}, {}]
m_json_load.side_effect = [{'glob': 'glob_val'}, {}, {}]
m_create_network_topology.return_value = 'network_topology'
r_value = start_script.get_variables('role')
e_value = {
@ -123,6 +123,7 @@ class TestGetVariables(base.TestCase):
'n': ['o', 'p', 'q'],
'r': 's'
},
{},
# nodes configs
{
'node[1-3]': {