ansible-openwrt icon indicating copy to clipboard operation
ansible-openwrt copied to clipboard

We do not verify the presence of opkg cache files for update

Open Hurricos opened this issue 2 years ago • 2 comments

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 an opkg 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.

Hurricos avatar Dec 11 '22 19:12 Hurricos

@gekmihesg Could you review my fix for this broken opkg module behavior soon after first boot?

Hurricos avatar Dec 15 '22 15:12 Hurricos

Commit 16f590e fixes this commit's behavior in check-mode. Unfortunately, in order to find the number of files in e.g. /tmp/opkg-lists, I need to use the find command, which does not support check mode; to avoid breakage when running in check-mode, safen the check for find output with an is defined.

Hurricos avatar Dec 21 '22 18:12 Hurricos