/srv/irclogs.ubuntu.com/2020/08/04/#smooth-operator.txt

mupIssue operator#286 closed: charms/test_main should not use Pickle <Created by jameinel> <Closed by jameinel> <https://github.com/canonical/operator/issues/286>08:27
mupPR operator#363 closed: 0.8 test charm no pickle <Created by jameinel> <Merged by jameinel> <https://github.com/canonical/operator/pull/363>08:27
Chipacagooooood  morning!08:31
jammorning Chipaca08:53
Chipacajam: 👋 how's things?08:57
jamChipaca, going pretty well. I still need your review on operator#36409:01
mupPR #364: ops/testing.py: Harness.begin_with_initial_hooks() <Created by jameinel> <https://github.com/canonical/operator/pull/364>09:01
jamChipaca, I'll probably miss the standup today, I have a conflicting meeting09:02
Chipacaack09:02
jamChipaca, how's it with you?09:07
Chipacajam: needing more coffee :)09:07
* Chipaca has more coffee now09:24
Chipacajam: instead of diving into preconditions, i've been tinkering with ops-lib-k8s09:48
Chipacastill haven't touched the tests though09:49
mupIssue operator#237 closed: Feature request: Harness helper function/flag to run initial hooks as juju would execute? <enhancement> <Created by Vultaire> <Closed by jameinel> <https://github.com/canonical/operator/issues/237>09:52
mupPR operator#364 closed: ops/testing.py: Harness.begin_with_initial_hooks() <Created by jameinel> <Merged by jameinel> <https://github.com/canonical/operator/pull/364>09:52
jamChipaca, ah nice. I don't think I gave much feedback on that one, I should09:52
Chipacajam: latest pr sets things up for them to work with opslib because design was wanting a real-world example of what a non-interface component looked like09:53
gnuoyChipaca, I'm in the process of updating charmcraft issue 104. Would I be right in saying that for charms running in Juju <2.8 the operator framework needs to create the hook symlinks when the install hook runs ?10:34
mupIssue #104: Symlink for `hooks/upgrade-charm` is not created when missing <Created by evhan> <Closed by jameinel> <https://github.com/canonical/operator/issues/104>10:34
* gnuoy assumes it should and updates the bug10:40
Chipacagnuoy: yes10:43
gnuoykk, thanks10:43
Chipacagnuoy: bah, whatever hook runs first10:43
gnuoyyep, understood10:43
Chipacain <2.8 on k8s that was 'start', for ex10:43
Chipacaand it couldbe upgrade-charm? i think10:43
Chipacaiffen you're upgrading :)10:44
gnuoyso I think the bug is correct, if you use charmcraft then a legacy deployment is never detected and the symlinks never created.10:45
gnuoyI assumed it was deliberate hence the min-version thing. I'll update the title.10:46
Chipacagnuoy: what's a 'legacy deployment'?10:46
gnuoyChipaca, I'm stealing the phrase from the ops framework. I believe it to mean a non-dispatch aware version of Juju10:47
gnuoyhttps://github.com/canonical/operator/blob/master/ops/main.py#L17310:47
Chipacaah :)10:47
Chipacagnuoy: this is with juju <2.8?10:48
gnuoyright10:48
Chipacahmm™10:48
gnuoyI've put more detail in https://github.com/canonical/charmcraft/issues/10410:48
Chipacathanks10:48
Chipacagnuoy: this is code i wrote, so it cannot _possibly_ have bugs10:50
gnuoyhaha, must be feature.10:50
Chipacagnuoy: https://youtu.be/qhXjcZdk5QQ?t=5210:52
gnuoyexactly!10:53
Chipacathat's quite a pickle10:59
facubatista¡Muy buenos días a todos!11:03
Chipacafacubatista: (null)11:04
Chipacaer11:04
* Chipaca checks his config11:04
facubatistaje11:05
Chipacafacubatista: 👋❗11:05
Chipacamuch better11:05
facubatistahttps://imgflip.com/i/4adkoh11:06
facubatista:)11:06
Chipacafacubatista: https://www.bbc.com/future/article/20160325-the-names-that-break-computer-systems11:07
bthomasThis one surely breaks a lot https://xkcd.com/327/ :-)11:08
facubatistaChipaca, my mother's last name is Muñiz, and I remember the real life in the pre-unicode era, everything was Mu#iz for her11:09
facubatistaChipaca, jam, in charmcraft#104, shouldn't the OF create the rest of the hooks?11:10
mupIssue charmcraft#104: Hook symlinks not created for deployments to environments running Juju < 2.8 <Created by gnuoy> <https://github.com/canonical/charmcraft/issues/104>11:10
Chipacafacubatista: remember manuel de la peXa?11:10
Chipacafacubatista: yes the problem is that charmcraft is setting things up in such a way that ops thinks it's in post-2.711:11
jamChipaca, facubatista : the code is still there: https://github.com/canonical/operator/blob/master/ops/main.py#L17511:12
jamand it is even called: https://github.com/canonical/operator/blob/master/ops/main.py#L33411:12
Chipacajam: but the hooks are symlinks to dispatch11:13
Chipacajam: and dispatch sets JUJU_DISPATCH_PATH11:13
Chipacajam: and dispatch exists11:13
Chipacaand that's what ops uses to choose legacy or dispatch11:13
facubatistaChipaca, in current charmcraft, after zipping, remember hooks are not symlinks (but will be in future charmcrafts)11:13
jamChipaca, but why is that a problem?11:14
Chipacano difference, it's the fact that it sets JUJU_DISPATCH_PATH and exists that does it11:14
gnuoyself.is_dispatch_aware gets incorrectly set to True which causes an early exit from ensure_event_links11:14
Chipacajam: because then no symlinks are created11:14
jamChipaca, ah, dispatch is setting JUJU_DISPATCH_PATH, why would it do that?11:14
jambad script no biscuit11:14
jam:)11:14
Chipacajam: other bugs :)11:14
Chipacaneed to dig11:15
jamChipaca, ok. so it is a charmcraft bug (arguably), at the least, ops and charmcraft don't agree on signaling11:15
Chipacayeup11:15
facubatistaChipaca, https://github.com/canonical/charmcraft/commit/a0bdc74c5b2b63eff9248ad8c192a2c9f8a0f5e111:17
Chipacayup11:18
jamChipaca, thinking about multipass and snapcraft/charmcraft. I find it interesting with snaps that it is so dangerous to depend on a executable in $PATH that the preferred route is to expose a service for anyone to poke via the network11:27
jamIs it because it has been easier to grant Network as a policy than granting "access to executable Foo" as a policy?11:27
Chipacajam: it isn't about it being dangerous, it's a limitation of the security layers11:27
Chipacajam: (there's also the policy issue of letting a confined thing execute an unconfined thing meaning you've just unconfined the confined)11:29
jamChipaca, so find a way to execute the unconfined thing via an HTTP post instead of a CLI exec11:30
Chipacajam: the thing is already exposing a grpc api over a socket to itself11:33
jamChipaca, I just mean, a CLI is an API just like an HTTP API is.snapcraft is able to confine things to not find executable, but doesn't have fine grained control to say what services you could talk to11:34
jambut it means people break their confinement via HTTP requests instead of via CLI requests11:34
Chipacagnuoy: we're going to be 5 minutes late11:57
gnuoysure np11:58
Chipacajam, facubatista, wrt charmcraft#104, not super clear to me what we can do13:09
mupIssue charmcraft#104: Hook symlinks not created for deployments to environments running Juju < 2.8 <Created by gnuoy> <https://github.com/canonical/charmcraft/issues/104>13:09
facubatistaChipaca, create all hooks symlinks everytime?13:09
Chipacathat's less than ideal for a couple of reasons13:10
Chipacathe issue is that calling charm.py drops the name of the hook13:10
Chipacathat is, we lose sys.argv[0]13:10
jamChipaca, not set JUJU_DISPATCH_PATH in dispatch13:10
jamah right13:10
Chipacaso it seems to me13:10
jamis there a magic in 'exec' ?13:10
Chipacathat what we should do is set our _own_ variable13:10
Chipacawith blackjack and …13:11
Chipaca… built-in help?13:11
Chipacajam: i think bash exec does, sh exec does not13:11
Chipacabut i'd have to double-check13:11
jamChipaca, 'exec --help' says 'exec -a NAME'13:11
Chipacaright, that's bash13:12
facubatistaChipaca, the builtin help is a good idea, there's a recurrent question when dealing with this new "dispatch thing" that is "so I'm in here with debug-hook, how I call my hook manually?"13:12
jam$ /bin/dash -c 'exec -a foo echo hello'13:12
Chipacajam: ooh, undocumented?13:13
jam /bin/dash: 1: exec -a: not found13:13
Chipacajam: b'doh13:13
jamnope, just copy&paste didn't work because IRC interpreted the opening '/' :)13:13
jamChipaca, I'm not opposed to #!/bin/bash in dispatch13:13
Chipacaor we could make it a python script ]=)13:14
facubatistaChipaca, +113:14
Chipacabut bash sounds alright for a last-minute thing13:15
jamfacubatista, Chipaca we could. I know that breaks on RedHat because python3 isn't in the default instal13:15
Chipacadrop JUJU_DISPATCH_PATH, and use -a13:15
Chipacaor13:16
ChipacaOR13:16
Chipacause symlinks13:16
Chipaca:)13:16
facubatistaChipaca, symlinks how?13:16
Chipacathis all goes away if we stop flattening symlinks13:17
Chipacadoesn't it?13:17
Chipaca(maybe it doesn't)13:17
jamChipaca, if you change hooks/install => ../src/charm.py it would go away, but you can't do that because we want to put the "use the venv" somewhere13:17
Chipacaright13:17
* Chipaca sets the venv on fire and sits back to watch13:18
ChipacaI'll write the "use bash w/exec -a" as the quickest way out13:18
Chipaca… that doesnt work13:23
Chipacapython's fiddling with argv13:24
facubatistaChipaca, you that know Unix (?), is it ok to have a space rigth after the shebang in "#! /usr/bin/env python3" ?13:30
Chipacafacubatista: yep (and they've been documented as required at some point, although weren't)14:34
facubatistathanks14:36
Chipacafacubatista: also, env -S exists (as of when? no idea)14:46
ballotHello !15:04
facubatistahello ballot!15:05
ballotI'm looking for a way to retrieve the pod_spec using ops.testing. I see that self.harness.get_pod_spec is defined in 0.8 (https://github.com/canonical/operator/blame/master/ops/testing.py#L423). I guess I don't have a way to test this easily with 0.7 right ? :)15:06
ballotwell, I don't really have a problem trying to use 0.8 for my charm tbh anyway, i'll give it a try15:07
Chipacaballot: and 0.8 should be out this week :)15:15
Chipacaballot: pre that, there wasn't an easy way of doing that, no15:15
ballotChipaca: alright, just wanted to be sure I was not missing something. I have an issue with charmcraft build, I'll bring that to the right channel, thanks :)15:16
Chipacaballot: 'charmcraft build' issues is also here :)15:16
ballotAh !15:16
Chipacaballot: unless you're building something so secret you can't talk about it in public :-D15:17
ballotWell, I put "-e git+https://github.com/canonical/operator.git@master#egg=ops" in my requirement.txt and confirmed it works with "pip install -r requirements.txt"15:17
ballotWhen I do charmcraft build, in the full log I have15:17
ballothttps://pastebin.ubuntu.com/p/jmyJh58WCT/15:18
ballot(sorry bad habit of using the internal one)15:18
Chipacawhoa15:19
facubatistaChipaca, jam, where I can read about the order of first events sent by Juju?15:19
ballotIt's fine, I can workaround it easily by manually pulling the wheel in the right location, but probably bug worthy. Just wanted to be sure it was not something obvious on my side15:19
Chipacaballot: does that still happen if your requirements.txt has 'git+https://github.com/canonical/operator.git' instead of your more funky line?15:20
ballotChipaca: let me try15:20
jamfacubatista, https://discourse.juju.is/t/event-cycle/111715:20
facubatistajam, thanks15:20
jamhttps://discourse.juju.is/t/charm-hooks/1040 and https://discourse.juju.is/t/the-hook-environment-hook-tools-and-how-hooks-are-run/1047 are also relevant15:20
ballotChipaca:  :: ERROR: Could not detect requirement name for 'git+https://github.com/canonical/operator.git', please specify one with #egg=your_package_name15:22
Chipacasuper strange, i've got that here and it works15:22
ballotChipaca: also tried to remove the @master, but then, read-only filesystem again15:22
Chipacaballot: this is with charmcraft 0.3 from the snap, yes?15:22
ballotChipaca: yes15:23
Chipacafacubatista: ^ any ideas?15:23
ballotChipaca: I think I know what happens, I just need to find in pip where is the default location for pulling the dependencies15:23
ballotChipaca: ah, that's the "-e"15:24
ballotChipaca: it works without the "-e"15:24
Chipacaaugh15:24
ballotyeah right, makes sense15:24
Chipacai totally ignored that :-)15:24
* Chipaca needs a better parser in his brain15:24
facubatistathe -e tries to install it in your home or something?15:24
Chipacait's the "develop" thing15:24
facubatistaChipaca, I though it was why you suggested to use a simpler line15:25
ballotIt's to point toward the module you're working on so you don't have to update your env15:25
ballotfacubatista: yes, I missread, and did remove the "-e"15:25
Chipacayep, like 'python setup.py develop'15:25
Chipacaballot: but if you did that for a charm, you'd end up with a .pth and not the actual code you need inside your charm, right?15:26
ballotanyway, I don't think using -e makes sense for a charm anyway15:26
ballotChipaca: yeah, it was merely a bad habit on my side15:26
Chipacasounds like an argument against charmcraft supporting 'full' requirement.txt15:27
Chipaca:-/15:27
* Chipaca oh noes15:27
ballotsorry :/15:27
Chipacafacubatista: maybe we should detect and fail early or with a clearer message15:27
ballotChipaca: does charmcraft support constraints files ?15:28
Chipacaballot: no15:28
facubatistaChipaca, let's use fades, that doesn't support "-e" :p15:28
Chipacaballot: but not because of philosophical reasons, just nobody's asked us :-)15:29
ballotChipaca: well, "priorities" :)15:30
ballotChipaca: I'm not sure it's worth spending time on it right now. The only use case I see is if the application code and charm are hosted on the same repository, then to limit in one place some module version for the app, the charm and the tests, it's better to use constraints rather than repeating the limitation in all requirements.txt15:31
Chipacak15:33
Chipacai need to step out (physio! here's hoping for a better back)15:33
ballotChipaca: np, thanks !:15:35
ballotMy tests are running now :)15:35
ballot(well failing of course, as one would expect, but for good reasons now)15:35
Chipaca:-D15:45
* Chipaca disappears into the sunset15:45
* facubatista eods21:25

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