saltstack / saltstack/salt

Icinga2 utility on CentOS fails to get version

Open
#57,713 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-testcase severity-high
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

As mentioned already in #51862, get_certs_path() in salt/utils/icinga2.py fails to extract Icinga2 Version on a CentOS server and throws an error:

AttributeError: 'NoneType' object has no attribute 'group'

This happens because
version = re.search(r"r\d+\.\d+", icinga2_output["stdout"]).group(0)
doesn't find anything, since the version label in the output of icinga2 --version doesn't include the letter 'r' as on Ubuntu, probably in all of Debian family.
I suspect that it should work without the 'r' inside the regex in all of the RedHat family.

Setup

CentOS Linux 8.2.2004 Core
Icinga2 2.11.3

Steps to Reproduce Issue

salt-call icinga2.generate_cert HOSTNAME

Versions Report
Salt Version:
           Salt: 3000.3

Dependency Versions:
           cffi: 1.11.5
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
       M2Crypto: 0.35.2
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: Not Installed
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.8 (default, Apr 16 2020, 01:36:27)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 19.0.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: centos 8.2.2004 Core
         locale: UTF-8
        machine: x86_64
        release: 4.18.0-193.6.3.el8_2.x86_64
         system: Linux
        version: CentOS Linux 8.2.2004 Core

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in salt/utils/icinga2.py at get_certs_path() and inspect how the output of icinga2 --version is parsed. Reproduce with salt-call icinga2.generate_cert HOSTNAME on the reported CentOS/Icinga2 setup, then verify that version extraction no longer raises the reported AttributeError and supports the shown version format.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.