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:
parent
af67ed3282
commit
dd8d933739
|
@ -23,6 +23,7 @@ from oslo_serialization import jsonutils
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from tacker.common import log
|
from tacker.common import log
|
||||||
|
from tacker.common import utils
|
||||||
from tacker.extensions import vnfm
|
from tacker.extensions import vnfm
|
||||||
from tacker.vnfm.infra_drivers import abstract_driver
|
from tacker.vnfm.infra_drivers import abstract_driver
|
||||||
from tacker.vnfm.infra_drivers.openstack import heat_client as hc
|
from tacker.vnfm.infra_drivers.openstack import heat_client as hc
|
||||||
|
@ -209,19 +210,9 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
|
||||||
if not update_dict:
|
if not update_dict:
|
||||||
return
|
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',
|
LOG.debug('dict orig %(orig)s update %(update)s',
|
||||||
{'orig': config_dict, 'update': update_dict})
|
{'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',
|
LOG.debug('dict new %(new)s update %(update)s',
|
||||||
{'new': config_dict, 'update': update_dict})
|
{'new': config_dict, 'update': update_dict})
|
||||||
new_yaml = yaml.safe_dump(config_dict)
|
new_yaml = yaml.safe_dump(config_dict)
|
||||||
|
|
Loading…
Reference in New Issue