You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Bug in logrotate module when shorthand configuration used
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
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
Steps to Reproduce the behavior
While looking into a diskspace / syslog issue yesterday I executed salt 'COMPUTERNAME' logrotate.get /var/log/auth.log rotate /etc/logrotate.d/syslog-ng to see how logrotate was configured for the auth.log file and it failed.
salt 'COMPUTERNAME' logrotate.get /var/log/auth.log rotate /etc/logrotate.d/syslog-ng
It failed with
[ERROR ] An un-handled exception was caught by Salt's global exception handler:
AttributeError: 'bool' object has no attribute 'get'
If I try again, but for syslog or error files it works.
salt 'COMPUTERNAME' logrotate.get /var/log/syslog rotate /etc/logrotate.d/syslog-ng
COMPUTERNAME:
7
salt 'COMPUTERNAME' logrotate.get /var/log/error rotate /etc/logrotate.d/syslog-ng
COMPUTERNAME:
4
But not for messages...
salt 'COMPUTERNAME' logrotate.get /var/log/messages rotate /etc/logrotate.d/syslog-ng
COMPUTERNAME:
The minion function caused an exception: Traceback (most recent call last):
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 1969, in _thread_return
return_data = minion_instance._execute_job_function(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 1925, in _execute_job_function
return_data = self.executors[fname](opts, data, func, args, kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
return _func_or_method(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/executors/direct_call.py", line 10, in execute
return func(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
return _func_or_method(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/logrotate.py", line 161, in get
return stanza.get(value, False)
AttributeError: 'bool' object has no attribute 'get'
ERROR: Minions returned with non-zero exit code
This leads me to think the module doesn't like the shorthand logrotate configuration of stacking multiple files before the opening curly brace.
I believe my suspicions are confirmed by reviewing the output from the logrotate.show_conf function. You can see the output for the files not immediately before the curly brace.
Slightly redacted output, to remove any files not mentioned in /etc/logrotate.d/syslog-ng to make things clearer.
Expected behavior
Expected the module to return the logrotate configuration for any file configured in logrotate's config, not just the files which immediately proceed the opening curly brace.
Versions Report
salt --versions-report
Salt Version:
Salt: 3007.1Python Version:
Python: 3.10.14 (main, Apr 3 2024, 21:30:09) [GCC 11.2.0]Dependency Versions:
cffi: 1.16.0cherrypy: 18.8.0dateutil: 2.8.2docker-py: Not Installedgitdb: Not Installedgitpython: Not InstalledJinja2: 3.1.4libgit2: Not Installedlooseversion: 1.3.0M2Crypto: Not InstalledMako: Not Installedmsgpack: 1.0.7msgpack-pure: Not Installedmysql-python: Not Installedpackaging: 23.1pycparser: 2.21pycrypto: Not Installedpycryptodome: 3.19.1pygit2: Not Installedpython-gnupg: 0.5.2PyYAML: 6.0.1PyZMQ: 25.1.2relenv: 0.16.0smmap: Not Installedtimelib: 0.3.0Tornado: 6.3.3ZMQ: 4.3.4Salt Package Information:
Package Type: onedirSystem Versions:
dist: debian 12.7 bookwormlocale: utf-8machine: x86_64release: 6.1.0-26-amd64system: Linuxversion: Debian GNU/Linux 12.7 bookworm
The text was updated successfully, but these errors were encountered:
Description
Bug in logrotate module when shorthand configuration used
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
While looking into a diskspace / syslog issue yesterday I executed
salt 'COMPUTERNAME' logrotate.get /var/log/auth.log rotate /etc/logrotate.d/syslog-ng
to see how logrotate was configured for the auth.log file and it failed.Here's what
/etc/logrotate.d/syslog-ng
looks likesalt 'COMPUTERNAME' logrotate.get /var/log/auth.log rotate /etc/logrotate.d/syslog-ng
It failed with
If I try again, but for
syslog
orerror
files it works.But not for messages...
This leads me to think the module doesn't like the shorthand logrotate configuration of stacking multiple files before the opening curly brace.
I believe my suspicions are confirmed by reviewing the output from the
logrotate.show_conf
function. You can see the output for the files not immediately before the curly brace.Slightly redacted output, to remove any files not mentioned in
/etc/logrotate.d/syslog-ng
to make things clearer.Expected behavior
Expected the module to return the logrotate configuration for any file configured in logrotate's config, not just the files which immediately proceed the opening curly brace.
Versions Report
salt --versions-report
The text was updated successfully, but these errors were encountered: