return rows
@retry
- def get_table_by_uuid_name(self, table, uuid_name, error_item_text=None, allow_serveral=False, WHERE_OR={}, WHERE_AND_OR="OR", attempt=_ATTEMPT):
+ def get_table_by_uuid_name(self, table, uuid_name, error_item_text=None, allow_several=False, WHERE_OR={}, WHERE_AND_OR="OR", attempt=_ATTEMPT):
''' Obtain One row from a table based on name or uuid.
Attribute:
table: string of table name
uuid_name: name or uuid. If not uuid format is found, it is considered a name
- allow_severeral: if False return ERROR if more than one row are founded
+ allow_several: if False return ERROR if more than one row are found
error_item_text: in case of error it identifies the 'item' name for a proper output text
'WHERE_OR': dict of key:values, translated to key=value OR ... (Optional)
'WHERE_AND_OR: str 'AND' or 'OR'(by default) mark the priority to 'WHERE AND (WHERE_OR)' or (WHERE) OR WHERE_OR' (Optional
number = self.cur.rowcount
if number == 0:
raise db_base_Exception("No {} found with {} '{}'".format(error_item_text, what, uuid_name), http_code=httperrors.Not_Found)
- elif number > 1 and not allow_serveral:
+ elif number > 1 and not allow_several:
raise db_base_Exception("More than one {} found with {} '{}'".format(error_item_text, what, uuid_name), http_code=httperrors.Conflict)
- if allow_serveral:
+ if allow_several:
rows = self.cur.fetchall()
else:
rows = self.cur.fetchone()
return item_changed
# def get_instance_scenario(self, instance_scenario_id, tenant_id=None):
-# '''Obtain the scenario instance information, filtering by one or serveral of the tenant, uuid or name
+# '''Obtain the scenario instance information, filtering by one or several of the tenant, uuid or name
# instance_scenario_id is the uuid or the name if it is not a valid uuid format
# Only one scenario isntance must mutch the filtering or an error is returned
# '''
@retry
@with_transaction(cursor='dict')
def get_scenario(self, scenario_id, tenant_id=None, datacenter_vim_id=None, datacenter_id=None):
- '''Obtain the scenario information, filtering by one or serveral of the tenant, uuid or name
+ '''Obtain the scenario information, filtering by one or several of the tenant, uuid or name
scenario_id is the uuid or the name if it is not a valid uuid format
if datacenter_vim_id,d datacenter_id is provided, it supply aditional vim_id fields with the matching vim uuid
Only one scenario must mutch the filtering or an error is returned
@retry(command='delete', extra='No dependences can avoid deleting!!!!')
@with_transaction(cursor='dict')
def delete_instance_scenario(self, instance_id, tenant_id=None):
- '''Deletes a instance_Scenario, filtering by one or serveral of the tenant, uuid or name
+ '''Deletes a instance_Scenario, filtering by one or several of the tenant, uuid or name
instance_id is the uuid or the name if it is not a valid uuid format
Only one instance_scenario must mutch the filtering or an error is returned
'''