Ask Your Question

Heat Template: Using get_param within get_file

asked 2015-07-08 10:07:31 -0500

Nastooh gravatar image

updated 2015-07-08 11:27:31 -0500

Have a simple template that defines config_file as a parameter and would like to pass it as an argument to get_file:

heat_template_version: 2013-05-23
description: Template that installs a mesos nodes.
    type: string
    label: Config File
    description: Path to config file
    type: OS::Nova::Server
      user_data_format: RAW
          template: { get_file: { get_param: config_file } }

This fails with the following message:

Create Failed
Resource Create Failed: Stackvalidationfailed: Property Error : Instance: User Data No Content Found In The "Files" Section For Get File Path: Config.Sh

Tried the following as well:

           ConfigFile: { get_param: config_file }
          template: |
           { get_file: ConfigFile }

(Note that "|" is needed, otherwise I get the following error message:

 Could not fetch contents for file:///xxx/ConfigFile

The above gets further and instantiates a node; however, script is not executed during cloud-init:

ci-info: |   0   |   | |    |    eth0   |   UG  |
ci-info: |   1   | |   | |    eth0   |   U   |
ci-info: +-------+-------------+------------+---------------+-----------+-------+
2015-07-08 14:56:37,317 -[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: '{ get_file: config...'
Generating public/private rsa key pair.

Any thoughts?
(should mention that all is fine if I directly insert the file name in get_file.)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-15 11:14:48 -0500

zaneb gravatar image

There are two parts to get_file: one is in the engine, where it retrieves the file from the dict of files provided by the client. This part should work fine with the filename dynamically specified by get_param.

The other part is in the client. It parses the template looking for get_file and automatically adds any files found to the files dict, so that everything appears to work as if by magic. However, this part can't resolve get_param (there isn't a complete copy of the template parsing code in the client). So if you want to use this mechanism then you need to explicitly include the extra file yourself.

edit flag offensive delete link more


Such a shame. Isn't this really a bug, though?

Nastooh gravatar imageNastooh ( 2015-07-15 12:24:36 -0500 )edit

Arguably it's a missing feature.

zaneb gravatar imagezaneb ( 2015-07-15 13:13:11 -0500 )edit

Thanks for the clarification Zaneb, i was trying to use "get_param" with "get_file". config_drive: "true" user_data_format: RAW user_data : get_file: { get_param : config_file } I got error" user_data No content found in the "files" section for get_file path:"

TejasG gravatar imageTejasG ( 2016-04-27 09:41:32 -0500 )edit

just wondering is there any way we can control the content of "files" directory? or another way to pass filename/file path as
parameter ?

TejasG gravatar imageTejasG ( 2016-04-27 09:43:27 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-07-08 10:07:31 -0500

Seen: 4,283 times

Last updated: Jul 15 '15