PermissionError undefined on python 2.7

Bug #1831146 reported by Benjamin Dean on 2019-05-30
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Unassigned

Bug Description

running cloud-init-18.5-1.el7.x86_64 on RHEL 7.7

as non-root user when I run `cloud-init status` I get the following error.

Traceback (most recent call last):
  File "/usr/bin/cloud-init", line 9, in <module>
    load_entry_point('cloud-init==18.5', 'console_scripts', 'cloud-init')()
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 892, in main
    get_uptime=True, func=functor, args=(name, args))
  File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 2520, in log_time
    ret = func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/status.py", line 53, in handle_status_args
    init.read_cfg()
  File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 175, in read_cfg
    self._cfg = self._read_cfg(extra_fns)
  File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 184, in _read_cfg
    return merger.cfg
  File "/usr/lib/python2.7/site-packages/cloudinit/helpers.py", line 278, in cfg
    self._cfg = self._read_cfg()
  File "/usr/lib/python2.7/site-packages/cloudinit/helpers.py", line 268, in _read_cfg
    cfgs.extend(self._get_instance_configs())
  File "/usr/lib/python2.7/site-packages/cloudinit/helpers.py", line 242, in _get_instance_configs
    except PermissionError:
NameError: global name 'PermissionError' is not defined

seems like it needs some workaround for python 2.7 similar to this one in some other project:
https://github.com/rpm-software-management/mock/commit/46596dfd425a5bac58f51029fdd8c620623e4bb4

Benjamin Dean (bdean) wrote :

Here's the commit that added this PermissionError:
https://github.com/cloud-init/cloud-init/commit/fc4b966ba928b30b1c586407e752e0b51b1031e8

in 18.4

Ryan Harper (raharper) wrote :

Thanks for submitting the bug.

Changed in cloud-init:
importance: Undecided → Medium
status: New → Triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers