Handle missing apt lists
On a newly imaged system, /var/lib/apt/lists may not exist. Check for this case before comparing dates to the sources.
Thanks.
And while on this, I would also change:
.. || [ -n "$( find /etc/apt -mindepth 1 -cnewer /var/lib/apt/lists )" ]
Same time there has been some discussion in upstream gitlab about different ways of updating APT package index: https://code.ungleich.ch/ungleich-public/cdist/-/issues/862
tl;dr It's little messy :smile:
Also gitlab->github syncing has been broken for some time, I'll look into it.
How about something like that? Would it be helpful for me to redo this PR on your gitlab instance?
To be honest, yes. Because project's GitHub presence is kind of broken atm. Tho I understand not wanting to create account just to submit oneliner patch.
And that linked thread in upstream GitLab... there's no consensus yet and it moves slowly. I suggest holding this patch until we have, khm, decision. Feel free to jump in with your ideas and thoughts. Much appreciated. But my vote currently goes to solving everything related to APT index updating in __package_apt type. Will see.
Meanwhile, to unblock yourself, you can store your modified type in ~/.cdist/type/ and use it normally in your manifests.
For example, I have following conf:
$ grep conf_dir ~/.cdist.cfg
conf_dir = /home/ander/.cdist:/home/ander/Desktop/src/cdist/cdist/conf:/home/ander/Desktop/src/cdist-contrib
This way I can keep my modifications separated from upstream repos and not worry when/if my PR will be accepted/merged.