Skip to content

[BUG] states.pip.installed: AttributeError: 'NoneType' object has no attribute 'exception' #64169

Closed
@vps-eric

Description

Description
The pip.installed state incorrectly attempts to log any exception caught from calling modules.pip.list. It appears that pip.installed's log parameter shadows the name of the global logger and calls the parameter instead, which is None by default or str (file path) if provided by the caller.

Setup & Reproduction
Install the Salt minion v3006.0. My environment is Almalinux 8.7 in Vagrant on QEMU. Install Python 3.10.11 from source. Create a pip.installed state. Then, break pip.list somehow; this issue or this one are affecting me at the moment.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Expected behavior
The caught exception to be properly logged with the global logger.

Versions Report

salt --versions-report
Salt Version:
          Salt: 3006.0
 
Python Version:
        Python: 3.10.11 (main, Apr 14 2023, 05:57:16) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
        relenv: 0.11.2
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: almalinux 8.7 Stone Smilodon
        locale: utf-8
       machine: x86_64
       release: 4.18.0-425.13.1.el8_7.x86_64
        system: Linux
       version: AlmaLinux 8.7 Stone Smilodon

Metadata

Assignees

No one assigned

    Labels

    Bugbroken, incorrect, or confusing behaviorState-Module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions