Ask Your Question
0

Error in using "get_file" function

asked 2018-11-07 11:36:01 -0600

CloudUser99 gravatar image

I am trying to read a IP address from a File named: ipaddress.

ipaddress content is :
1.1.1.1

I have a template:

=

parameters:
  G_NAME:
    type: string
    description: Name of the Security Group
    default: Sample_01

  REMOTE_IP:
    type: string
    description: Remote IP 
    get_file: ipaddress
    default: 2.2.2.2
resources:
  SECURITY_GROUP:
    type: OS::Neutron::SecurityGroup
    properties:
      name: { get_param: G_NAME }
      rules:
         - { remote_ip_prefix: { get_param: REMOTE_IP }, direction: ingress, protocol: icmp }
=

when I run this template I get the Error:

ERROR: Invalid key 'get_file' for parameter (REMOTE_IP)

Can you help me in resolving this.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-11-07 17:47:00 -0600

Parameters don't have a key named get_file. Generally, you can't use functions in parameters, only in resources. See the documentation.

You can either put your parameters in an environment file, or you can use get_file inside a resource. You could, for example, remove the REMOTE_IP parameter block, then

resources:
  SECURITY_GROUP:
    type: OS::Neutron::SecurityGroup
    properties:
      name: { get_param: G_NAME }
      rules:
         - { remote_ip_prefix: { get_file: ipaddress }, direction: ingress, protocol: icmp }

There may still be syntax or semantic errors; I have not tested this.

edit flag offensive delete link more

Comments

Thank you Bernd . How can I loop the file which has 1000 entries? is there a way I can write a loop inside? in the syntax you provided it takes only one first entry?.

CloudUser99 gravatar imageCloudUser99 ( 2018-11-07 22:28:43 -0600 )edit

get_file just copies the entire file at this position in the template. I don't know if Heat allows you to loop over a file line by line. Perhaps you should look into YAQL (no, don't ask me about it).

Bernd Bausch gravatar imageBernd Bausch ( 2018-11-08 04:14:49 -0600 )edit

hello bernd how can i use heat for high available vm? thanks

novainfinite gravatar imagenovainfinite ( 2018-11-08 13:59:54 -0600 )edit
1

This is not my area of expertise. Perhaps autohealing is an option?

Bernd Bausch gravatar imageBernd Bausch ( 2018-11-08 14:41:16 -0600 )edit

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-07 11:36:01 -0600

Seen: 22 times

Last updated: Nov 07