get_hostname on DataSourceAzure fails

Bug #1754495 reported by Douglas Jordan
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
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/", line 1875, in subp
    env=env, shell=shell)
  File "/usr/lib/python3.5/", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/", 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/", line 226, in get_hostname
    return util.subp(hostname_command, capture=True)[0].strip()
  File "/home/dojordan/code/cloud-init/cloudinit/", 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 passed the Azure test.

Related branches

Chad Smith (chad.smith)
Changed in cloud-init:
assignee: nobody → Douglas Jordan (dojordan)
status: New → Fix Committed
Revision history for this message
Chad Smith (chad.smith) wrote :

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

Revision history for this message
Chad Smith (chad.smith) wrote : Fixed in Cloud-init 18.2

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.