def update_vnc_obj(self, obj=None): if obj: old_obj = None self.obj = obj else: old_obj = getattr(self, 'obj', None) uuid = getattr(self, 'uuid', None) if uuid: self.obj = self.read_vnc_obj(uuid=uuid) else: self.obj = self.read_vnc_obj(fq_name=self.name) changed = [] for field in self.ref_fields or []: old_field = getattr(old_obj, field + '_refs', None) new_field = getattr(self.obj, field + '_refs', None) if compare_refs(old_field, new_field): continue self.update_refs(field, self.obj) changed.append(field) for field in self.prop_fields or []: old_field = getattr(old_obj, field, None) new_field = getattr(self.obj, field, None) if old_field == new_field: continue if hasattr(self, field): setattr(self, field, new_field) changed.append(field) return changed
def update_vnc_obj(self, obj=None): if obj: old_obj = None self.obj = obj else: old_obj = getattr(self, 'obj', None) uuid = getattr(self, 'uuid', None) if uuid: self.obj = self.read_vnc_obj(uuid=uuid) else: self.obj = self.read_vnc_obj(fq_name=self.name) changed = [] for field in self.ref_fields or []: old_field = getattr(old_obj, field+'_refs', None) new_field = getattr(self.obj, field+'_refs', None) if compare_refs(old_field, new_field): continue self.update_refs(field, self.obj) changed.append(field) for field in self.prop_fields or []: old_field = getattr(old_obj, field, None) new_field = getattr(self.obj, field, None) if old_field == new_field: continue if hasattr(self, field): setattr(self, field, new_field) changed.append(field) return changed