← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1752711] Re: cloud-init no longer processes user data on GCE in artful

 

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

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

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

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

  * New upstream snapshot. (LP: #1747059)
    - tests: add support for logs with lxd from snap and future lxd 3.
    - EC2: Fix get_instance_id called against cached datasource pickle.
    - cli: fix cloud-init status to report running when before result.json
    - net: accept network-config in netplan format for renaming interfaces
    - Fix ssh keys validation in ssh_util [Tatiana Kholkina]

 -- Chad Smith <chad.smith@xxxxxxxxxxxxx>  Thu, 01 Mar 2018 16:05:39
-0700

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

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
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 Released
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