Ask Your Question
0

Use repeat along with other static networks

asked 2016-09-20 05:11:40 -0500

prat gravatar image

updated 2016-09-20 11:39:54 -0500

zaneb gravatar image

Hi All,

I have a use case, where I want to attach 2 pre-defined(static) networks in addition couple of dynamic networks. For creating a list of dynamic networks, I am using the repeat function, which is working fine.

But, I am struggling to add static networks along with repeat function, something like below

fpc:
  properties:
    flavor: {get_param: linux_flav}
    image: {get_param: linux_img}
    name:
      str_replace:
        template: "Instance_%proj%-%ident%_fpc%id%"
        params:
          '%proj%': {get_param: project_name}
          '%ident%': {get_param: stack_name}
          '%id%': {get_param: id}
    networks:
          - port: {get_attr: [fpc_fixed_network, external_port]}
          - port: {get_attr: [fpc_fixed_network, internal_port]}
      repeat:
        for_each:
          <%ports%>: { get_param: all_ports }
        template:
          - port: <%ports%>
  type: OS::Nova::Servee

Is it possible ? Is my syntax correct? if not, do we have any work-around to achieve the same results?

Thanks Pratik

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-09-20 13:56:07 -0500

zaneb gravatar image

No, that's not correct syntax. I think you're assuming that the repeat function is a pre-processor that outputs YAML. In fact, it's the other way around - the template is first parsed as YAML and later intrinsic functions like repeat are evaluated. The syntax you're trying isn't even valid YAML.

Unfortunately, I don't think there's a way to do what you want without using the yaql function that was introduced in Newton.

edit flag offensive delete link more

Comments

Hello Zaneb,

Thanks for your reply. Are you aware of any other method, using which I can achieve similar results?

Thanks Prat

prat gravatar imageprat ( 2016-09-20 14:59:06 -0500 )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: 2016-09-20 05:11:40 -0500

Seen: 95 times

Last updated: Sep 20 '16