cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #02796
Re: [Merge] ~ajorgens/cloud-init:user-shell into cloud-init:master
I kind of see this as something that should be fixed in another way.
a. The user gave cloud-init bad data.
b. cloud-init probably did a bad job of telling them that.
I don't think, though, that a + b =
c. cloud-init should make a guess as to what they meant to do.
It feels like you're trying to fix the scenario where a user typed something at
a prompt and it worked and they just want to put that in a script. However,
the prompt they most likely typed at was bash, and the fix you've proposed is
to execute that code with posix sh, which is *not* bash. So you've allowed the
ignorant user to remain in a state of bliss a little longer, but I'd really
rather somehow just error and educate them.
The suggested fix here ends up with cloud-init doing:
chmod 755 FILE
subp(["sh", FILE])
rather than just
chmod 755 FILE
subp(FILE)
(Note that I'm familiar with shell=True in subprocess.popen, the above I think just illustrates the difference better).
I believe that that makes the situation better for this user-data, which is valid posix shell:
echo hi mom
But ends up failing on this (bash specific) user-data:
x=( "hi" "mom")
echo "${x[@]}"
I don't know exactly why, but it seems to work correctly on this:
#!/usr/bin/env python
print("hi mom")
--
https://code.launchpad.net/~ajorgens/cloud-init/+git/cloud-init/+merge/325857
Your team cloud-init commiters is requested to review the proposed merge of ~ajorgens/cloud-init:user-shell into cloud-init:master.
References