Parameter handling for new TOSCA template broken
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tacker |
Fix Released
|
High
|
Bob Haddleton |
Bug Description
When parameter values are passed to substitute parameters in the new TOSCA template format, vnf-create command errors out with "string indices must be integers" mesg
Error:
$ tacker vnf-create --name param1 --vnfd-name tosca-vnfd-params --param-file ./tosca-
tosca-parser failed: - string indices must be integers
Sample template with get_input,
topology_template:
inputs:
flavor_name:
type: string
description: The name of the machine flavor.
default: m1.tiny
image_name:
type: string
description: The name of the machine image.
default: cirros-
node_templates:
VDU1:
type: tosca.nodes.
properties:
image: {get_input: image_name}
flavor: {get_input: flavor_name}
config: |
param0: key1
param1: key2
File with values for parameter,
$ cat ./tosca-
flavor_name: 'm1.medium',
image_name: 'cirros-
Changed in tacker: | |
assignee: | Bob Haddleton (bob-haddleton) → Sridhar Ramaswamy (srics-r) |
Changed in tacker: | |
assignee: | Sridhar Ramaswamy (srics-r) → Bob Haddleton (bob-haddleton) |
Root cause is, tacker using a "string" param_values [1] and passes that to ToscaParser parsed_params [2] which expects it to be in json,
params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user',
'db_ root_pwd' : 'mypasswd'} parsed_ params= params,
yaml_ dict_tpl= yaml_dict_ tpl)
tosca = ToscaTemplate(
Options to fix are,
a) convert the string param_values to json object before passing to ToscaTemplate
b) change the API / db to use json object to pass parameters
(b) is the preferred approach.
[1] https:/ /github. com/openstack/ tacker/ blob/master/ tacker/ vm/infra_ drivers/ heat/heat. py#L288 /github. com/openstack/ tacker/ blob/master/ tacker/ vm/infra_ drivers/ heat/heat. py#L293
[2] https:/