at.at creates job with different time than specified
Description of Issue/Question
I wanted to register reboot at 23:52 on Debian 8 (Jessie) minion, but instead I've got reboot at 14:32 (?).
Setup
Only salt-minion needed.
Steps to Reproduce Issue
Simply execute salt-call at.at 23:52 rebot:
# salt-call at.at 23:52 reboot
local:
----------
jobs:
|_
----------
date:
2017-06-30
job:
11
queue:
a
tag:
time:
14:32:00
user:
root
Debug output:
2017-06-29 15:33:56,549 [salt.loaded.int.module.cmdmod][INFO ][1255] Executing command ['/usr/bin/at', 1432] in directory '/root'
2017-06-29 15:33:56,575 [salt.loaded.int.module.cmdmod][DEBUG ][1255] output: warning: commands will be executed using /bin/sh
job 14 at Fri Jun 30 14:32:00 2017
2017-06-29 15:33:56,576 [salt.loaded.int.module.cmdmod][INFO ][1255] Executing command ['/usr/bin/atq'] in directory '/root'
2017-06-29 15:33:56,590 [salt.loaded.int.module.cmdmod][DEBUG ][1255] stdout: 14 Fri Jun 30 14:32:00 2017 a root
Why does it pass "1432" to at?
If I execute at manually, I get expected result:
# echo "reboot" | at 23:52
warning: commands will be executed using /bin/sh
job 15 at Thu Jun 29 23:52:00 2017
Versions Report
Salt Version:
Salt: 2016.3.6
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.2
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: debian 8.8
machine: x86_64
release: 3.16.0-4-amd64
system: Linux
version: debian 8.8
This has to be an issue with salt's parser or something in that portion of salt, because when I throw a log.debug in at the top of the at() function, It has 1432.
But it is worth noting that 11:52pm and 2352 without the colon both work.
Thanks for reporting! Daniel
Did some investigating and narrowed down the issue to the third party yaml library.
I doubt the following is intended behavior (see last part of REPL session) but this is what I get when attempting to load '23:35' and some similar strings with the yaml library. Edit: Yaml appears to be converting the time strings into seconds since 00:00:00 (HH:MM:SS)
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.__version__
'3.12'
>>> yaml.load('23:35')
1415
>>> yaml.load('23:35:58:6434')
'23:35:58:6434'
>>> yaml.load('23:35:58:64')
'23:35:58:64'
>>> yaml.load('23:35:58')
84958
>>> yaml.load('23:35:00')
84900
>>> yaml.load('23:35:01')
84901
>>> yaml.load('23:35:10')
84910
>>> yaml.load('23:35:16')
84916
>>> yaml.load('23:35:20')
84920
>>> yaml.load('23:35:50')
84950
>>> yaml.load('23:35:90')
'23:35:90'
>>> yaml.load('23:35:80')
'23:35:80'
>>> yaml.load('23:35:70')
'23:35:70'
>>> yaml.load('23:35:60')
'23:35:60'
>>> yaml.load('23:35:50')
84950
>>> yaml.load('23:59')
1439
>>> yaml.load('\'23:59\'')
'23:59'
>>> yaml.load('10' + ':10'*1000)
1440620605813714751572500256771039771183776796363748270066801433777012096365744383357389288190097009498533011793426727279587362984529995324874377622153657170734317942709794632161851236707700307926165164501491872966408378579399475541247494467436803483759272384069823002922817931684710880518771052215977313346760964247028939131151141209194424176702043952333560212641297268101168293170531640547935093230678491050202339842517344688208602994374708978766341553268099486283091382708454394296192864074870172772434306017863221097525668245225699315102397523098504269469598913383306231914032986188177117977103273915920719328833064146964789175087700671347966725496006356247529844155974366884438314356305380819222706881901313716307964164020556400536622301740758822863252873252504608414656546711864406779661016949152542372881355932203389830508474576271186440677966101694915254237288135593220338983050847457627118644067796610169491525423728813559322033898305084745762711864406779661016949152542372881355932203389830508474576271186440677966101694915254237288135593220338983050847457627118644067796610169491525423728813559322033898305084745762711864406779661016949152542372881355932203389830508474576271186440677966101694915254237288135593220338983050847457627118644067796610169491525423728813559322033898305084745762711864406779661016949152542372881355932203389830508474576271186440677966101694915254237288135593220338983050847457627118644067796610169491525423728813559322033898305084745762711864406779661016949152542372881355932203389830508474576271186440677966101694915254237288135593220338983050847457627118644067796610169491525423728813559322033898305084745762711864406779661016949152542372881355932203389830508474576271186440677966101694915254237288135593220338983050847457627118644067796610L
Yup, that would do it.
On Thu, Jul 13, 2017 at 10:11 PM, Corvin Mcpherson <[email protected]
wrote:
Did some investigating and narrowed down the issue to the third party yaml library.
Salt exit point https://github.com/saltstack/salt/blob/develop/salt/utils/args.py#L128
I doubt the following is intended behavior but this is what I get attempting to load '23:35' and some similar strings with the yaml library.
Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] on linux2 Type "help", "copyright", "credits" or "license" for more information.>>> import yaml>>> yaml.version'3.12'>>> yaml.load('23:35')1415>>> yaml.load('23:35:58:6434')'23:35:58:6434'>>> yaml.load('23:35:58:64')'23:35:58:64'>>> yaml.load('23:35:58')84958>>> yaml.load('23:35:00')84900>>> yaml.load('23:35:01')84901>>> yaml.load('23:35:10')84910>>> yaml.load('23:35:16')84916>>> yaml.load('23:35:20')84920>>> yaml.load('23:35:50')84950>>> yaml.load('23:35:90')'23:35:90'>>> yaml.load('23:35:80')'23:35:80'>>> yaml.load('23:35:70')'23:35:70'>>> yaml.load('23:35:60')'23:35:60'>>> yaml.load('23:35:50')84950>>> yaml.load('23:59')1439
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/saltstack/salt/issues/42008#issuecomment-315265073, or mute the thread https://github.com/notifications/unsubscribe-auth/AAssodUdZ6JtK9Xo-_26sUvcttFdT9AZks5sNupqgaJpZM4OJP6G .
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Ping? So is it fixable if Yaml does that?
Thank you for updating this issue. It is no longer marked as stale.
yeah, this is not a bug, it is just part of yaml idiosyncracies.
https://docs.saltstack.com/en/latest/topics/troubleshooting/yaml_idiosyncrasies.html
@saltstack/team-triage
So maybe documentation [0] should have example with double-quotes like '"23:00"' to demonstrate that edge case?
[0] https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.at.html
That seems reasonable, if you wanted to open a PR to add that to the at.at documentation i am sure it would be greatly appreciated.
Closed by https://github.com/saltstack/salt/pull/65031