Resources moved to top level of configuration hash

Change-Id: I6884d0eff2c247dd75f76c4d39d7406249201c90
This commit is contained in:
Dmitry Ukov 2016-11-10 16:19:56 +03:00
parent 8975dfbc56
commit 82efc7e153
3 changed files with 2 additions and 34 deletions

View File

@ -56,4 +56,4 @@ class OpenStackConfig(object):
for key, value in default_items:
config_resource["DEFAULT/{}".format(key)] = {'value': value}
return config_resource
return {self.config_name: config_resource}

View File

@ -1,32 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from fuel_external_git.drivers.openstack_config import OpenStackConfig
from fuel_external_git.tests import base
class TestOpenStackConfig(base.TestCase):
def test_dict_generation(self):
resource = {
'DEFAULT/global_param': {
'value': 'global_param'
},
'DEFAULT/global_param_to_override': {
'value': 'global_param_to_override'
},
}
file_name = os.path.join(self.cfg_sample_dir, 'nova.conf')
cfg = OpenStackConfig(file_name, self.config['resource_mapping'])
self.assertEqual(cfg.to_config_dict(), resource)

View File

@ -41,7 +41,7 @@ def get_config_hash(file_dir, resource_mapping, exts=['conf']):
os.path.join(file_dir, conf_file),
resource_mapping[conf_file]['resource']
)
res[config.config_name] = config.to_config_dict()
deep_merge(res, config.to_config_dict())
return res