Remove duplicate implementation for deep_update.

'deep_update' utility function is implemented at [1] and again re-implemented at [2] and its used at [3].

Implementation at [2] must be removed to facilitate importing of the utils lib and use the existing function.

[1] http://git.openstack.org/cgit/openstack/tacker/tree/tacker/common/utils.py#n206
[2] http://git.openstack.org/cgit/openstack/tacker/tree/tacker/vnfm/infra_drivers/openstack/openstack.py#n213
[3] http://git.openstack.org/cgit/openstack/tacker/tree/tacker/nfvo/nfvo_plugin.py#n144

Change-Id: I138a8272f23ad0c3fb42cb2ab99ca7380ef0b130
Closes-Bug: #1686658
This commit is contained in:
Trinath Somanchi 2017-04-27 16:13:08 +05:30
parent af67ed3282
commit dd8d933739
1 changed files with 2 additions and 11 deletions

View File

@ -23,6 +23,7 @@ from oslo_serialization import jsonutils
import yaml
from tacker.common import log
from tacker.common import utils
from tacker.extensions import vnfm
from tacker.vnfm.infra_drivers import abstract_driver
from tacker.vnfm.infra_drivers.openstack import heat_client as hc
@ -209,19 +210,9 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
if not update_dict:
return
@log.log
def deep_update(orig_dict, new_dict):
for key, value in new_dict.items():
if isinstance(value, dict):
if key in orig_dict and isinstance(orig_dict[key], dict):
deep_update(orig_dict[key], value)
continue
orig_dict[key] = value
LOG.debug('dict orig %(orig)s update %(update)s',
{'orig': config_dict, 'update': update_dict})
deep_update(config_dict, update_dict)
utils.deep_update(config_dict, update_dict)
LOG.debug('dict new %(new)s update %(update)s',
{'new': config_dict, 'update': update_dict})
new_yaml = yaml.safe_dump(config_dict)