The cron.rm_job fails when trying to remove cron entry after being added with cron.set_job.
Nothing special. Small lab with a single master and handful of minions.
[root@minion2 ~]# crontab -l
no crontab for root
[root@minion2 ~]# salt-call -l debug cron.set_job root '20' '15' '*' '*' '*' '/usr/local/scripts/my_script.sh' '' 'Daily MyScript Run' 'MyScript'
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Connecting to master. Attempt 1 of 1
[DEBUG ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')
[DEBUG ] Generated random reconnect delay between '1000ms' and '11000ms' (9554)
[DEBUG ] Setting zmq_reconnect_ivl to '9554ms'
[DEBUG ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506', 'clear')
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_59fbbd3c10_pub.ipc
[DEBUG ] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_59fbbd3c10_pull.ipc
[DEBUG ] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_59fbbd3c10_pull.ipc
[DEBUG ] Sending event: tag = salt/auth/creds; data = {'_stamp': '2017-10-30T21:06:28.385609', 'creds': {'publish_port': 4505, 'aes': 'FznFHvi9HnjIST2yHRsTrXkfbPTF9/vRecD1KYGd220SfwBvRQWX9/UALVJvm3m8HffhE2dzDWY=', 'master_uri': 'tcp://10.0.2.30:4506'}, 'key': ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')}
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Determining pillar cache
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506', 'aes')
[DEBUG ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] LazyLoaded cron.set_job
[DEBUG ] LazyLoaded file.user_to_uid
[DEBUG ] LazyLoaded cmd.run_stdout
[INFO ] Executing command 'crontab -l' as user 'root' in directory '/root'
[ERROR ] Command 'crontab -l' failed with return code: 1
[ERROR ] stderr: no crontab for root
[ERROR ] retcode: 1
[INFO ] Executing command 'crontab /tmp/__salt.tmp.1VQive' as user 'root' in directory '/root'
[DEBUG ] LazyLoaded local_cache.returner
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506', 'aes')
[DEBUG ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')
[DEBUG ] LazyLoaded nested.output
local:
new
[root@minion2 ~]# crontab -l
# Lines below here are managed by Salt, do not edit
# Daily MyScript Run SALT_CRON_IDENTIFIER:MyScript
20 15 * * * /usr/local/scripts/my_script.sh
[root@minion2 ~]# salt-call -l debug cron.rm_job root '/usr/local/scripts/my_script.sh'
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Connecting to master. Attempt 1 of 1
[DEBUG ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')
[DEBUG ] Generated random reconnect delay between '1000ms' and '11000ms' (3542)
[DEBUG ] Setting zmq_reconnect_ivl to '3542ms'
[DEBUG ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506', 'clear')
[DEBUG ] Decrypting the current master AES key
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_59fbbd3c10_pub.ipc
[DEBUG ] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_59fbbd3c10_pull.ipc
[DEBUG ] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_59fbbd3c10_pull.ipc
[DEBUG ] Sending event: tag = salt/auth/creds; data = {'_stamp': '2017-10-30T21:06:41.192584', 'creds': {'publish_port': 4505, 'aes': 'FznFHvi9HnjIST2yHRsTrXkfbPTF9/vRecD1KYGd220SfwBvRQWX9/UALVJvm3m8HffhE2dzDWY=', 'master_uri': 'tcp://10.0.2.30:4506'}, 'key': ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')}
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] Determining pillar cache
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506', 'aes')
[DEBUG ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] LazyLoaded cron.rm_job
[DEBUG ] LazyLoaded file.user_to_uid
[DEBUG ] LazyLoaded cmd.run_stdout
[INFO ] Executing command 'crontab -l' as user 'root' in directory '/root'
[DEBUG ] stdout: # Lines below here are managed by Salt, do not edit
# Daily MyScript Run SALT_CRON_IDENTIFIER:MyScript
20 15 * * * /usr/local/scripts/my_script.sh
[INFO ] Executing command 'crontab /tmp/__salt.tmp.djEM0G' as user 'root' in directory '/root'
[DEBUG ] LazyLoaded local_cache.returner
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506', 'aes')
[DEBUG ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'minion2', 'tcp://10.0.2.30:4506')
[DEBUG ] LazyLoaded nested.output
local:
absent
[root@minion2 ~]# crontab -l
# Lines below here are managed by Salt, do not edit
# Daily MyScript Run SALT_CRON_IDENTIFIER:MyScript
20 15 * * * /usr/local/scripts/my_script.sh
[root@minion2 ~]# cat /var/spool/cron/root
# Lines below here are managed by Salt, do not edit
# Daily MyScript Run SALT_CRON_IDENTIFIER:MyScript
20 15 * * * /usr/local/scripts/my_script.sh
[root@minion2 ~]#
### Versions Report
[root@minion2 ~]# salt-call --versions
Salt Version:
Salt: 2017.7.2
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.6
mysql-python: Not Installed
pycparser: Not Installed
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.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.4.1708 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-693.5.2.el7.x86_64
system: Linux
version: CentOS Linux 7.4.1708 Core
[root@minion2 ~]#
Description of Issue/Question
The cron.rm_job fails when trying to remove cron entry after being added with cron.set_job.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.cron.html#salt.modules.cron.rm
Setup
Nothing special. Small lab with a single master and handful of minions.
Steps to Reproduce Issue