Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cron.present state errors when checking for existing user crontab #46439

Closed
MattHoy opened this issue Mar 8, 2018 · 5 comments
Closed

cron.present state errors when checking for existing user crontab #46439

MattHoy opened this issue Mar 8, 2018 · 5 comments
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

Comments

@MattHoy
Copy link

MattHoy commented Mar 8, 2018

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

@gtmanfred gtmanfred added State-Module Bug broken, incorrect, or confusing behavior Core relates to code central or existential to Salt bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch TEAM Core labels Mar 8, 2018
@gtmanfred gtmanfred added this to the Approved milestone Mar 8, 2018
@gtmanfred gtmanfred added severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P3 Priority 3 and removed bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch labels Mar 8, 2018
@gtmanfred
Copy link
Contributor

Thanks for reporting this.

Daniel

@MattHoy
Copy link
Author

MattHoy commented Jul 3, 2018

I see this has been merged to develop but the bug is still present in 2018.3.2, any idea when it will make it to release?

@gtmanfred
Copy link
Contributor

I have marked it to be backported to 2018.3 and 2017.7

@rallytime
Copy link
Contributor

Here is some documentation on the release/branch topology, if you're interested:

https://docs.saltstack.com/en/latest/topics/development/contributing.html#salt-s-branch-topology

@MattHoy
Copy link
Author

MattHoy commented Jul 3, 2018

Thanks team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants