canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.97k stars 880 forks source link

CloudStack: cloud-init at sles and ubuntu depends on wget but does not seem to validate this causing late runtime error #3798

Open ubuntu-server-builder opened 1 year ago

ubuntu-server-builder commented 1 year ago

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

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2020-10-22T15:51:09.953541+00:00
date_fix_committed = None
date_fix_released = None
id = 1901054
importance = low
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1901054
milestone = None
owner = jdoe666
owner_name = Peter M.
private = False
status = triaged
submitter = jdoe666
submitter_name = Peter M.
tags = []
duplicates = []

Launchpad user Peter M.(jdoe666) wrote on 2020-10-22T15:51:09.953541+00:00

This might be a subtle error which is neither a direct package dependency nor explicitedly an error in the cloud-init software, but this in fact leads to problems. Also, it does not seem to be a distro-specific problem.

Scenario:

  1. User of cloud-init is not aware it will use wget to download meta-data
  2. There is no direct dependency in the cloud-init package to wget (checked for Ubuntu and SLES 15)
  3. Cloud-init will not work properly as wget is missing

Error output from /etc/cloud-init.log (observed with lastest patch level for version 19.4 on SLES 15)

2020-10-22 14:08:05,095 - util.py[DEBUG]: Running command ['wget', '--quiet', '--tries', '3', '--timeout', '20', '--output-document', '-', '--header', 'DomU_Request: send_my_password', '192.168.1.1:8080'] with allowed return codes [0] (shell=False, capture=True) FileNotFoundError: [Errno 2] No such file or directory: b'wget': b'wget' Command: ['wget', '--quiet', '--tries', '3', '--timeout', '20', '--output-document', '-', '--header', 'DomU_Request: send_my_password', '192.168.1.1:8080'] Reason: [Errno 2] No such file or directory: b'wget': b'wget'

Suggestion: possibly, cloud-init should exit immediately if wget not detected in the system, and/or have it as a dependency in distro packages?

ubuntu-server-builder commented 1 year ago

Launchpad user Scott Moser(smoser) wrote on 2020-10-22T17:21:47.127111+00:00

It is only cloud-init on CloudStack that depends on wget.

https://github.com/canonical/cloud-init/blob/93cebe009d116230850c770227e9ead5c490c0d0/cloudinit/sources/DataSourceCloudStack.py#L46

And that is surrounded with a message:

    # The password server was in the past, a broken HTTP server, but is now
    # fixed.  wget handles this seamlessly, so it's easier to shell out to
    # that rather than write our own handling code.

so... it seems like the smartest thing to do is replace it with python code.

ubuntu-server-builder commented 1 year ago

Launchpad user Paride Legovini(paride) wrote on 2020-10-27T14:15:00.287372+00:00

Thanks Peter for reporting this bug and Scott for the pointer to the only code snippet that actually depends on wget. I think the problem is fully understood, so I'm marking this report as Triaged with with Low importance.