On 24/08/18 01:44,
slac...@gmail.com wrote:
> I'm a little bit confused by the wording of the package module
> documentation, specifically the roles of the `list-updates` and
> `list-updates-local` functions.
>
> First: "This command is expected to return a list of all the available
> updates for currently installed updates." doesn't make sense to me.
> Should it be "This command is expected to return a list of all the
> available updates for currently installed *packages*"? I've been
> assuming it should.
Yes, correct. It's just unfortunate wording.
> Second: `list-updates` clearly is meant to go off and fetch a list of
> packages which can be upgraded. Usually this will be from a remote
> repository. The docs say that CfEngine caches this information. Does
> CfEngine itself do this (cf-agent maybe?) or is it the responsibility of
> *the module*?
No, CFEngine caches this. If we don't count the package database of the
actual package manager (yum or apt), the package module is completely
stateless. It is not expected to store anything.
> I can't work this out because I can't quite grasp the role of
> `list-updates-local`. Should that return a list of updates which are
> stored on the local disk? For instance, package files downloaded to
> `/var/spool/pkg` but not yet installed, or should it return the cached
> result of the previous call to `list-updates`?
No, the output of the two should be exactly the same: All available
updates. The difference is that the non-local version should sync its
database with the upstream package source first, and then return the
list. The local version should just return the list it already has,
without consulting the network.
The reason both of them exist is that 'list-updates-local' is called
much more often than 'list-updates', so we don't want to hit the network
every time we do that.
--
Kristian