cloud-config should support some method for passing scripts

Bug #541907 reported by Scott Moser

This bug report was converted into a question: question #104907: cloud-config should support some method for passing scripts.

10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Invalid
Low
Scott Moser

Bug Description

Binary package hint: cloud-init

Gustavo asked if there was a way to put scripts to run into cloud-config. At the current point there is no easy way to get the same functionality entirely within cloud-config of user-data like:
  #!/bin/sh
  echo hello world

There are 2 ways to accomplish this, but possibly less than ideal:
a.) use multi-part mime, one section for cloud-config, one for #!/bin/sh
b.) use runcmd with 'sh -c':
   runcmd:
      - [ sh, -c, echo "=========hello world'=========" ]
      -
        - sh
        - -c
        - |
          #!/bin/sh
          echo hi

Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

Hm...
I think I've found a suitable solution with the same function as the attached patch, but utilizing only 'runcmd'. See the attachment.

tags: added: patch
Revision history for this message
Scott Moser (smoser) wrote :

I'm marking this "won't fix" . The functionality is currently easily available with 'runcmd'. For implementation, see the following cloud-config:

#cloud-config
foobar:
 - &alphabet |
   #!/bin/sh
   echo "======= $(date) ${0##*/} ========"
   echo "hello ${1}"
   echo "abcdefghijk..."

runcmd:
 - [ sh, -c, *alphabet, "say-the-alphabet", "scott" ]

Changed in cloud-init (Ubuntu):
assignee: nobody → Scott Moser (smoser)
importance: Undecided → Low
status: New → Won't Fix
Revision history for this message
Scott Moser (smoser) wrote :

Turning this into a question.

Question: Can I include scripts inside cloud-config syntax?
Answer: Yes, by using runcmd this can easily be accomplished.

Changed in cloud-init (Ubuntu):
status: Won't Fix → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.