Ignore merged env if environment files are specified
Ignore merged environment from the client, if there are 'environment_files' in the request for merging in the server. This would avoid the duplicates when 'parameter_merge_strategies' are specified in the first env file. Change-Id: I4ee274d69e42a47c4b8fd5a25567fb2eb144a8cc Related-Bug: #1635409
This commit is contained in:
parent
8bb04edee8
commit
2407c86436
|
@ -137,7 +137,9 @@ class InstantiationData(object):
|
|||
environment global options.
|
||||
"""
|
||||
env = {}
|
||||
if self.PARAM_ENVIRONMENT in self.data:
|
||||
# Don't use merged environment, if environment_files are supplied.
|
||||
if (self.PARAM_ENVIRONMENT in self.data and
|
||||
not self.data.get(self.PARAM_ENVIRONMENT_FILES)):
|
||||
env_data = self.data[self.PARAM_ENVIRONMENT]
|
||||
with self.parse_error_check('Environment'):
|
||||
if isinstance(env_data, dict):
|
||||
|
|
|
@ -167,6 +167,17 @@ blarg: wibble
|
|||
data = stacks.InstantiationData(body)
|
||||
self.assertEqual(env, data.environment())
|
||||
|
||||
def test_environment_with_env_files(self):
|
||||
env = {'parameters': {'foo': 'bar', 'blarg': 'wibble'}}
|
||||
body = {'environment': env, 'environment_files': ['env.yaml']}
|
||||
expect = {'parameters': {},
|
||||
'encrypted_param_names': [],
|
||||
'parameter_defaults': {},
|
||||
'event_sinks': [],
|
||||
'resource_registry': {}}
|
||||
data = stacks.InstantiationData(body)
|
||||
self.assertEqual(expect, data.environment())
|
||||
|
||||
def test_environment_and_parameters(self):
|
||||
body = {'parameters': {'foo': 'bar'},
|
||||
'environment': {'parameters': {'blarg': 'wibble'}}}
|
||||
|
|
Loading…
Reference in New Issue