This bug was fixed in the package cloud-init -
17.2-35-gf576b2a2-0ubuntu1~17.10.2

---------------
cloud-init (17.2-35-gf576b2a2-0ubuntu1~17.10.2) artful-proposed; urgency=medium

  * cherry-pick 40e7738: GCE: fix reading of user-data that is not
    base64 encoded. (LP: #1752711)

 -- Chad Smith <chad.sm...@canonical.com>  Thu, 01 Mar 2018 16:03:46
-0700

** Changed in: cloud-init (Ubuntu Artful)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1752711

Title:
  cloud-init no longer processes user data on GCE in artful

Status in cloud-init:
  Fix Committed
Status in cloud-init package in Ubuntu:
  Fix Released
Status in cloud-init source package in Xenial:
  Fix Committed
Status in cloud-init source package in Artful:
  Fix Released
Status in cloud-init source package in Bionic:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact]
  Any user-data provided when creating google cloud instances is ignored so no 
instance customization is observed. This is a silent failure and no tracebacks 
in cloud-init represent that failure to the user.

  Providing a simple cloud-config to set a hostname will provide a quick
  validation of cloud-init observing user-data.

  [Test Case]

  # Create cloud-config which should change the hostname, and cli prompt
  $ cat > sethostname.yaml <<EOF
  #cloud-config
  hostname: SRU-worked
  EOF

  # Deploy on GCE
  $ gcloud compute instances create artful-sru-test --zone=us-central1-b 
--image-family ubuntu-1710 --image-project ubuntu-os-cloud-devel 
--metadata-from-file user-data=sethostname.yaml

  $ gcloud compute ssh artful-sru-test

  # Expect default hostname "artful-sru-test" instead of "SRU-worked"
  # Look for failure symptom: populated instance-data but user-data: null
  artful-sru-test:~# sudo grep user-data /run/cloud/instance-data.json
     "instance-data": "{\"user-data\":\"#cloud-config\\nhostname: 
SRU-worked\\n\"}",
    "user-data": null,

  # Upgrade cloud-init

  # add proposed
  rel=$(lsb_release -sc);
  line=$(awk '$1 == "deb" && $2 ~ /ubuntu.com/ {
    printf("%s %s %s-proposed main universe\n", $1, $2, rel); exit(0) };
    ' "rel=$rel" /etc/apt/sources.list);
  echo "$line" | sudo tee /etc/apt/sources.list.d/proposed.list
  sudo apt-get update -q;
  sudo apt-get install cloud-init;
  # Reboot 'clean' allowing new cloud-init to run against a fresh system
  sudo cloud-init clean --reboot --logs

  $ gcloud compute ssh artful-sru-test
  # Expect to see proper hostname
  SRU-worked:~#  sudo cloud-init status --long;

  # Validate user-data: non-null
  SRU-worked:~#  sudo grep user-data /run/cloud-init/instance-data.json
  artful-sru-test:~# sudo grep user-data /run/cloud-init/instance-data.json
     "instance-data": "{\"user-data\":\"#cloud-config\\nhostname: 
SRU-worked\\n\"}",
    "user-data": "I2Nsb3VkLWNvbmZpZwpob3N0bmFtZTogbXliaW9uaWMK",

  [Other Info]
  Upstream commit at
    https://git.launchpad.net/cloud-init/commit/?id=40e7738

  === End SRU Template ===

  === Begin Original Description ===

  If I pass in user data like so:

  $ cat cfg
  #!/bin/sh
  touch /tmp/foobar

  $ gcloud compute instances create aa-$(date +%y%m%d-%H%M) --image-family 
ubuntu-1710 --image-project ubuntu-os-cloud-devel --metadata-from-file 
user-data=cfg
  ...

  Then in the instance:

  $ ls /tmp/foobar
  $ sudo cat /var/lib/cloud-init/instance/user-data.txt
  $ curl 
"http://metadata.google.internal/computeMetadata/v1/instance/attributes/user-data";
 -H "Metadata-Flavor: Google"
  #/bin/sh
  touch /tmp/foobar

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1752711/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to