cron.present state errors when checking for existing user crontab #46439
Labels
Bug
broken, incorrect, or confusing behavior
Core
relates to code central or existential to Salt
P3
Priority 3
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
State-Module
Milestone
Description of Issue/Question
Using the cron.present state errors, stating no crontab is present, but then fails to install the crontab for the specified user.
Expected behaviour:
Salt checks for prod user crontab, if present, end, if not present, install the users crontab.
Actual behaviour:
Salt errors while checking for user crontab, then the state advises it ran successfully without installing a crontab.
Setup
SLS file is as follows:
user-prod:
cron.file:
- name: salt://core/cron/prod
- replace: False
- user: prod
Steps to Reproduce Issue
When calling the state directly, or via a highstate it always returns the below output,
[root@pvt-kx02-sv005 cron]# salt-call state.sls core.cron
[ERROR ] Command 'crontab -u prod -l' failed with return code: 1
[ERROR ] stderr: no crontab for prod
[ERROR ] retcode: 1
ID: user-prod
Function: cron.file
Name: salt://core/cron/prod
Result: True
Comment: User prod already has a crontab. No changes made
Started: 15:23:57.142780
Duration: 10.013 ms
Changes:
Running the command directly confirms there is no prod crontab:
[root@SERVERNAME cron]# crontab -u prod -l
no crontab for prod
[root@SERVERNAME ~]# cd /var/spool/cron/
[root@SERVERNAME cron]# ls
root
Versions Report
(Provided by running
salt --versions-report
. Please also mention any differences in master/minion versions.)[root@MINION cron]# salt-minion --versions-report
Salt Version:
Salt: 2017.7.4
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Jun 17 2014, 18:11:42)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: centos 7.0.1406 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-123.el7.x86_64
system: Linux
version: CentOS Linux 7.0.1406 Core
[root@MASTER] # salt --versions-report
Salt Version:
Salt: 2017.7.4
Dependency Versions:
cffi: 1.11.4
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.10
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Aug 4 2017, 00:39:18)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: centos 7.4.1708 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-514.21.2.el7.x86_64
system: Linux
version: CentOS Linux 7.4.1708 Core
The text was updated successfully, but these errors were encountered: