Fix Python3 comparison `TypeError` in `salt.modules.upstart` #46293

Bug #1828525 reported by Alex Dehnert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
salt (Ubuntu)
New
Undecided
Unassigned

Bug Description

When I try to use the Apache formula, I get:

          ID: apache
    Function: service.running
        Name: apache2
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python3/dist-packages/salt/state.py", line 1851, in call
                  **cdata['kwargs'])
                File "/usr/lib/python3/dist-packages/salt/loader.py", line 1795, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python3/dist-packages/salt/states/service.py", line 402, in running
                  if not _available(name, ret):
                File "/usr/lib/python3/dist-packages/salt/states/service.py", line 321, in _available
                  avail = __salt__['service.available'](name)
                File "/usr/lib/python3/dist-packages/salt/modules/upstart.py", line 317, in available
                  return name in get_all()
                File "/usr/lib/python3/dist-packages/salt/modules/upstart.py", line 345, in get_all
                  return sorted(get_enabled() + get_disabled())
                File "/usr/lib/python3/dist-packages/salt/modules/upstart.py", line 279, in get_enabled
                  if _sysv_is_enabled(name):
                File "/usr/lib/python3/dist-packages/salt/modules/upstart.py", line 229, in _sysv_is_enabled
                  return not _sysv_is_disabled(name)
                File "/usr/lib/python3/dist-packages/salt/modules/upstart.py", line 221, in _sysv_is_disabled
                  return not bool(glob.glob('/etc/rc{0}.d/S*{1}'.format(_runlevel(), name)))
                File "/usr/lib/python3/dist-packages/salt/modules/upstart.py", line 155, in _runlevel
                  utmp = _find_utmp()
                File "/usr/lib/python3/dist-packages/salt/modules/upstart.py", line 100, in _find_utmp
                  if result > 0:
              TypeError: '>' not supported between instances of 'dict' and 'int'
     Started: 08:08:36.996021
    Duration: 3.895 ms
     Changes:

Upstream salt seems to have fixed this already (https://github.com/saltstack/salt/pull/46293), but it seems like maybe this warrants being backported into the 18.04 package?

root@salt-4:/# lsb_release -rd
Description: Ubuntu 18.04.2 LTS
Release: 18.04
root@salt-4:/# apt-cache policy salt-common
salt-common:
  Installed: 2017.7.4+dfsg1-1
  Candidate: 2017.7.4+dfsg1-1
  Version table:
 *** 2017.7.4+dfsg1-1 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status
root@salt-4:/# dpkg -S /usr/lib/python3/dist-packages/salt/modules/upstart.py
salt-common: /usr/lib/python3/dist-packages/salt/modules/upstart.py

Tags: bionic
tags: added: bionic
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.