fix apt cache timestamp logic#261
Open
anarcat wants to merge 1 commit intoprometheus-community:masterfrom
Open
fix apt cache timestamp logic#261anarcat wants to merge 1 commit intoprometheus-community:masterfrom
anarcat wants to merge 1 commit intoprometheus-community:masterfrom
Conversation
I just stumbled upon a host where there is not `update-success-stamp`
at all. Turns out this file is actually site-specific to our
environment and is created by a Puppet module we use.
It's not standard: the APT::Periodic feature flags updates with the
`update-stamp` file instead!
So let's split the check into multiple, distinct heuristics:
1. if the `update-success-stamp` file exist, use it and disregard the
rest
2. failing that, if `APT::Periodic` is configured, check
`update-stamp`, which does roughly the same (but won't update on a
plain `apt update`)
3. failing that, check `/var/lib/apt/lists/partial` which *works* but
might give a false timestamps when apt-get *fails* to get an
update, as that directory's timestamp is always updated
Because of (3), we still need the other heuristics.
Signed-off-by: Antoine Beaupré <anarcat@debian.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I just stumbled upon a host where there is not
update-success-stampat all. Turns out this file is actually site-specific to our environment and is created by a Puppet module we use.It's not standard: the APT::Periodic feature flags updates with the
update-stampfile instead!So let's split the check into multiple, distinct heuristics:
if the
update-success-stampfile exist, use it and disregard the restfailing that, if
APT::Periodicis configured, checkupdate-stamp, which does roughly the same (but won't update on a plainapt update)failing that, check
/var/lib/apt/lists/partialwhich works but might give a false timestamps when apt-get fails to get an update, as that directory's timestamp is always updatedBecause of (3), we still need the other heuristics.