[08:30] <oscar0> Can I ask, does anyone know how to set version number in a charm developed with the operator framework? The version number for the charm should be visible when typing "juju status".
[08:36] <oscar0> I'm looking for a way to set the version number in a charm developed using operator so that it is visible when typing "juju status"
[08:47] <bthomas> oscar0: jam and Chipaca may be able to give you a more authoritative answer. Here is a hack. How about setting the version string as the message passed to ActiveStatus() .
[08:48] <Chipaca> oscar0: is the "version" file picked up automatically by juju for a default status message or something?
[08:49] <Chipaca> we have an issue about creating a "version" file in the charm, but I thought that was just for the store
[08:49] <oscar0> thanks bthomas and Chipaca. I will try those things today.
[11:02] <oscar0|afk> the "version" file approach does not work.
[11:03] <oscar0|afk> App                       Version  Status   Scale  Charm                     Store       Rev  OS      Notesmycharm                            active       5  mycharm                   local         0  ubuntu
[11:03] <oscar0|afk> the second field is where it would be good to have a version number, but I don't know how to set it there :)
[11:16] <Chipaca> oscar0: did you try the ActiveStatus("your version here") approach?
[11:18] <oscar0> Chipaca: I will try it now
[11:19] <oscar0> Chipaca: Is this the way you suggest to use it:
[11:20] <oscar0> self.unit.status = ActiveStatus('version')
[11:21] <Chipaca> oscar0: do you want to set it there, or do you want to set the application version?
[11:21] <oscar0> application :)
[11:21] <oscar0> self.app.status?
[11:21] <Chipaca> oscar0: self.unit.set_workload_version(...) might actually be what you want
[11:21] <oscar0> Chipaca: I will try it
[11:21] <Chipaca> oscar0: FWIW set_workload_version takes a string
[11:22] <Chipaca> oscar0: and that will be shown in 'juju status' automatically
[11:22] <oscar0> sweet, trying it out right now
[11:22] <Chipaca> oscar0: i probably should have realised this was what you wanted earlier, sorry for the runaround :)
[11:23] <oscar0> no problem :)
[11:26] <oscar0> it worked, thanks Chipaca!
[11:26] <Chipaca> \o/
[11:26] <oscar0> love this channel! :)
[11:27] <oscar0> but what is the actual purpose of the 'version' file? is it only relevant for the charm store?
[11:30] <jam> bthomas, oscar0 : I think you are looking for Unit.set_workload_version()
[11:31] <jam> ah, chipaca already found that for you
[11:32] <oscar0> yep!
[11:49] <Chipaca> oscar0: the version file is something we're wanting to add so that the store can show it to the user as they browse that
[11:49] <Chipaca> oscar0: 'charm upload' did that automatically, 'charmcraft build' does not yet
[11:50] <Chipaca> or is it 'charm push'
[11:50]  * Chipaca gets confused with snapcraft too much
[11:51] <oscar0> Chipaca: okay, I understand
[11:51] <oscar0> thanks!
[11:51] <Chipaca> oscar0: np! happy charming
[11:52] <bthomas> I understood the requirement as displaying Charm version in status not Version of application deployed by Charm. jam thanks for clarifying.
[11:54] <jam> Chipaca, I thought 'upload' was the new 'push'
[11:55] <Chipaca> jam: that's what they want you to believe, man
[11:55] <jam> 'version' is a way to encode the VCS version of the charm, so that people who work with stores and offline charms can know that it is actually the same charm
[11:55] <jam> Its the "back link to the source"
[12:04] <Chipaca> fwiw we have charmcraft#37 and charmcraft#159
[12:04] <mup> Issue charmcraft#37: Populate the 'version' file as part of 'charmcraft build' <build> <Created by jameinel> <https://github.com/canonical/charmcraft/issues/37>
[12:04] <mup> Issue charmcraft#159: Snapcraft-style version metadata handling <Created by devec0> <https://github.com/canonical/charmcraft/issues/159>
[15:08] <mup> Issue operator#390 closed: Only one role allowed <Created by camille-rodriguez> <Closed by camille-rodriguez> <https://github.com/canonical/operator/issues/390>
[15:18] <Chipaca> have i mentioned before how slow the unit tests are on windows
[15:58] <jam> Chipaca, that's because it is all python startup overhead and not bash, right? Is it plausible to cut down the set of things that need to be run on Windows?
[15:59] <Chipaca> jam: i think it's just exec overhead on windows, but i'm not sure
[15:59] <Chipaca> jam: this is without the everything-is-python-now change
[15:59] <Chipaca> but there's a .bat that calls bash, for fake_script
[16:00] <Chipaca> the alternative is to call subprocess.run with shell=True which is just as slow and more insecure
[16:00] <Chipaca> (granted in tests the latter shouldn't be an issue)
[16:01] <Chipaca> ie fake_script('foo', ...) creates the regular foo bash script, and a foo.bat that does bash.exe foo %*
[16:41] <crodriguez> hello hello
[16:42] <crodriguez> so I was using self.framework.model.unit.is_leader() , and someone told me now it's better to use self.model.unit.is_leader() ? Are we getting rid of the "framework" in all calls?
[16:42] <crodriguez> what about self.framework.model.unit.status , should I switch to self.model.unit.status as well ?
[16:46] <Chipaca> crodriguez: it's only better in that it's shorter :)
[16:46] <Chipaca> crodriguez: it's the same
[16:47] <Chipaca> crodriguez: actually i would write self.unit.is_leader() directly
[16:47] <crodriguez> alright, so from what I see in the docs, anytime I'm calling model I can drop the framework ahead of it
[16:47] <Chipaca> crodriguez: crodriguez: CharmBase has app, unit, meta, and charm_dir all proxied to the appropriate places
[16:47] <crodriguez> ok cool, thank you
[16:48] <Chipaca> wrt status, self.unit.status and self.app.status, as appropriate 🙂
[16:50] <Chipaca> crodriguez: fwiw 'self.model' won't work unless you've done that yourself :)
[16:50] <Chipaca> anyhoo. i'm off
[16:53] <jam> @Chipaca, where do you get bash from on Windows?
[19:43] <Chipaca> jam: it comes with git
[19:44] <Chipaca> jam: https://gitforwindows.org/
[19:44] <jam> Chipaca, what are you doing back? go away :)
[19:44] <Chipaca> jam: just got back from walking the dog and buying dinner
[19:44] <jam> cheers
[19:44] <Chipaca> (boys are with their mum)