http://bugzilla.opensuse.org/show_bug.cgi?id=1017832 Bug ID: 1017832 Summary: cloud-init: query command causes UnboundLocalError Classification: openSUSE Product: openSUSE Distribution Version: Leap 42.1 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Virtualization:Tools Assignee: virt-bugs@suse.de Reporter: eblock@nde.ag QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Testing cloud-init version 0.7.8 on a Leap 42.1 VM in Openstack Mitaka, I encountered this error when trying to query the cloud-init data: ---cut here--- vm1:~ # cloud-init query --name data Traceback (most recent call last): File "/usr/bin/cloud-init", line 11, in <module> load_entry_point('cloud-init==0.7.8', 'console_scripts', 'cloud-init')() File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 685, in main rname, rdesc, reporting_enabled=report_on) UnboundLocalError: local variable 'rname' referenced before assignment ---cut here--- The "query" argument is not handled in the code. So I added this to the if-statement ---cut here--- vm1:~ # diff -u /usr/lib/python2.7/site-packages/cloudinit/cmd/main.py.dist /usr/lib/python2.7/site-packages/cloudinit/cmd/main.py --- /usr/lib/python2.7/site-packages/cloudinit/cmd/main.py.dist 2017-01-03 10:23:28.440785868 +0100 +++ /usr/lib/python2.7/site-packages/cloudinit/cmd/main.py 2017-01-03 10:23:50.584785868 +0100 @@ -680,6 +680,9 @@ elif name == 'dhclient_hook': rname, rdesc = ("dhclient-hook", "running dhclient-hook module") + elif name == 'query': + rname, rdesc = ("query", + "running query module") args.reporter = events.ReportEventStack( rname, rdesc, reporting_enabled=report_on) ---cut here--- and re-ran the same command: ---cut here--- vm1:~ # cloud-init query --name data Traceback (most recent call last): File "/usr/bin/cloud-init", line 11, in <module> load_entry_point('cloud-init==0.7.8', 'console_scripts', 'cloud-init')() File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 694, in main get_uptime=True, func=functor, args=(name, args)) File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 2165, in log_time ret = func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 386, in main_query " currently implemented") % (name)) NotImplementedError: Action 'query' is not currently implemented ---cut here--- This result seems fine to me. I used a fresh update of cloud-init: vm1:~ # rpm -qi cloud-init Name : cloud-init Version : 0.7.8 Release : 32.1 Architecture: x86_64 Install Date: Di 03 Jan 2017 10:03:10 CET -- You are receiving this mail because: You are on the CC list for the bug.