get_hostname on DataSourceAzure fails

Bug #1754495 reported by Douglas Jordan on 2018-03-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Undecided
Douglas Jordan

Bug Description

$ python3 -c "from cloudinit.sources.DataSourceAzure import get_hostname; get_hostname()"
Traceback (most recent call last):
  File "/home/dojordan/code/cloud-init/cloudinit/util.py", line 1875, in subp
    env=env, shell=shell)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: b'h'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/dojordan/code/cloud-init/cloudinit/sources/DataSourceAzure.py", line 226, in get_hostname
    return util.subp(hostname_command, capture=True)[0].strip()
  File "/home/dojordan/code/cloud-init/cloudinit/util.py", line 1881, in subp
    stderr="-" if decode else b"-")
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: hostname
Exit code: -
Reason: [Errno 2] No such file or directory: b'h'
Stdout: -
Stderr: -

This is on latest master (commit 1e2e810f3f7cb6a163a0229ac37037e8c6744d72). Due to this, any VM provisioning will likely fail on Azure. Not entirely sure how https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/338586 passed the Azure test.

Related branches

Chad Smith (chad.smith) on 2018-03-10
Changed in cloud-init:
assignee: nobody → Douglas Jordan (dojordan)
status: New → Fix Committed
Chad Smith (chad.smith) wrote :

fix released in Bionic cloud-init rev cloud-init-18.1-10-gf891df34

This bug is believed to be fixed in cloud-init in 18.2. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers