404 not json serialised While creating a stack using python heat-client

asked 2018-11-02 05:36:05 -0600

vikee gravatar image

updated 2018-11-02 07:30:09 -0600

Hi, I'm trying to create a stack using python heatclient. But I blocked while passing the environment file (successful in passing string params,but stucked in number params). I have a environment file like:


  cores: 1
  fixed_ips: 10

....and so on,defined its type as 'number' in heat template. While creating the stack,I passed these content using 'environment' tag as shown below.

hc.stacks.create(stack_name=stack_name, template=template, files=files,environment=yaml_content)

Atlast, it throws error as 'not json serialised' (Create Failed: TypeError: resources.quota: <heat.engine.hot.functions.getparam {get_param:="" u'metadata_items'}="" -=""> 64> is not JSON serializable). How could I overcome this issue.


edit retag flag offensive close merge delete


What makes you think there is an error in the environment file? Could the problem be in the template?

Also, are you sure that yaml_content = parameters.yaml?

Bernd Bausch gravatar imageBernd Bausch ( 2018-11-02 07:32:55 -0600 )edit

I’m sure that all the contents are loaded into the variable.I used the following method,yaml_content=yaml.load(open('environment.yaml')). I also tried using json format, data=yaml.load(open('environment.yaml')) yaml_content = json.dumps(data,sort_keys=True, indent=2) But it throws the same error.

vikee gravatar imagevikee ( 2018-11-04 22:27:09 -0600 )edit

The heat template is working fine when I try to give constant values(for string and number types in the heat template itself). But when I try to give the same values from the environment file using { get_param: cores } function ,it throws the error as specified.

vikee gravatar imagevikee ( 2018-11-04 22:27:25 -0600 )edit

Do you run into the same error when launching this stack from the command line instead of a program? Also: Can you share the template part that uses the cores parameter?

Bernd Bausch gravatar imageBernd Bausch ( 2018-11-04 23:37:24 -0600 )edit

Yes.I'm facing the same error in CLI. The template part W.R.T core is, HEAT TEMPLATE parameters: cores: type: number ... resources: ... quota: type: OS::Nova::Quota properties: cores: { get_param: cores } Environment.yaml parameters: cores: 1

vikee gravatar imagevikee ( 2018-11-05 04:07:49 -0600 )edit