Rename cli_type parameter

Template type could be passed both using CLI and via API directly.
This patch renames cli_type to template_type to make code less
confusing.

Change-Id: I6f9941c0db520bab1aa08ea3ce99e07a36d0c360
This commit is contained in:
Ivan Kolodyazhny 2019-04-05 17:27:06 +03:00
parent 022af0fc20
commit 372039a594

View File

@ -32,11 +32,11 @@ METADATA = 'metadata'
NAME = 'name'
def add_templates_to_db(db, templates, cli_type, params=None):
def add_templates_to_db(db, templates, template_type, params=None):
db_rows = list()
for template in templates:
final_type = template[METADATA].get(TFields.TYPE, cli_type)
if not final_type or (cli_type and cli_type != final_type):
final_type = template[METADATA].get(TFields.TYPE, template_type)
if not final_type or (template_type and template_type != final_type):
db_rows.append(_get_error_result(template, final_type,
"Unknown template type"))
continue
@ -66,11 +66,11 @@ def add_templates_to_db(db, templates, cli_type, params=None):
return db_rows
def validate_templates(db, templates, cli_type, params):
def validate_templates(db, templates, template_type, params):
results = list()
for template in templates:
final_type = template[METADATA].get(TFields.TYPE, cli_type)
if not final_type or (cli_type and cli_type != final_type):
final_type = template[METADATA].get(TFields.TYPE, template_type)
if not final_type or (template_type and template_type != final_type):
results.append(
get_content_fault_result(66, "Unknown template type"))
else: