Revision history [back]

click to hide/show revision 1
initial version

Heat Unable to Deploy and Instance Which Runs a User Script

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/log/cloud-init.log 
Aug  2 16:37:31 none [CLOUDINIT] cloud-init[INFO]: cloud-init start-local running: Sat, 02 Aug 2014 20:37:31 +0000. up 9.91 seconds
Aug  2 16:37:31 none [CLOUDINIT] __init__.py[DEBUG]: searching for data source in ['DataSourceNoCloud', 'DataSourceConfigDrive', 'DataSourceOVF']
Aug  2 16:37:32 none [CLOUDINIT] __init__.py[DEBUG]: Did not find data source. searched classes: ['DataSourceNoCloud', 'DataSourceConfigDrive', 'DataSourceOVF']
Aug  2 16:37:32 none [CLOUDINIT] cloud-init[INFO]: cloud-init start running: Sat, 02 Aug 2014 20:37:32 +0000. up 10.76 seconds
Aug  2 16:37:32 none [CLOUDINIT] __init__.py[DEBUG]: searching for data source in ['DataSourceNoCloudNet', 'DataSourceConfigDriveNet', 'DataSourceOVFNet', 'DataSourceEc2']
Aug  2 16:37:32 none [CLOUDINIT] DataSourceEc2.py[DEBUG]: removed the following from metadata urls: ['http://instance-data.:8773']
Aug  2 16:37:33 none [CLOUDINIT] DataSourceEc2.py[DEBUG]: Using metadata source: 'http://169.254.169.254'
Aug  2 16:37:34 none [CLOUDINIT] DataSourceEc2.py[DEBUG]: crawl of metadata service took 0s
Aug  2 16:37:34 none [CLOUDINIT] __init__.py[DEBUG]: found data source DataSourceEc2
Aug  2 16:37:34 none [CLOUDINIT] cloud-init[DEBUG]: found data source: DataSourceEc2
Aug  2 16:37:38 none [CLOUDINIT] __init__.py[DEBUG]: handling bootcmd with freq=None and args=[]
Aug  2 16:37:38 none [CLOUDINIT] __init__.py[DEBUG]: handling resizefs with freq=None and args=[]
Aug  2 16:37:38 none [CLOUDINIT] cc_resizefs.py[DEBUG]: resizing root filesystem (type=ext4, maj=253, min=0)
Aug  2 16:37:38 none [CLOUDINIT] __init__.py[DEBUG]: handling set_hostname with freq=None and args=[]
Aug  2 16:37:38 none [CLOUDINIT] cc_set_hostname.py[DEBUG]: populated /etc/hostname with pmtest7 on first boot
Aug  2 16:37:38 none [CLOUDINIT] __init__.py[DEBUG]: handling rsyslog with freq=None and args=[]
Aug  2 16:37:39 none [CLOUDINIT] __init__.py[DEBUG]: handling ssh with freq=None and args=[]
Aug  2 16:37:39 none [CLOUDINIT] cloud-init-cfg[INFO]: cloud-init-cfg ['all', 'config']
Aug  2 16:37:39 none [CLOUDINIT] __init__.py[DEBUG]: handling mounts with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] DataSourceEc2.py[DEBUG]: unable to convert ephemeral0 to a device
Aug  2 16:37:40 none [CLOUDINIT] DataSourceEc2.py[DEBUG]: unable to convert swap to a device
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling ssh-import-id with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling locale with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] cc_locale.py[DEBUG]: setting locale to en_US.UTF-8
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling set-passwords with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] cc_set_passwords.py[DEBUG]: set PasswordAuthentication to 'no'
Aug  2 16:37:40 none [CLOUDINIT] cc_set_passwords.py[DEBUG]: restarted sshd
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling timezone with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling puppet with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling disable-ec2-metadata with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling runcmd with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] cloud-init-cfg[INFO]: cloud-init-cfg ['all', 'final']
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling rightscale_userdata with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling scripts-per-once with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling scripts-per-boot with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling scripts-per-instance with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] __init__.py[DEBUG]: handling scripts-user with freq=None and args=[]
Aug  2 16:37:40 none [CLOUDINIT] cc_scripts_user.py[WARNING]: failed to run-parts in /var/lib/cloud/instance/scripts
Aug  2 16:37:41 none [CLOUDINIT] __init__.py[WARNING]: Traceback (most recent call last):
Aug  2 16:37:41 none [CLOUDINIT] __init__.py[ERROR]: config handling of scripts-user, None, [] failed
Aug  2 16:37:41 none [CLOUDINIT] __init__.py[DEBUG]: handling keys-to-console with freq=None and args=[]
Aug  2 16:37:41 none [CLOUDINIT] __init__.py[DEBUG]: handling phone-home with freq=None and args=[]
Aug  2 16:37:41 none [CLOUDINIT] __init__.py[DEBUG]: handling final-message with freq=None and args=[]
Aug  2 16:37:41 none [CLOUDINIT] cloud-init-cfg[ERROR]: errors running cloud_config [final]: ['scripts-user']

How do I solve this problem? What else can I provide to help diagnose the issue?

Thank you very much for any help