** Description changed:

  === 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/instance-data.json
- artful-sru-test:~# sudo grep user-data /run/cloud/instance-data.json
+ 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/instance/user-data.txt
+ $ 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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1752711

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

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to