Ask Your Question
0

error:u'u\' "str_replace syntax should be str_replace

asked 2014-11-02 20:54:51 -0600

ispot gravatar image

When I use this commad to create stack with my our template file :

  heat stack-create teststack -u file:///home/stack/hello_world.template -P key_name=userkey -P image=02e333d8-360c-45ad-a240-71fb3d4f913b -P flavor=m1.tiny

I got this error:

 nKeyError: u\'"str_replace" syntax should be str_replace:\\n              template: This is var1 template var2\\n              params:\\n                var1: a\\n                var2: string\'\n'

Keyerror I used vim to edit the template ,indent is the space.

Here is my helloworld.template

  #
  # This is a hello world HOT template just defining a single compute
  # server.
  #
  heat_template_version: 2013-05-23

  description: >
  Hello world HOT template that just defines a single server.
  Contains just base features to verify base HOT support.

  parameters:
    key_name:
      type: string
      description: Name of an existing key pair to use for the server
      constraints:
          - custom_constraint: nova.keypair
    flavor:
      type: string
      description: Flavor for the server to be created
      default: m1.small
      constraints:
          - custom_constraint: nova.flavor
    image:
      type: string
      description: Image ID or image name to use for the server
      constraints:
          - custom_constraint: glance.image
  resources:
    server:
      type: OS::Nova::Server
      properties:
        key_name: { get_param: key_name }
        image: { get_param: image }
        flavor: { get_param: flavor }
        user_data:
          str_replace:
             template: |
                #!/bin/bash
                bash <(wget -O - http://ftp.xx.com/software/update.sh
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-11-17 16:20:19 -0600

asalkeld gravatar image

Have a look at the docs for str_replace: http://docs.openstack.org/developer/h...

simple example

str_replace:
    template: http://host/MyApplication
    params:
      host: 192.168.1.1

you were missing the "params" section.

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: 2014-11-02 20:54:51 -0600

Seen: 3,086 times

Last updated: Nov 17 '14