def update_ipv6(ipv6, user): """Updates a Ipv6.""" try: ipv6_obj = get_ipv6_by_id(ipv6.get('id')) ipv6_obj.update_v4(ipv6) except ObjectDoesNotExistException, e: raise ObjectDoesNotExistException(e.detail)
def delete_ipv6(ipv6_id): """Delete Ipv6.""" try: ipv6_obj = get_ipv6_by_id(ipv6_id) ipv6_obj.delete_v4() except ObjectDoesNotExistException, e: raise ObjectDoesNotExistException(e.message)
def delete_ipv6(self, ip_id, user_id): msg = {'object_type': 'ipv6', 'action': 'deallocate', 'object_id': ip_id} self.update_state(state='PROGRESS', meta=msg) ip_obj = facade_v3.get_ipv6_by_id(ip_id) try: facade_v4.delete_ipv6(ip_id) except Exception, exception: msg['message'] = 'IPv6 {} was not deallocated.'.format(ip_obj) msg['reason'] = str(exception) raise Exception(msg)
def update_ipv6(self, ip_dict, user_id): msg = { 'object_type': 'ipv6', 'action': 'update', 'object_id': ip_dict.get('id') } self.update_state(state='PROGRESS', meta=msg) ip_obj = facade_v3.get_ipv6_by_id(ip_dict.get('id')) user = Usuario.objects.get(id=user_id) try: facade_v4.update_ipv6(ip_dict, user) except Exception, exception: msg['message'] = 'IPv6 {} was not updated.'.format(ip_obj) msg['reason'] = str(exception) raise Exception(msg)
def delete_ipv6(self, ip_id, user_id): msg = { 'object_type': 'ipv6', 'action': 'deallocate', 'object_id': ip_id } self.update_state( state='PROGRESS', meta=msg ) ip_obj = facade.get_ipv6_by_id(ip_id) try: facade.delete_ipv6(ip_id) except Exception, exception: msg['message'] = 'IPv6 {} was not deallocated.'.format(ip_obj) msg['reason'] = str(exception) raise Exception(msg)
def update_ipv6(self, ip_dict, user_id): msg = { 'object_type': 'ipv6', 'action': 'update', 'object_id': ip_dict.get('id') } self.update_state( state='PROGRESS', meta=msg ) ip_obj = facade.get_ipv6_by_id(ip_dict.get('id')) user = Usuario.objects.get(id=user_id) try: facade.update_ipv6(ip_dict, user) except Exception, exception: msg['message'] = 'IPv6 {} was not updated.'.format(ip_obj) msg['reason'] = str(exception) raise Exception(msg)