def _wrap_vsdclient(self): """Wraps nuagecient methods with try-except to ignore certain errors. When updating an entity on the VSD and there is nothing to actually update because the values don't change, VSD will throw an error. This is not needed for neutron so all these exceptions are ignored. When VSD responds with a 404, this is sometimes good (for example when trying to update an entity). Yet sometimes this is not required to be an actual exception. When deleting an entity that does no longer exist it is fine for neutron. Also when trying to retrieve something from VSD having None returned is easier to work with than RESTProxy exceptions. """ methods = inspect.getmembers(self.vsdclient, lambda x: inspect.ismethod(x)) for m in methods: wrapped = ignore_no_update(m[1]) if m[0].startswith('get_') or m[0].startswith('delete_'): wrapped = ignore_not_found(wrapped) setattr(self.vsdclient, m[0], wrapped)
def _wrap_nuageclient(self): """Wraps nuagecient methods with try-except to ignore certain errors. When updating an entity on the VSD and there is nothing to actually update because the values don't change, VSD will throw an error. This is not needed for neutron so all these exceptions are ignored. When VSD responds with a 404, this is sometimes good (for example when trying to update an entity). Yet sometimes this is not required to be an actual exception. When deleting an entity that does no longer exist it is fine for neutron. Also when trying to retrieve something from VSD having None returned is easier to work with than RESTProxy exceptions. """ methods = inspect.getmembers(self.nuageclient, lambda x: inspect.ismethod(x)) for m in methods: wrapped = ignore_no_update(m[1]) if m[0].startswith('get_') or m[0].startswith('delete_'): wrapped = ignore_not_found(wrapped) setattr(self.nuageclient, m[0], wrapped)