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

jamcrodriguez, error should be used sparingly, because it means the charm can't do anything else other than retry the hook that failed05:37
jamso Blocked is much more what you want than Error05:37
jammorning ChanServ07:28
jamChipaca, I mean07:28
stubLast I looked, eggs seemed deprecated for everything, replaced by wheels. https://packaging.python.org/discussions/wheel-vs-egg/08:53
Chipacajam: morning :-)08:56
Chipacai guess the question then is: is there a way to make 'setup.py install' not go eggy?08:56
jamChipaca, isn't that zip_safe=False ?08:58
Chipacajam: that'll install a decompressed egg, which isn't pretty (even though it works)08:58
Chipacaanyway, back to init for me :)08:58
* Chipaca writes systemd in python08:58
Chipacawait no not again08:58
jamChipaca, https://stackoverflow.com/questions/48550546/how-to-install-a-wheel-style-package-using-setup-py08:59
jamseems to say you have to "setup.py wheel; then pip install .whl"08:59
jamthat's pretty ugly user experience08:59
Chipacajam: just 'pip install .' works fine :)09:00
Chipacajam: otoh, 'python setup.py develop' might also work09:01
jamChipaca, indeed. I can certainly switch to that, just is unfortunate that the ingrained method wasn't improved09:01
Chipacai still think dropping an __init__.py in commands is the right thing, for least surprise09:01
jamChipaca, should charmcraft master be calling itself 0.2 ? isn't it 0.3 pre?09:01
Chipacajam: 0.2.0+59.gab2e71e.dirty09:02
jamChipaca, ah, because it is many commits past 0.209:02
Chipacayep09:02
Chipaca59, in this case09:02
jamgood/bad of using git version09:02
jamit doesn't do 'pre' well :)09:03
Chipacacorrect :)09:03
jamI guess you could tag 0.3beta ...09:03
jamChipaca, I think it should know how many more commits you need for 0.3 and then you'd have a nice count down09:04
jamand you'd09:04
jamknow when you're done coding. :)09:04
Chipacajam: I like the way reality looks from where you're standing09:04
jambtw, any comments on charmcraft#90 ?09:04
mupPR charmcraft#90: charmcraft/jujuignore.py: ability to parse .jujuignore <Created by jameinel> <https://github.com/canonical/charmcraft/pull/90>09:04
Chipacajam: i haven't even peeked yet09:04
Chipacai'll do that now09:05
jamChipaca, bind charm chatc?09:30
Chipacad'oh, omw09:30
jambarryprice, https://juju.is/docs/k8s-charms-tutorial mentions having a ports section09:49
jamwhich states "protocol: TCP"09:49
jamI would guess you change that to protocol: UDP09:49
jamI couldn't say off hand if you need both TCP and UDP whether that is 2 separate port declarations, 2 separate protocol declarations, or something like "protocol: TCP,UDP"09:50
barrypricejam: yup, that's actually what I have here, I will see how that goes - if it's that simple then great09:50
barrypricemy assumption was two declarations but I'll play around with it09:50
jambarryprice, Ports        []ContainerPort `json:"ports,omitempty" yaml:"ports,omitempty"`09:52
jamports is a list, but protocol is just a string.09:52
jamstill not sure09:52
jambarryprice, the k8s docs seem to say that UDP support depends on the cloud, and nginx as an ingress controller has some confusing discusison09:54
jamhttps://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/09:54
jamI think you noted that it was part of a ConfigMap of the ingress service, which seems a bit surprising09:55
barrypricejam: yup, that's the page that sent me looking into how to set a ConfigMap09:56
barrypricethe second example on that page is for UDP/5309:56
jambarryprice, if I understand that page correctly, the main problem is that you need to change the ConfigMap of some other service in response to you deploying *your* service.09:56
jameg, that is having NGINX running as the ingress controller listen on 53 so that it can proxy for the actual application behind it09:57
jambarryprice, I would certainly just start with a port declaration for protocol: UDP and then see where that gets you09:58
barrypricejam: will do, hopefully get something working in the next hour before I EOD, I'll let you know09:59
barrypricekeep finding silly bugs in the image, and have to rebuild each time - hopefully this round10:27
barrypricejam: ok that works for me locally with microk8s10:30
barrypriceApp   Version  Status  Scale  Charm     Store  Rev  OS          Address         Notes10:30
barrypricebind           active      1  bind-k8s  local    8  kubernetes  10.152.183.19710:31
barrypriceUnit     Workload  Agent  Address     Ports          Message10:31
barrypricebind/9*  active    idle   10.1.68.21  53/TCP,53/UDP  Pod configured10:31
barrypriceand from a terminal on my laptop, outside the pods, "dig @10.152.183.197 ubuntu.com" gives me a correct result10:31
Chipacajam, facubatista, should we skip the bug revue today?10:32
jamChipaca, either way for me10:32
Chipacahuh, charmcraft tests don't run here now10:42
Chipacajam: do they work for you, on charmcraft master?10:47
jamChipaca, they pass on my branch, I'll check master10:57
facubatista¡Muy buenos días a todos!10:58
Chipacafacubatista: 👋10:59
jammorning facubatista11:00
jamChipaca, so I had to update my dependencies for master11:00
jambut once I did that, the tests passed11:00
Chipacafacubatista: charmcraft tests on master don't work for me (E   ModuleNotFoundError: No module named 'tests.factory') and was wondering if i needed to do anything11:00
facubatistado you have a tests/factory.py file?11:01
jamI d11:01
jamo11:01
Chipacai do11:01
Chipacaand i can import it11:01
Chipacaby hand from a python running from the same place i run the tests11:02
jamChipaca, want to come by the bug review hangout and we'll chat on it?11:02
Chipacasure11:02
Chipacajam, facubatista, https://docs.pytest.org/en/latest/pythonpath.html#pytest-vs-python-m-pytest11:26
jamChipaca, which as I read it says "put an __init__.py and things will work" :)11:30
Chipacathere's also a strong recommendation of using src/11:30
Chipacabut that doesn't fix my issue :-/11:30
Chipaca--import-mode=importlib fixes all my woes \o/11:33
jamChipaca, https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure seems to say the advantage is that you have to install in order to do tests11:33
jamI find that extra step to be a bit onerous to a code test code test code test lifecycel11:34
jambuild in place is pretty good11:34
Chipacayeah11:34
Chipacaalso 2014 is SO six years ago11:34
jamChipaca, it also explicitly breaks your version.py cheats11:34
Chipacaunfortunately --import-mode=importlib requires pytest 611:35
jamChipaca, and they say "use tox" but my explicit problem with tox is the 10+s it adds to each test iteration11:35
Chipacaand this is all because the init templates include a 'tests' directory, btw11:35
Chipacaalso, there's a test in charmcraft that looks at the flags that are used to run the test instead of .. something else? but maybe that's a 6.0 breakage, looking11:38
Chipacano, this is test breakage11:40
Chipacafacubatista: :-(11:40
Chipacafacubatista: if you run pytest with any flags at all, they're passed straight in to e.g. test_main_no_args11:41
Chipacaand fail11:41
Chipacafacubatista: e.g., python -m pytest --log-auto-indent=on11:42
* facubatista is trying to understand these lines11:43
Chipacafacubatista: ╌╼╍╾╌╼╍╾╌╼╍╾╌╼╍╾╌11:45
* Chipaca helps11:45
facubatistaChipaca, I don't see how is possible to happen what my eyes are seeing; if you still need my help let's HO11:57
Chipacafacubatista: osm ho now tho11:59
Chipacadavigar15_: trying to 'charm push' a .charm doesn't immediately tell me to do one so maybe it'll work? i don't have the right credentials to try :)12:23
Chipacafacubatista: can we have a meet12:23
Chipacafacubatista: (standup)12:24
Chipacafacubatista: "tan"12:28
facubatista:)12:29
* Chipaca enquires about lunch12:32
crodriguezjam: I understand that, but there are some cases where you need the charm to be in error. It's also a lot easier to troubleshoot because error gives you access to the debug-hooks and resolve actions.13:34
jamcrodriguez, sure. if you need error, by all means use it, just realize the implications13:35
crodriguezjam: yeah it's for a specific case. So I think a class "ErrorStatus" should be added to ops.model13:39
jamcrodriguez, you can always raise an exception.13:39
jamJuju doesn't let us set Error status13:39
jamit only happens as a result of exit nonzero13:39
crodriguezyes it does.. well it was an option in the reactive framework at least13:39
jamI'll double check13:40
crodriguezI'll dig to see how it was done in reactive13:41
Chipacajam: ah! (?s:<regexp>) is new in 3.613:46
Chipacajam: you want (?s)<regexp>13:46
jamChipaca, or I can just set the flag on the compile13:47
jamChipaca, do you prefer having it in the regex?13:47
Chipacai prefer having it in a flag :)13:47
jamChipaca, also adding a test for paths with '\n' in them if we want DOTALL to be set13:49
jam(which fnmatch did, so I'm following suit)13:50
jamcrodriguez, $ juju run --unit ubuntu-lite/0 'status-set error flobar'13:52
jamERROR invalid status "error", expected one of [maintenance blocked waiting active]13:52
jamI'm not sure how reactive was handling error, but it isn't allowed by status-set13:53
jamIt may be that we can call 'status-set blocked message' and then raise an exception to return nonzero13:53
jambut we'd need a reasonable mechanism13:53
crodriguezjam: alright yeah maybe they did a workaround for that. I can settle for a blocked status for now to do what I need to do, thanks for double-checking13:54
jamlooking here: https://github.com/juju/charm-helpers/blob/master/charmhelpers/core/hookenv.py#L6214:00
jamand here:https://github.com/juju/charm-helpers/blob/master/charmhelpers/core/hookenv.py#L112314:00
jamit seems that using error would just raise a ValueError14:00
jamunless I'm reading it wrong14:00
jam(or the code has changed in the meantime)14:01
facubatistajam, .jujuignore rules are pretty much the same ones than .gitignore, right? https://git-scm.com/docs/gitignore#_pattern_format15:14
jamfacubatista, they were modeled after them, yes15:24
* Chipaca runs the tests against the 'charmcraft init'-generated code and wonders if it's enough meta-programming16:12
Chipacawhy don't pathlib.Path objects have a chdir() that's a context manager?16:19
Chipacaas in: with tmp_path.chdir(): …16:20
facubatistaChipaca, meeting?16:30
Chipacaoops16:31
Chipacafacubatista: for the sys.argv thing, are you fixing that or should I?17:14
Chipacafacubatista: I need to pass arguments to pytest now, how would you prefer I did that?17:14
facubatistaChipaca, if you fix the sys.argv thing, you can pass args to pytest, right?17:15
Chipacafacubatista: yes, from run_tests17:15
facubatistaChipaca, the fix is just removing the sys.argv default from the function definition, right?17:15
Chipacafacubatista: yes17:15
facubatistayou can include that in your branch17:15
Chipacafacubatista: i can push a pr to do just that17:15
Chipacaor i can include it, indeed17:15
Chipacaok17:16
facubatistathanks17:16
Chipacabrb (gpg agent died, easiest way to get it back is restarting the session)17:34
Chipacafacubatista: https://github.com/canonical/charmcraft/pull/91 fwiw17:46
mupPR charmcraft#91: First pass at 'charmcraft init' <Created by chipaca> <https://github.com/canonical/charmcraft/pull/91>17:46
facubatistawee17:46
Chipacaand i'm off to make dinner & etc17:46
Chipacattfn17:46
facubatistaack17:46
facubatistaChipaca, please remember https://github.com/canonical/charmcraft/pull/8918:46
mupPR charmcraft#89: Store release <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/89>18:46
facubatista(and I think there's a problem with Travis... that PR is not listed at all in https://travis-ci.org/github/canonical/charmcraft/builds )18:47
* facubatista eods20:42

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