Skip to content

Commit

Permalink
Merge "Making object_alloc method return tuple of retrun code and err…
Browse files Browse the repository at this point in the history
…or_code, err_msg similar to aother methods."
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 9, 2016
2 parents 18fbe95 + d8daf22 commit b1b4855
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/config/api-server/vnc_cfg_ifmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def object_alloc(self, obj_type, parent_type, fq_name):
my_imid = 'contrail:%s:%s' %(res_type, my_fqn)
if parent_fqn:
if parent_type is None:
return (None, None)
err_msg = "Parent: %s type is none for: %s" % (parent_fqn,
my_fqn)
return False, (409, err_msg)
parent_imid = 'contrail:' + parent_type + ':' + parent_fqn
else: # parent is config-root
parent_imid = 'contrail:config-root:root'
Expand Down Expand Up @@ -1508,6 +1510,11 @@ def _dbe_resync(self, obj_type, obj_uuids):
parent_type = obj_dict.get('parent_type', None)
(ok, result) = self._ifmap_db.object_alloc(
obj_type, parent_type, obj_dict['fq_name'])
if not ok:
self.config_object_error(
obj_uuid, None, obj_type, 'dbe_resync:ifmap_alloc',
result[1])
continue
(my_imid, parent_imid) = result
except Exception as e:
self.config_object_error(
Expand Down

0 comments on commit b1b4855

Please sign in to comment.