/srv/irclogs.ubuntu.com/2017/10/05/#juju.txt

=== frankban|afk is now known as frankban
=== ed is now known as Guest32400
skayI have some resource questions15:27
* skay has multiple questions and is now stuck deciding which one to ask first15:28
skayI want to do upgrades and installs based on the availability of a resource. I have something that checks for the existence or change of a resource and sets a state15:29
skayI can have @when_not checking that state for me, so that it triggers an install or upgrade15:30
skaybut, I can also have that check inside of the upgrade hook, because in the docs, the resource section says that juju attach triggers the upgrade15:31
skaywhich is a better design or are they the same, or is there another approach you'd suggest?15:31
skayanother question. why isn't there a hook specific to juju attach?15:33
skayalso, it would be handy to have a decorator for when a resource changes. I could use @when_file_changed for this, but it means I would need to pass a callback that  gets the resource of interest and returns its path. Is that a discouraged approach compared to soemthing that sets a flag?15:41
skayalso, I can check this in the src code later, but if someone knows off the top of their head it would be useful... The docs mentioned that juju attach triggers the upgrade-charm hook, but do not specify whether juju deploy in conjunction with a resource flag does15:43
skays/flag/option15:44
bdx"another question. why isn't there a hook specific to juju attach?" - let me see if I can find the mailing list post I sent out for this, possibly you can put heat on it16:18
bdxskay: https://lists.ubuntu.com/archives/juju/2017-September/009515.html16:20
skaybdx: ack. just followed up16:37
bdxthanks16:37
skaywhoops, I replied all and I'm not subscribed to juju-dev16:38
bdxskay: I just got your email16:40
bdxyou might get a bounce back from juju-dev though16:40
skaybdx: I kept it pretty short16:40
skayI did16:40
bdxskay: I feel like the decorator would be serving a similar purpose as a upgrade-resource-myresource hook though right16:44
skayyes16:44
bdxwe just need something decoupled from the upgrade-charm hook16:44
skayI agree with that part16:44
=== frankban is now known as frankban|afk
skayI'm not sure whether hooks are preferred over reactive flags16:45
skays/reactive flags/reactions?16:45
bdxskay: yeah so, using the reactive framework, you set and unset "flags" that cause your "reactive handlers" to fire when the sufficient rules are met16:49
skaycorrect16:49
bdxskay: hooks are the underlying mechanism (legacy juju 1 uses these) that we are abstracting away by using the reactive framework on top16:50
skaycorrect, so I thought it followed that the recommend way for charmers going forward is to avoid using hooks and to use flags16:51
skayand the reactive decorators16:51
bdxentirely16:51
skaythis is why I want a decorator like resource-changed16:51
skayor for a resource being attached16:51
bdxskay: I see what you are saying .... my suggestion of having an upgrade-resource-myresource hook is dealing with legacy-ish juju16:53
bdxskay: so possibly I misspoke, it should be a upgrade-resource-myresource flag that is set upon resource upgrade/attach16:54
skayI see. btw, wouldn't it be simpler to have an upgrade-resource hook rather than creating hooks on the fly?16:54
bdxnot sure I follow16:54
skayI think I misunderstood. do you want @upgrade_resource("myresource") ?16:56
bdxI'm chasing the capability to handle a resources' lifecycle ops on an per-resource basis16:57
bdxskay: @when('upgrade-resource-myresource')16:57
skayor for juju to discover the resourses from the charm and create @upgrade_resource_myresource() based on the resources listed16:57
skaythat makes more sense than what I thouhgt you meant16:58
bdxha16:58
bdxawesome16:58
bdxyeah, something similar to https://github.com/jamesbeedy/interface-db-info/blob/master/provides.py#L916:58
bdxhow the interface hooks are generated there16:59
Durgeobleis normal that juju stucks in waiting for address?20:19

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!