/srv/irclogs.ubuntu.com/2020/07/31/#smooth-operator.txt

facubatista¡Muy buenos días a todos!11:13
gnuoyHi, I'm converting a charm over to use charmcraft to build it and somewhere along the way I've lost a number of hooks files from the hooks dir. Should charmcraft fully populate the hooks dir at build time or are they supposed to be automagically created at deploy time ?11:54
gnuoyI seem mention in charmcraft that a handle of hooks are created for old juju version, so I assume the full set are supposed to appear at deploy time ?12:01
gnuoyAfter deploying I still only have those created by charmbuild12:02
gnuoyI see https://github.com/canonical/operator/issues/257 talks about the hook files being missing if the install hook fails but from what I can tell the install hook ran fine.12:21
gnuoyThe charm log mentions that it is running the legacy install hook if that's relevant12:23
studentzAdvantages  of smooth-operator over reactive charms? Thanks12:26
gnuoyok, so my charm is dispatch aware, which appears to mean no symlinks for me https://github.com/canonical/operator/blob/master/ops/main.py#L17813:01
gnuoyThat being the case, when I am in a debug-hooks session for update-status for example, what should I run ?13:02
gnuoyLooks like upgrading juju did the trick13:17
mupIssue operator#362 opened: Block charm if Juju version is too low <Created by gnuoy> <https://github.com/canonical/operator/issues/362>13:28
facubatistagnuoy, hello!15:02
facubatistagnuoy, if you don't have any special needs, you can just avoid having a hooks directory: charmcraft will create a "dispatch" script (for new jujus) and a hooks directory with a couple of basic hooks (for older jujus), and the operator framework will do the rest15:03
gnuoyfacubatista, ack. ooi in a debug-hooks session what do I run ?15:04
gnuoyIf I'm trying to debug a charm issue15:04
facubatistagnuoy, you can call the dispatch script setting the JUJU_DISPATCH_HOOK env... but you may want to use debug-code, which lets you debug directly inside the charm code15:05
gnuoyfacubatista, ah! ok thanks15:06
facubatistagnuoy, sorry, JUJU_DISPATCH_PATH, not *HOOK15:06
facubatistagnuoy, with debug-code you can tell it to debug a specific hook (and will leave you with a PDB session inside the running charm, at the beginning of your hook execution)15:07
facubatistagnuoy, or you may even add breakpoints() inside the code (that will make the code interrupt ONLY if you're in a debug session)15:07
facubatistagnuoy, you can see all that here: https://discourse.juju.is/t/live-debugging-at-python-level/291415:08
* facubatista brb15:08
gnuoythat looks great facubatista, thanks15:08
mupIssue operator#362 closed: Block charm if Juju version is too low <Created by gnuoy> <Closed by gnuoy> <https://github.com/canonical/operator/issues/362>15:18
jesseleoHey guys I'm trying to test the install of my charm, but I'm having trouble  adding the resource in the test harness20:34
jesseleohttps://paste.ubuntu.com/p/gqnJXgvGyK/20:34
jesseleoI see that add resource function was a recent addition so I'm installing ops repo from master because `add_resource` doesn't show up when you pip install ops20:35
jesseleoI'm just not really sure what I'm doing wrong because it says that `add_resource` isn't an attribute of Harness20:37
jesseleobut "begin" is an attribute of harness and that executes fine20:37
jesseleothere is a nefarious print statement in there. ignore that^^20:49
facubatistajesseleo, sorry, I'm eod, but will take a look at this on Monday21:15
jesseleono worries, enjoy your weekend21:18
jesseleofacubatista21:18

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