Preseed cloud-init and allow further preseeding when building the image #47

Merged
merged 3 commits into from Sep 2, 2016

Conversation

Projects
None yet
4 participants
Contributor

cyphermox commented Sep 1, 2016

This passes the minimal instance-id value for cloud-init; and allows passing further preseed
config using '--cloud-init ' which should contain preseeding data for cloud-init and should
follow the documentation at:

https://git.launchpad.net/cloud-init/tree/doc/examples/cloud-config-user-groups.txt

Signed-off-by: Mathieu Trudel-Lapierre mathieu.trudel-lapierre@canonical.com

Pre-seed cloud-init with minimal config and allow passing more when b…
…uilding the image.

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
Collaborator

mvo5 commented Sep 1, 2016

👍

ogra1 commented Sep 1, 2016

👍

Initialize tests for cloud-init option; don't break if cloud preseed …
…directories exist when attempting to create them.
ubuntu_image/builder.py
+ self.cloud_init = (
+ None
+ if args.cloud_init is None
+ else args.cloud_init)
@warsaw

warsaw Sep 2, 2016

Contributor

I'm pretty sure this can just be self.cloud_init = args.cloud_init. The default will be None if the cli switch isn't given.

ubuntu_image/builder.py
+ cloud_dir = os.path.join(seed_dir, 'nocloud-net')
+ os.makedirs(cloud_dir, exist_ok=True)
+ metadata_file = os.path.join(cloud_dir, 'meta-data')
+ with open(metadata_file, 'w', encoding='utf-8') as f:
@warsaw

warsaw Sep 2, 2016

Contributor

fp is the usual convention.

ubuntu_image/builder.py
+ os.makedirs(cloud_dir, exist_ok=True)
+ metadata_file = os.path.join(cloud_dir, 'meta-data')
+ with open(metadata_file, 'w', encoding='utf-8') as f:
+ print("instance-id: nocloud-static", file=f)
@warsaw

warsaw Sep 2, 2016

Contributor

Single quotes please!

Contributor

warsaw commented Sep 2, 2016

Just a few minor style nits. If you could fix those and push an update, I can hit the big green merge button. If you're happy with the effects during manual testing, we'll deal with test failures later, after GA.

Contributor

warsaw commented Sep 2, 2016

Thanks!

@warsaw warsaw merged commit 53b0f35 into CanonicalLtd:master Sep 2, 2016

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment