Comment 7 for bug 1764264

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1764264] Re: bionic cloud-init 18.2 WARNING Juju's 'runcmd' stanza

We can certainly change our assumption that all entries are a single
script, and instead break it up into each entry in the list is an
independent script.
However, that does make quoting, etc, a bit trickier. Coupled with things
like "python inside bash inside a string inside yaml" it gets...
interesting.

Anyway, if you want us to make the switch, we should. As it should be
backward compatible and maintain forward compatibility.

On Thu, Apr 19, 2018 at 6:09 AM, Scott Moser <email address hidden>
wrote:

> on a mostly unrelated note, you're kind of relying on an implementation
> detail of cloud-init's runcmd behavior.
> runcmd: ['set -xe', "mkdir -p '/var/lib/juju'\ncat >
> '/var/lib/juju/MAASmachine.txt' << 'EOF'\n'hostname: nuc7\n'\nEOF\nchmod
> 0755 '/var/lib/juju/MAASmachine.txt'", 'set -xe', ..]
>
> I'd much rather see that as:
> runcmd:
> - [sh, '-c', 'set -xe\nmkdir -p\ncat >'/var/lib/...']
>
> the difference being that you are assuming the 'set -xe' from the first
> entry in runcmd changes the state of the shell that is interpreting
> 'mkdir -p'.
>
> I'd like to make a change in the future for your command to essentially
> get invoked as:
> sh -c 'set -xe'
> sh -c 'mkdir -p ...'
> sh -c '....'
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1764264
>
> Title:
> bionic cloud-init 18.2 WARNING Juju's 'runcmd' stanza
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/cloud-init/+bug/1764264/+subscriptions
>