Skip to content

Commit

Permalink
[sudo] Use correct string as version in facts
Browse files Browse the repository at this point in the history
(cherry picked from commit 59f57a9)
(cherry picked from commit f7d4e03)
  • Loading branch information
drybjed committed Aug 18, 2021
1 parent 3b96582 commit 63220a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ Fixed

- Fixed wrong variable name in file:`sshd_config.j2` template.

:ref:`debops.sudo` role
'''''''''''''''''''''''

- Fixed an issue in the fact script which resulted in a wrong string being
picked up as the version number when :command:`sudo` was configured to use
LDAP, but the LDAP service was not available.

:ref:`debops.system_users` role
'''''''''''''''''''''''''''''''

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import subprocess
import locale


try:
from subprocess import DEVNULL
except ImportError:
DEVNULL = open(os.devnull, 'wb')


def cmd_exists(cmd):
return any(
os.access(os.path.join(path, cmd), os.X_OK)
Expand All @@ -30,7 +36,7 @@ output = {'configured': True,
if output['installed']:
output['version'] = subprocess.check_output(
['sudo', '--version'], env=os.environ,
stderr=subprocess.STDOUT
stderr=DEVNULL
).decode('utf-8').split('\n')[0].split(' ')[-1]

print(dumps(output, sort_keys=True, indent=4))

0 comments on commit 63220a4

Please sign in to comment.