X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=openmanoclient.py;h=c11f747e753890a42cbe9932ab39568e0f0e2d8b;hb=06e6c396413630640cafae3488442a0869f1642d;hp=0d9aa4ae3438309cfe9c96896c39dcaf35dea4f7;hpb=c78233e1750d5d231e99ffedb5ba81014f84e6fe;p=osm%2FRO.git diff --git a/openmanoclient.py b/openmanoclient.py index 0d9aa4ae..c11f747e 100644 --- a/openmanoclient.py +++ b/openmanoclient.py @@ -74,7 +74,7 @@ class openmanoclient(): self.datacenter_id = kwargs.get("datacenter_id") self.datacenter_name = kwargs.get("datacenter_name") self.datacenter = None - self.logger = logging.getLogger('manoclient') + self.logger = logging.getLogger(kwargs.get('logger','manoclient')) if kwargs.get("debug"): self.logger.setLevel(logging.DEBUG) @@ -424,7 +424,10 @@ class openmanoclient(): Return: Raises an exception on error, not found, found several, not free Obtain a dictionary with format {'result': text indicating deleted} ''' - return self._del_item("datacenters", uuid, name, all_tenants=True) + if not uuid: + # check that exist + uuid = self._get_item_uuid("datacenters", uuid, name, all_tenants=True) + return self._del_item("datacenters", uuid, name, all_tenants=None) def create_datacenter(self, descriptor=None, descriptor_format=None, name=None, vim_url=None, **kwargs): #, type="openvim", public=False, description=None): @@ -832,9 +835,14 @@ class openmanoclient(): Return: Raises an exception on error Obtain a dictionary with format {'tenant':{new_tenant_info}} ''' - if item not in ("tenants", "networks"): - raise OpenmanoBadParamsException("Unknown value for item '{}', must be 'tenants' or 'nets'".format(str(item))) - + if item not in ("tenants", "networks", "images"): + raise OpenmanoBadParamsException("Unknown value for item '{}', must be 'tenants', 'nets' or " + "images".format(str(item))) + + image_actions = ['list','get','show','delete'] + if item == "images" and action not in image_actions: + raise OpenmanoBadParamsException("Only available actions for item '{}' are {}\n" + "Requested action was '{}'".format(item, ', '.join(image_actions), action)) if all_tenants: tenant_text = "/any" else: