Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid write_files format doesn't make the cloud-init fail #3627

Open
ubuntu-server-builder opened this issue May 12, 2023 · 2 comments
Open
Labels
bug Something isn't working correctly launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1867933

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2020-03-18T14:25:16.396575+00:00
date_fix_committed = None
date_fix_released = None
id = 1867933
importance = medium
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1867933
milestone = None
owner = boillodmanuel
owner_name = manuel
private = False
status = confirmed
submitter = boillodmanuel
submitter_name = manuel
tags = []
duplicates = []

Launchpad user manuel(boillodmanuel) wrote on 2020-03-18T14:25:16.396575+00:00

If the cloud config file format is not correct (see example below), the write_files module fails, but the cloud-init status is done

Cloud-config file:

#cloud-config

write_files:
  - content: |
      line below is badly indented
ouch!

    path: /tmp/cloud-init-file.txt

Extract of cloud-init-output.log

2020-03-18 13:54:05,321 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 6 column 1: "while scanning a simple key
  in "<unicode string>", line 6, column 1:
    ouch!
    ^
could not found expected ':'
  in "<unicode string>", line 8, column 9:
        path: /tmp/cloud-init-file.txt
            ^"
2020-03-18 13:54:05,337 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 6 column 1: "while scanning a simple key
  in "<unicode string>", line 6, column 1:
    ouch!
    ^
could not found expected ':'
  in "<unicode string>", line 8, column 9:
        path: /tmp/cloud-init-file.txt
            ^"
2020-03-18 13:54:05,337 - util.py[WARNING]: Failed at merging in cloud config part from part-001

cloud-init status:

status: done
@ubuntu-server-builder ubuntu-server-builder added bug Something isn't working correctly launchpad Migrated from Launchpad labels May 12, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2020-03-18T15:35:51.262288+00:00

reproduces with:

$ cat ud.yaml
#cloud-config
runcmd:

  • "echo hi world | tee /run/runcmd.log"
  • "echo this is indented one space more, making bad yaml"

$ ud=$(cat ud.yaml)
$ lxc launch ubuntu-daily:bionic btest --config=user.user-data="$ud"

$ lxc exec btest -- cloud-init status --wait ; echo $?
status: done
0

$ lxc exec btest /bin/bash
root@btest:# grep WARN /var/log/cloud-init.log
2020-03-18 15:31:29,490 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 2 column 1: "while parsing a block mapping
2020-03-18 15:31:29,499 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 2 column 1: "while parsing a block mapping
2020-03-18 15:31:29,499 - util.py[WARNING]: Failed at merging in cloud config part from part-001
root@btest:
# grep errors /run/cloud-init/result.json
"errors": []
root@btest:~# grep errors /run/cloud-init/status.json
"errors": [],
"errors": [],
"errors": [],
"errors": [],
"errors": [],

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2020-09-10T17:58:16.464716+00:00

Just verified this is still present (focal)

cloud-init --version

/usr/bin/cloud-init 20.2-45-g5f7825e2-0ubuntu1~20.04.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant