Thanks Stuart, I'm learning a lot of cool things about Python :) I think charms.apt.install_queued() is what we'll use for the moment.
2016-02-18 18:04 GMT+01:00 Stuart Bishop <[email protected]>: > On 18 February 2016 at 17:15, Merlijn Sebrechts > <[email protected]> wrote: > > > The possible values for package-names are not known during build time. > We do > > know that _all_ queued packages have to be installed. Would it be > possible > > to have an `apt.installed.all` state? > > @when_not('apt.queued_installs') tells you this. > > @when_not('packages_queued') > def queue_package_installations(): > apt.queue_install(config()['packages'].split()) > reactive.set_state('packages_queued') > > @when('packages_queued') > @when_not('apt.queued_installs') > def do_setup(): > # packages installed. Lets do this > [...] > > > If you can calculate the packages at import time, you could also do this: > > package_states = ['apt.installed.{}'.format(p) for p in > config()['packages'].split()] > > @when(*package_states) > def do_setup(): > # Packages installed. Lets do this > [...] > > > And for more potential solutions, the documentation for the apt layer > has been updated which states you can call charms.apt.install_queued() > yourself to install queued packages right now. It does nothing if > nothing is queued, so you could just call it at the start of your > handler instead of waiting on an apt.installed.* state at all. >
-- Juju mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju
