Ask Your Question
0

Type in ResourceGroup and get_param

asked 2018-11-28 04:41:05 -0500

kristoferson gravatar image

I've heat :

heat_template_version: 2017-09-01
resources:
  cluster_nodes:
    type: OS::Heat::ResourceGroup
    properties:
      count: 5
      resource_def:      
        type: file.yaml

when i change type : get_param

 parameters:
  files_yaml:
    description: Name file
    type: string
    default: file.yaml
 resources:
    cluster_nodes:
      type: OS::Heat::ResourceGroup
      properties:
        count: 5
        resource_def:      
           type: {get_param: test_yaml}

error: Could not fetch remote template "file.yaml": Invalid URL scheme How pass type by parameters?

edit retag flag offensive close merge delete

Comments

I think you need to prepend the scheme file:// and use the absolute pathname. When you put a string there, Heat automatically adds scheme and current directory during a template preprocessing phase, but when using get_param, you have to add these elements explicitly.

Bernd Bausch gravatar imageBernd Bausch ( 2018-11-28 06:17:32 -0500 )edit

Add file:// to the default

 parameters:
  files_yaml:
    description: Name file
    type: string
    default: file:///home/user/openstack/file.yaml

and still the same error

kristoferson gravatar imagekristoferson ( 2018-11-28 07:01:38 -0500 )edit

Unfortunately my wisdom ends here. Perhaps you need to quote the value?

Bernd Bausch gravatar imageBernd Bausch ( 2018-11-28 07:44:03 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2018-11-28 10:50:03 -0500

zaneb gravatar image

The problem here is actually on the client side. You can get the file name from a parameter, but the client isn't smart enough to automatically upload it for you like it usually does.

Heat won't allow you to reference local files on the Heat server, and the Heat server can't access local files on the client, for hopefully obvious reasons. It would work if you used an http/https URL that is accessible to the server (e.g. you could upload the template file to Swift).

A better way is probably to map the file in the environment using a custom type name, instead of in the parameters. e.g. your template would be something like:

 resources:
    cluster_nodes:
      type: OS::Heat::ResourceGroup
      properties:
        count: 5
        resource_def:      
           type: My::Custom::Type

and you'd pass an environment file like:

resource_registry:
  My::Custom::Type: file.yaml

Then the client will know that it needs to upload the file for you, and you can switch to a different file by passing a different environment.

Finally, If you're using the Rocky release (or later) you can upload all of the files to a Swift container, and instantiate the main template from there. Heat will download all of the files in the container, so you can select which one you want with a parameter and it will always be available.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2018-11-28 04:41:05 -0500

Seen: 59 times

Last updated: Nov 28 '18