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

feat(hourly): Add configuration to enable hourly jobs #60

Merged
merged 5 commits into from
Jan 14, 2022

Conversation

mdschmitt
Copy link
Contributor

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

Not unless existing pillar values for clients have "hourly" set in their job configurations. ...in which case, they already don't work straight-out-of-the-box.

Related issues and/or pull requests

Describe the changes you're proposing

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

  • Updated the README (e.g. Available states).
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

Additional context

@mdschmitt mdschmitt force-pushed the add_hourly_capability branch from 6194ab5 to 4ba20c8 Compare November 23, 2021 20:34
Copy link
Member

@myii myii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @mdschmitt. Some initial feedback for the time being.

After numerous discussions, essentially we never use salt['pillar.get']() in our formulas. Let me give some brief explanations:

  1. salt['pillar.get']() is unnecessary since map.jinja already merges all of the elements under one key, which is logrotate for this formula.
  2. There have been many reasons given why non-secret data shouldn't be stored under pillars (e.g. pillars are rendered on the master); so we're in the process of moving to config.get instead, which has already been adopted by this formula in map.jinja.

Hence, using salt['pillar.get']() inline is unnecessary duplication, longer to write, more difficult to review (not a single point for all data being used by the formula), not to mention prevents end-users from providing their data from sources other than pillar (e.g. SDB).

You should find it relatively simple to access the data via the logrotate key. Let me know if you face any issues. Once you're done, please amend/rebase your commit(s) and force-push back here -- thanks.

logrotate/config.sls Outdated Show resolved Hide resolved
@mdschmitt mdschmitt force-pushed the add_hourly_capability branch from 4ba20c8 to 7b5676b Compare December 9, 2021 23:28
@mdschmitt
Copy link
Contributor Author

@myii , how's this look?

@mdschmitt
Copy link
Contributor Author

No major rush, but any word on this?

@mdschmitt
Copy link
Contributor Author

@myii , dropping another bump in here. Any feedback on my revisions?

@mdschmitt mdschmitt force-pushed the add_hourly_capability branch 2 times, most recently from c274d01 to 77374a4 Compare January 13, 2022 20:52
@mdschmitt mdschmitt force-pushed the add_hourly_capability branch from 77374a4 to cd4cd1d Compare January 13, 2022 20:57
@mdschmitt
Copy link
Contributor Author

Latest CI failure because ArchLinux properly uses systemd timers rather than cron. Requires deeper code tweakage to properly provide for. This PR on hold until I can get that to be better.

@myii
Copy link
Member

myii commented Jan 14, 2022

@mdschmitt Thanks for the additions. I've tested some changes in my own fork to ensure Arch Linux is working as well. I'll push those here and merge this PR shortly.

One question remains: which reference did you use for the /etc/logrotate.hourly.d/... path? I couldn't find any mention of it in the upstream repo:

myii added a commit to myii/ssf-formula that referenced this pull request Jan 14, 2022
@mdschmitt mdschmitt requested a review from a team as a code owner January 14, 2022 11:36
@myii myii merged commit ee43fac into saltstack-formulas:master Jan 14, 2022
@saltstack-formulas-travis

🎉 This PR is included in version 0.13.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

myii pushed a commit to myii/ssf-formula that referenced this pull request Jan 14, 2022
# [1.347.0](v1.346.0...v1.347.0) (2022-01-14)

### Features

* **logrotate:** use `cron-formula` dep instead of single `cron` state ([bb0ec87](bb0ec87)), closes [/github.com/saltstack-formulas/logrotate-formula/pull/60#issuecomment-1013031092](https://github.com//github.com/saltstack-formulas/logrotate-formula/pull/60/issues/issuecomment-1013031092)
@mdschmitt
Copy link
Contributor Author

Wow @myii , thank you so much for doing this. You beat me to writing the kitchen test and I definitely would have ended up rewriting things to allow for Arch. Folding in cron-formula as a dependency is much cleaner though.

As far as the naming for "logrotate.hourly.d", it was just a logical canonicalization of "logrotate.d" with the explicit addition of "hourly" since hourly isn't out-of-the-box functionality. Inspiration taken from https://sleeplessbeastie.eu/2018/07/11/how-to-execute-logrotate-every-hour

@myii
Copy link
Member

myii commented Jan 18, 2022

No problem -- thanks for the reference, @mdschmitt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants