Open snago opened 4 years ago
@snago Sorry to hear that asparagus doesn't do it for you!
The issue here is deeper than this formula. It uses Salt's user.present
state, which expects the value to be given in days.
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.user.html#salt.states.user.present
expire Date that account expires, represented in days since epoch (January 1, 1970).
It wouldn't be a good idea to try to resolve this in the formula using even more Jinja than there already is:
Your best bet is to file an issue in the main SaltStack repo and see what their response is.
In the meantime, you could build upon an answer such as this one to use this expression to calculate a given date. So something like:
$ expr $(date -d "2020-01-01" +%s) / 86400
18262
Ah, yes, you are right. It would be much better to fix this in user.present
.
I've opened https://github.com/saltstack/salt/issues/55983.
But looking at that jinja it looks like when/if that issue is fixed and user.present
accepts strings as expire there might be some changes required to this formula before I could start using strings as expire
in the users pillars.
I've opened saltstack/salt#55983.
@snago Excellent, hope that leads to a resolution and doesn't fall afoul of the dreaded stalebot
!
But looking at that jinja it looks like when/if that issue is fixed and
user.present
accepts strings as expire there might be some changes required to this formula before I could start using strings asexpire
in the users pillars.
Now this might sound strange but our formulas don't benefit from upstream changes immediately. The problem is that we have to remain backwards compatible with all of the officially supported releases, so that goes back to 2018.3
at the current time. Have a look at our Travis runs for a clearer picture:
We do test against the master
branch, though, so if this feature is ever implemented, we could add another conditional to the current code to take advantage of that. It could be some time before that happens, though. Unless someone steps up to provide a PR to implement the feature...
Is your feature request related to a problem?
As a human, looking at users pillars it is hard to see when they expire.
Describe the solution you'd like
Instead of this:
I would like to be able to have this:
Describe alternatives you've considered
Augment my brain with a chip that automatically can convert numbers I see from UNIX timestamp and insert the date and time as a memory. E.g. I would look at a UNIX timestamp and think of the first time that I ate asparagus and I would "remember" that it was 2020-07-12 at 10:00:00. That would be much cooler, but it seems a lot harder.
Additional context