Ask Your Question
1

Heat Unable to Deploy and Instance Which Runs a User Script

asked 2014-08-02 16:01:56 -0500

loopback127 gravatar image

I'm trying to deploy and Instance using Heat with a HOT Template on Icehouse. I am able to get the heat to deploy a Fedora 17 instace (which has both cloud-init & heat-cfntools) but it fails when attempting to run the user supplied part of the template.

I'm not too sure how to debug this problem and would greatly appreciate some guidance on the matter.

Here is what I can provide:

The Heat (HOT) template that I'm using to deploy an image:

heat_template_version: 2013-05-23

description: Template to test bash scripting.

parameters:
  net_id:
    type: string
    label: Net ID
    description: Network ID for the server
    default: 03e0e92e-d2b9-4c2b-b0fc-98a5a773818e

  instance_name:
    type: string
    label: Instance Name
    description: Name of the instance.
    default: pmtest7

resources:
  the_config:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config: |
        #!/bin/bash
        echo "This should appear in a file." > /tmp/test-script.text

  the_deployment:
    type: OS::Heat::SoftwareDeployment
    properties:
      config:
        get_resource: the_config
      server:
        get_resource: instance

  instance: 
    type: OS::Nova::Server
    properties:
      name: { get_param: instance_name }
      key_name: CloudKey
      image: "Fedora17"
      flavor: m1.small
      networks:
        - network: "03e0e92e-d2b9-4c2b-b0fc-98a5a773818e"
      user_data_format: SOFTWARE_CONFIG

outputs:
  instance_ip:
    description: IP for Puppet Master
    value:
      str_replace:
        template: host
        params:
          host: { get_attr: [instance, networks, private, 0] }

/var/log/cloud-init-output.log (Fedora 17 instance that was deployed by heat):

[ec2-user@pmtest7 ~]$ cat /var/log/cloud-init-output.log 
2014-08-02 16:37:40,855 - cc_scripts_user.py[WARNING]: failed to run-parts in /var/lib/cloud/instance/scripts
2014-08-02 16:37:41,066 - __init__.py[WARNING]: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/CloudConfig/__init__.py", line 118, in run_cc_modules
    cc.handle(name, run_args, freq=freq)
  File "/usr/lib/python2.7/site-packages/cloudinit/CloudConfig/__init__.py", line 79, in handle
    [name, self.cfg, self.cloud, cloudinit.log, args])
  File "/usr/lib/python2.7/site-packages/cloudinit/__init__.py", line 324, in sem_and_run
    func(*args)
  File "/usr/lib/python2.7/site-packages/cloudinit/CloudConfig/cc_scripts_user.py", line 31, in handle
    util.runparts(runparts_path)
  File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 216, in runparts
    popen = subprocess.Popen([exe_path])
  File "/usr/lib64/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

2014-08-02 16:37:41,068 - __init__.py[ERROR]: config handling of scripts-user, None, [] failed

ec2: 
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 1024 ea:93:23:17:c3:68:b6:8f:a1:fb:23:84:65:79:42:7e   (DSA)
ec2: 2048 da:12:bb:36:b6:86:77:5b:b9:90:15:1c:ee:39:10:85   (RSA1)
ec2: 2048 4e:31:e9:2a:c4:42:de:c0:52:b4:1b:a2:61:48:e2:3c   (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
2014-08-02 16:37:41,410 - cloud-init-cfg[ERROR]: errors running cloud_config [final]: ['scripts-user']
errors running cloud_config [final]: ['scripts-user']
cloud-init boot finished at Sat, 02 Aug 2014 20:37:41 +0000. Up 19.60 seconds

/var/log/cloud-init.log (Fedora 17 instance that was deployed by heat):

[ec2-user@pmtest7 ~]$ cat /var ...
(more)
edit retag flag offensive close merge delete

Comments

One annoying problem with YAML is the the comment syntax is the same as bash's. So the #!/bin/bash is not getting included in your script... I'm not sure if that is relevant or not to your problem.

zaneb gravatar imagezaneb ( 2014-08-04 11:26:07 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-02-02 16:18:10 -0500

Steve Baker gravatar image

Fedora 17 has been EOL since mid 2013. Likely you are hitting issues with very old cloud-init versions.

Take a look at the official hot-guide software-deployment 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-08-02 16:01:56 -0500

Seen: 1,314 times

Last updated: Feb 02 '15