Ask Your Question
0

How to solve error 'Non-empty resource type is required for resource' with heat template

asked 2014-09-02 05:17:01 -0500

spradeepv gravatar image

I am trying to get familiar with the use of cloud-config in heat template. I decided to install wordpress using heat template. Following is the user data which is passed to Nova server instance :

Resources:
  server_init:
    type: OS::Heat::CloudConfig
    properties:
      cloud_config:
        packages:
         - apache2
         - php5
         - php5-mysql
         - mysql-server
        runcmd:
         - wget http://wordpress.org/latest.tar.gz -P /tmp/
         - tar zxf /tmp/latest.tar.gz -C /var/www/
         - cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php 
         - sed -e 's/database_name_here/wordpress/' -e 's/username_here/wpuser/' -e 's/password_here/password/' /var/www/wordpress/wp-config.php
         - grep -q -F 'extension=mysqli.so' /etc/php5/apache2/php.ini || echo 'extension=mysqli.so' >> /etc/php5/apache2/php.ini
         - mysql -uroot -ppassword -e "create database wordpress; create user 'wpuser'@'localhost' identified by 'password'; grant all privileges on wordpress . \* ro 'wpuser'@localhost'; flush privileges"
         - mysql -uroot -ppassword -e "drop database test; drop user 'test'@'localhost'; flush privileges"
         - mysqladmin -u root password 'password'

  server:
    type: OS::Nova::Server
    properties:
      image: {get_param: image}
      flavor: {get_param: flavor}
      key_name: {get_param: key_name}
      user_data_format: RAW
      user_data: 
        get_resource: server_init

I get the following error while creating a stack:

"Non-empty resource type is required for resource server_init"

What is the problem with the template?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-09-21 21:11:39 -0500

Steve Baker gravatar image

You used an upper case R for Resources, but lower case for type and properties

I recommend having your template header be heat_template_version: 2013-05-23 following the HOT format, including a lower-case 'resources' section. Please follow the format described in the spec:

edit flag offensive delete link more

Comments

Thank You, Steve. I will check out the spec and will let you know how it goes.

spradeepv gravatar imagespradeepv ( 2014-09-23 07:44:34 -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: 2014-09-02 05:17:01 -0500

Seen: 159 times

Last updated: Sep 21 '14