=== Dmitrii-Sh9 is now known as Dmitrii-Sh
xavpaiceis there a current documentation repo for making fresh shiny new charms using charmcraft?  Other than the obvious readme in the repo (which is really good), there was some stuff on discourse which is somewhat out of date now given that we're not doing submodules and so on06:18
Chipacabthomas: gooooooooooooooooooooood  morning!08:18
bthomasMorning Chipaca08:20
bthomasChipaca: I may have a couple (probably more) questions today. I will try and type them here. Do you prefer I ask you in the morning or post lunch ?08:21
bthomasThis is for the hook documentation.08:21
Chipacabthomas: why wait :)08:21
bthomasAwesome thank you.08:21
Chipacaask them now, and i'll answer when and if i'm able :)08:21
Chipacairc is async \o/08:21
Chipaca(less async than email, but hey)08:21
bthomasOk. I like to dig a bit before asking. So it will be intermittent through the day.08:22
Chipacaplease don't wait to ask 🙂 better wait for me to reply than that08:23
bthomasChipaca: I will number questions through the day. This is Q1) What is the operator interface for a leader to set some key/value pair ? (i.e. what is the equivalent of "leader-set" from the reactive world). Same question for "leader-get"09:07
bthomasI am reading this reactive docs for leadership api : https://discourse.juju.is/t/implementing-leadership/112409:09
bthomasChipaca: Q2): I am going through the Hook Context and Tools docs at https://discourse.juju.is/t/the-hook-environment-hook-tools-and-how-hooks-are-run/1047 . How much of this is still valid in the operator framework ? For instance are all the environment variables (including relation variables) and hook tools still available to Operator Charm hooks ?09:37
Chipacabthomas: leader-get and -set are not implemented by operator. I think (but would like jam to confirm) that it's because we haven't yet found a use case that wouldn't be better served by setting data on the peer relation.10:15
Chipaca(that's for Q1)10:16
bthomasGot it. Thanks.10:17
Chipacabthomas: re Q2, the hook environment and tools are what operator builds on to present the interface that it does to charmers. There shouldn't be a need to use things from the lower level, but they're there if needed (and if we see it being needed, we would typically model it inside operator somehow)10:17
Chipacabthomas: munging Q1 and Q2, the pgsql interface uses leader-set and -get to poke at leader data directly (we think it would be better done on the peer relation, and that's part of an ongoing conversation)10:18
bthomasChipaca: In view of your answer to Q2 it sounds prudent to hide these lower level interfaces and not expose them in Charmhub documentation, thereby discouraging their use. I shall adopt this approach for now and followup with jam and jldev, regarding their viewpoint on the matter.10:24
facubatista¡Muy buenos días a todos!11:12
facubatistaxavpaice, did you check this tutorial? https://discourse.juju.is/t/how-to-build-a-charm-using-modern-tools/324611:16
mupPR operator#401 closed: fix docstring on Harness.add_relation_unit WRT events <Created by chipaca> <Merged by chipaca> <https://github.com/canonical/operator/pull/401>12:26
bthomasChipaca: Your response to Q1 implies that only Juju decides which unit is leader. A Charm can not decide this. Correct me if I am wrong here.12:27
Chipacaah, the problem with "do X if Y" is that ¬Y means I can do *anything* :-D12:28
bthomasIndeed. But Charm can not set leadership since it has no means to trigger and leader_elected event or leader_settings_chagned event.12:30
Chipacabthomas: electing leadership is beyond the abilities of the proles^Wcharms12:33
bthomasOk thanks. I get it quorum sensing, paxos and the like, is stuff a charm would rather leave to Juju :-).12:34
bthomasI asked the question because the discourse hook doc linked above suggests a Charm may decide if a unit is the leader, in the leader-elected doc lines (quoted) "If the election process is done internally to the application, other code should be used to signal the leader to Juju."12:38
Chipacabthomas: that's the application deciding it's the leader, not the charm12:39
bthomasChipaca: In that case, the differences between an application deciding its leader and the units deciding their leader is not obvious. It is not clear if and why a cham needs to be aware of or respond to an "applications electing leader".12:44
Chipacabthomas: I don't follow12:44
bthomasChipaca: I was just explaining why I asked the question if we can assume that only Juju decides the leader unit. I pointed out that the current charm hook docs suggest that "application" may make the leadership decision "internally" . I interpreted your response as meaning leadership among units is different from leadership within the application. I did not understand this response and was trying to probe it further.12:48
Chipacabthomas: in the normal case, juju decies who the leader is, and sends an event to the charm to that effect, and the charm reconfigures the application (or whatever is needed to implement "you be the leader now")12:49
bthomasGot it . Thanks.12:49
Chipacabthomas: in some cases instead the application itself decides who the new leader is, and needs to arrange some way to tell juju12:49
Chipacabthomas: this way does not involve the charm12:49
bthomasChipaca: Ah I see now. Do we need to document this, if it does not involve the Charm ?12:50
Chipacano, i don't think we do12:51
bthomasgreat thank you.12:51
Chipacabthomas: could i get a review of https://github.com/canonical/charmcraft/pull/150 ?13:20
mupPR charmcraft#150: when failing to create hard link attempt to use shutil.copy2 <Created by matuskosut> <https://github.com/canonical/charmcraft/pull/150>13:20
bthomasChipaca: will do13:20
bthomasChipaca: Q3) Since a Charm is expected to use relation data rather than setting leader data, only one use case remains for the "leader_settings_changed" event. This is the use case of notifying the current leader, that it will no longer be the leader. Is this correct ? However soon after this event, one would also expect a "leader_elected" event to also invariably fire, when the new leader is elected. Can I hence say, that the 13:33
bthomasof the leader_settings_chagned event is solely, for a leader to do, what needs to be done, in order to relinquish leadership.13:33
* bthomas goes to make some coffee13:35
Chipacahuh, first time i've seen "* Chipaca has quit (Ping timeout: 240 seconds)" myself13:54
=== majduk__ is now known as majduk_
=== karimsye_ is now known as karimsye
=== nicolasbock_ is now known as nicolasbock
* Chipaca brb14:06
Chipacai'm off for now (run + dinner + etc), will bb(much)l16:56
facubatistaChipaca, jam, a pattern I've seen a lot is this (quite useful) sequence:20:06
facubatistamsg = "whatever we want to communicate"20:06
facubatistaself.unit.status = MaintenanceStatus(msg)20:06
facubatistaI wonder if we could provide a shortcut for that20:06
facubatistamaybe something like `self.unit.status = MaintenanceStatus(msg, log=True)` (or even log by default)20:07
jamfacubatista, I know 'juju show-status-log' will tell you about the various value the status went through, but it doesn't appear in the default log messages20:20
jamChipaca or facubatista  in case bthomas comes back, it feels like he has it backwards. leader_settings_changed notifies *non* leaders that the settings have changed, leader_elected is telling the unit that they are now the leader.20:22
facubatistajam, thanks20:27
Chipacajam: ah, thanks. I'll let him know in the morn.21:35

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