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

scaleway_user_data: multiline is broken, cloud-init doesn't work #65036

Closed
jackivanov opened this issue Nov 19, 2019 · 3 comments · Fixed by #66957
Closed

scaleway_user_data: multiline is broken, cloud-init doesn't work #65036

jackivanov opened this issue Nov 19, 2019 · 3 comments · Fixed by #66957
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud has_pr This issue has an associated PR. module This issue/PR relates to a module. scaleway support:community This issue/PR relates to code supported by the Ansible community.

Comments

@jackivanov
Copy link

jackivanov commented Nov 19, 2019

SUMMARY

There should be multiline in the cloud-init field, but instead either the module or API itself breaks it and sends the whole text as a string in double quotes.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

scaleway_user_data

ANSIBLE VERSION
ansible 2.8.3
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
  - scaleway_user_data:
      server_id: "{{ scaleway_compute.msg.id }}"
      region: "{{ region }}"
      user_data:
        cloud-init: |
          #cloud-config
          # final_message
          # default: cloud-init boot finished at $TIMESTAMP. Up $UPTIME seconds
          # this message is written by cloud-final when the system is finished
          # its first boot
          final_message: "The system is finally up, after $UPTIME seconds"
  1. Update the cloud-init and start the server
  2. Cloud-init throws an error
    2019-11-18 19:27:31,692 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'b'"#cloud-config\\\\nfinal_me'...'
EXPECTED RESULTS
root@test-cloudinit:~# curl --local-port 1-1023 http://169.254.42.42/user_data/cloud-init/ -w "\n"
#cloud-config
# final_message
# default: cloud-init boot finished at $TIMESTAMP. Up $UPTIME seconds
# this message is written by cloud-final when the system is finished
# its first boot
final_message: "The system is finally up, after $UPTIME seconds"
ACTUAL RESULTS
root@test-cloudinit:~# curl --local-port 1-1023 http://169.254.42.42/user_data/cloud-init/ -w "\n"
"#cloud-config\n# final_message\n# default: cloud-init boot finished at $TIMESTAMP. Up $UPTIME seconds\n# this message is written by cloud-final when the system is finished\n# its first boot\nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n"
@ansibot
Copy link
Contributor

ansibot commented Nov 19, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 19, 2019

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. scaleway support:community This issue/PR relates to code supported by the Ansible community. labels Nov 19, 2019
@jackivanov
Copy link
Author

a workaround for now is to use the uri module:

- uri:
    url: "https://cp-{{ region }}.scaleway.com/servers/{{ server_id }}/user_data/cloud-init"
    method: PATCH
    body: "{{ lookup('template', 'cloud-config.yml') }}"
    status_code: 204
    headers:
      Content-Type: "text/plain"
      X-Auth-Token: "{{ token }}"

@ansibot ansibot added the has_pr This issue has an associated PR. label Nov 20, 2019
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Feb 24, 2020
@ansible ansible locked and limited conversation to collaborators Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud has_pr This issue has an associated PR. module This issue/PR relates to a module. scaleway support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants