fix: Verify the presence of opkg cache files for update #56
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.
When openwrt_remote_opkg_lists_dir is placed at /tmp/opkg-lists (the default), it is recreated on each boot. However, when any opkg command is run -- including e.g.
opkg list-installed
-- that directory is created and left empty.On such a router, the first time an
opkg
command is run, the openwrt_remote_opkg_lists_dir is given mtime <= 86400 (at least for the next 24h), suggesting to the default ansible-openwrt's tasks that anopkg update
has been issued recently when one has not. This seems to happen when an Ansible check-mode run is performed right after a router is booted.Correct this problem by verifying that there are actual opkg cache files. We assume (perhaps incorrectly) that all of the opkg cache files were created at the same time during the most recent successful
opkg update
run, if there are any, meaning they all have dates roughly matching that of their openwrt_remote_opkg_lists_dir. As a result, we do not need to check the age of those files.This commit fixes issue #55:
#55
Signed-off-by: Martin Kennedy [email protected]