cloud-init status traceback on successful Ec2

Bug #1744796 reported by Chad Smith
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fix Released
Chad Smith

Bug Description

On Ec2 successful deployments, the command cloud-init status hits the following traceback:
cloud-init status
Traceback (most recent call last):
  File "/usr/bin/cloud-init", line 11, in <module>
    load_entry_point('cloud-init==17.2', 'console_scripts', 'cloud-init')()
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 853, in main
    get_uptime=True, func=functor, args=(name, args))
  File "/usr/lib/python3/dist-packages/cloudinit/", line 2279, in log_time
    ret = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 55, in handle_status_args
    status, status_detail, time = _get_status_details(init.paths)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 114, in _get_status_details
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 96, in _is_cloudinit_disabled
    return (is_disabled, reason)
UnboundLocalError: local variable 'reason' referenced before assignment

In Ec2's case, modules-init is never run because we detect the datasource in init-local timeframe. As a result the status.json looks like this (note that start and finished are both null on mondules-init stage:
 "v1": {
  "datasource": "DataSourceEc2Local",
  "init": {
   "errors": [],
   "finished": 1515706844.3537874,
   "start": 1515706843.7459064
  "init-local": {
   "errors": [],
   "finished": 1515706841.0270455,
   "start": 1515706840.1508064
  "modules-config": {
   "errors": [],
   "finished": 1515706846.916724,
   "start": 1515706846.218318
  "modules-final": {
   "errors": [],
   "finished": 1515706847.6123502,
   "start": 1515706847.2455244
  "modules-init": {
   "errors": [],
   "finished": null,
   "start": null
  "stage": null

Related branches

Chad Smith (chad.smith)
Changed in cloud-init:
importance: Undecided → Medium
status: New → In Progress
assignee: nobody → Chad Smith (chad.smith)
Chad Smith (chad.smith)
Changed in cloud-init:
status: In Progress → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote : Fixed in Cloud-init 18.1

This bug is believed to be fixed in cloud-init in 18.1. 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.

Duplicates of this bug

Other bug subscribers