[00:04] <cmars> anastasiamac, can I get a review of http://reviews.vapour.ws/r/3385/diff/# ?
[00:05] <cmars> sorry, wrong channel
[00:50] <cholcombe> marcoceppi, i think string is fine.  just wondering if it'll be weird for people wanting to enter an int for the same field
[00:57] <anastasiamac> cmars: looking
[00:58] <anastasiamac> cmars: lgtm \o/
[04:07] <blr> does anyone have any thoughts on the best way to manage state in between hook runs? (other than updating the juju config)?
[04:13] <blr> or alternatively, is there any way to introspect which hooks have run, assuming juju maintains that state?
[14:42] <lazypower> blr are you using the traditional charming method or are you working with reactive?
[14:44] <marcoceppi> lazypower: we should just start calling it "Classic Charming"
[14:44] <lazypower> hmm, ok
[15:38] <lazypower> marcoceppi: bruzer and I are talking about the path forward with k8's. We've reached feature parity with our existing charms, and are thinking about deprecating.  The thing is, the older charm shares less than 10% of what the current charms do.. so we cant really deprecate any existing deployed systems
[15:39] <lazypower> are we forced into waiting for a series change to promote the new charms?
[15:39] <lazypower> its in a namespace, so we can be shifty if required
[15:40] <mbruzek> marcoceppi: The old charms are only in a personal namespace so I believe we can deprecate the old charms and replace them with the new k8s charm
[15:41] <marcoceppi> deprecate away, it's personal namespace
[15:41] <lazypower> welp
[15:41] <lazypower> here goes something :)
[16:29] <cfx> mbruzek: I'm in a meeting right now so I haven't had time to really go in-depth yet... but the commit looks really good from what I've read so far!
[16:29] <mbruzek> cfx: Thanks! I am working on event cycle now
[16:29] <cfx> awesome. :)
[16:30] <cfx> I hope to get through the next section -- and review today's changes -- later on this evening. My Juju work is primarily outside of office hours for now.
[16:31] <mbruzek> cfx thanks again for the feedback and the detailed review
[16:31] <cfx> my pleasure sir
[16:44] <lazypower> axw_ : storage hooks run before install, correct?
[16:55] <beisner> thedac, requesting a cross-review if you will ... see my final comment @ https://code.launchpad.net/~pjdc/charms/trusty/rabbitmq-server/no-more-guest-user/+merge/276831
[16:55] <thedac> beisner: I'll take a look shortly
[16:56] <beisner> thedac, much thanks.  actually last 2 comments.  i shifted my position slightly.
[17:00] <Prabakaran> Hello Team, I am writing ibm java sdk layer charm, Reactive deployable charm contains auto generated config-changed hook which is written on python. It has some pre-written code as well… So to make use of the EULA value getting from config.yaml file in the decorated pattern, I will have get value from config.yaml file in the config-changed hooks.
[17:00] <Prabakaran> I will have to include the below code in the config-changed hook….can anyone please help me how to insert the below line of codes in the link..  http://paste.ubuntu.com/14006238/
[17:01] <Prabakaran> @hook('config-changed')
[17:01] <Prabakaran> def config():
[17:01] <Prabakaran>      accepted = hook.config().get('accept-ibm-javasdk-license')      if accepted = False:          set_state("license.accepted')     else:         set_state("license.not.accepted')
[17:08] <kwmonroe> hey Prabakaran, in the reactive model, you no longer have to worry about writing individual hooks.  the 'charm build' process will create the correct hook for you. you should instead focus on the state of the charm to do your logic.
[17:09] <kwmonroe> so in your case, in your ./reactive/<source> file, you probably want:
[17:09] <kwmonroe> @when 'java.connected'
[17:09] <kwmonroe> @when_not 'java.installed'
[17:09] <kwmonroe> function do_something() {
[17:09] <kwmonroe>   if check_eula() == good; install()
[17:09] <kwmonroe> }
[17:10] <kwmonroe> you can get an idea of the install procedure with the openjdk reactive charm:
[17:10] <kwmonroe> https://github.com/juju-solutions/layer-openjdk/blob/master/reactive/openjdk.sh#L18
[17:10] <kwmonroe> i would start with that source and simple add the eula check just before the actual install.
[17:12] <Prabakaran> Hi kwmonroe, Good Morning... How to have a check for the value getting from the config.yaml file in the decorated pattern. Like i am facing a scenario wherein i will have to get EULA value from the user as True or False. If EULA value which I am getting it from config.yaml file is true i will have to install IBM java SDK else it will uninstall the product. So I have used something like that, it was not working. Can you please suggest
[17:12] <Prabakaran> javasdk_license_accepted=`config-get accept-ibm-javasdk-license` @when 'java.connected' 'java.installed' '$javasdk_license_accepted== 'False'
[17:13] <kwmonroe> Prabakaran: see the config check for 'install-type' on the openjdk charm: https://github.com/juju-solutions/layer-openjdk/blob/master/reactive/openjdk.sh#L21
[17:13] <kwmonroe> you would do the same, but instead of 'install-type', make it 'accept-ibm-javajdk-license'
[17:14] <kwmonroe> then see the conditional for openjdk: https://github.com/juju-solutions/layer-openjdk/blob/master/reactive/openjdk.sh#L29
[17:14] <kwmonroe> do something similar, if accept-ibm-license == True, apt-get install ibm-java; else, apt-get remove ibm-java.
[17:15] <Prabakaran> i have impletmented in that same way but.. If EULA value which I am getting it from config.yaml file is true i will have to install IBM java SDK else it will uninstall the product.
[17:16] <kwmonroe> ok cool - that sounds right
[17:16] <mbruzek> Hello Prabakaran welcome back.  When you say it was not working can you explain ?
[17:16] <kwmonroe> Prabakaran: perhaps a link to your reactive source so we can take a look?
[17:18] <Prabakaran> i was just explaining the scenario what i am facing to kevin...  As discussed with u .. i was tryin to get EULA value from config.yaml file in the config-changed hook
[17:18] <Prabakaran> like that
[17:18] <Prabakaran> but Reactive deployable charm contains auto generated config-changed hook which is written on python. It has some pre-written code as well… So to make use of the EULA value getting from config.yaml file in the decorated pattern, I will have get value from config.yaml file in the config-changed hooks.
[17:19] <Prabakaran> @hook('config-changed') def config():      accepted = hook.config().get('accept-ibm-javasdk-license')      if accepted = False:          set_state("license.accepted')     else:         set_state("license.not.accepted')
[17:20] <Prabakaran> my actual config-changed hooks is http://paste.ubuntu.com/14006238/
[17:20] <Prabakaran> so i will have to set_state in here..
[17:21] <mbruzek> Prabakaran: OK what you have in the paste bin is a generic python charm hook that allows the system to run the reactive code.
[17:22] <mbruzek> Prabakaran: you should not edit the config-changed file in this case.  You can decorate a config-changed hook.  Or as kevin pointed out, the charm code can react to different states and check the configuration value at those times.
[17:23] <Prabakaran> k .. thn so i will have to include this in reactive/install.sh file?
[17:23] <mbruzek> Prabakaran: so this pastebin was config-changed, but what does your reactive/install.sh look like?
[17:23] <Prabakaran> http://paste.ubuntu.com/14005951/
[17:25] <mbruzek> let me ask you Prabakaran is it a requirement to uninstall the java if they decline the license?  I know this is a time-honored convention for IBM charms, but is this a requirement?
[17:26] <mbruzek> Prabakaran: If it is not a requirement to uninstall, we could simply this code to only install when/if they accept the license, after that the user can not change their mind, and reject the license
[17:27] <Prabakaran> ya we need to uninstall the product if the EULA is FALSE
[17:28] <mbruzek> Prabakaran: OK understood.
[17:28] <thedac> beisner: A few things. One, this MP needs to be against next. Two, after NotImplementedError we cannot assume no clustering for juju < 1.23. Three, +1 to needing tests although that may fall to you to implement :). Do you want these comments on the MP?
[17:28] <Prabakaran> Outside of decorated pattern.. i have written like that..
[17:28] <Prabakaran> if [ $javasdk_license_accepted == "True" ]; then set_state 'license.accepted' else set_state 'license.not.accepted' fi
[17:29] <mbruzek> Prabakaran: OK what is not working then?
[17:30] <beisner> thedac, thx, i've got it.  i just got so excited to have tests complete!
[17:30] <thedac> ha
[17:31] <Prabakaran> As discussed with u.. i thought i will have to get config values from config-changed hook... that is where i confused..now i am clear ...
[17:32] <Prabakaran> i will deploy and test my code... and come back if i have any doubts... thank u all for ur help...
[17:33] <mbruzek> Prabakaran: You showed me the generated config-changed hook, but you can implement a bash layer of the config-changed hook in your install.sh file if you need to
[17:34] <mbruzek> the reactive.main() method will invoke functions with @hook 'config-changed' at the appropriate times
[17:34] <mbruzek> when configuration changes
[17:34] <mbruzek> Prabakaran: let me or kwmonroe know if you have any further questions after testing.
[17:34] <beisner> thedac, ps fyi, following the cdo-qa sprint, this guy right here will be taking a strong stance on tests-should-accompany-changes-or-additions. ;-)   as much as i do enjoy that part, i can easily get sucked into writing test coverage for features that others land (or more likely/dangerous:  not add test coverage for a feature that someone has landed).
[17:35] <thedac> +1. I'll back you up on that.
[17:36] <beisner> thedac, so i understand the other thing raised on that mp ... so the concern is that this assumes LE?
[17:36] <marcoceppi> jhobbs: the django layer has a bit of support for python3, it was made to support this: https://code.launchpad.net/~ubucon-site-developers/ubucon-site/ubucon-layer so there's room to grow it
[17:36] <jamespage> cory_fu, lazypower: hey - so what do you find your 'final layer' charm source repo is looking like?
[17:37] <thedac> beisner: Right. Which I go back and forth on whether that is acceptable.
[17:37] <jamespage> our first versions as not the charm per say, but the bits to make the charm
[17:37] <beisner> thedac, err nvm.   i grok.
[17:38] <thedac> beisner: and in this case we cannot use the legacy is_newer() because that assumes it is in a relation hook.
[17:38] <jhobbs> marcoceppi: oops, was talking in other room
[17:38] <jhobbs> marcoceppi: ok, i'll go with mine for now just to get everything working and then come back and look into yours more
[17:39] <Prabakaran> ya sure <mbruzek>
[17:39] <marcoceppi> jhobbs: no worries, this just does gunicorn and django. It calls pip isntall for gunicorn and the pip should be determined by what the user put int he parent layer
[17:39] <marcoceppi> jhobbs: IE, pip: '/usr/bin/php3' would get you a python3 gunicorn
[17:40] <blr> lazypower: this is a 'classic' charm (not one I've written) unfortunately.
[17:40] <jhobbs> marcoceppi: how's that work? You're calling 'pip' directly from the OS
[17:40] <marcoceppi> jhobbs: it's a bug
[17:40]  * lazypower reads backscroll - sorry blr  i lost context 1 sec
[17:41] <lazypower> blr ah!
[17:41] <blr> lazypower: throwing the state in juju config would certainly work, it just seems a bit ugly.
[17:41] <lazypower> so if you need to manage local state in a classic charm, use the charmhelpers.unitdata.kv storage helper
[17:41] <marcoceppi> jhobbs: line 49 should be doing what;s in this line: https://github.com/marcoceppi/layer-django/blob/master/reactive/django.py#L143
[17:41] <blr> this charm isn't even using charmhelpers :(
[17:41]  * marcoceppi patches
[17:41] <lazypower> its specific to the unit, and gives you a consistent interface to store data.
[17:41] <lazypower> blr: thats a simple import away though :)
[17:42]  * marcoceppi writes an email to the list to announce the layer so it has more visibility
[17:42] <jhobbs> cool, well i'm glad i know about it now; i checked on the site when i started this but that was more than two weeks ago
[17:42] <beisner> thedac, thx, re-commented.  reviewed as re-submit.
[17:42] <jhobbs> thanks for the heads up
[17:42] <blr> lazypower: true, it is just going to make our eventual diff for upstream require more explanation, but that's okay.
[17:42] <lazypower> blr: which charm?
[17:42] <blr> lazypower: thanks, that kv store sounds perfect
[17:42] <blr> lazypower: squid-forwardproxy
[17:42] <lazypower> aahhh ok.
[17:43] <blr> it really should be rewritten
[17:43] <lazypower> layers are a thing :)
[17:43] <blr> right
[17:43] <lazypower> having a squid-common layer, then a layer for the different proxy types would be stellar
[17:43] <blr> it would!
[17:45] <lazypower> it would certainly ease your maintenance burden... might be worth the effort if you have the project scope to do it blr
[18:33] <Prabakaran> Hi <mbruzek>, Unfortunately uninstallation part was not getting called while setting EULA value to False.
[18:33] <Prabakaran> First I deployed my charm and set EULA value to true. Installation was successful.
[18:34] <Prabakaran> I have written codes for install and uninstall decorated method in this link http://paste.ubuntu.com/14031988/  .. please correct me if I am wrong…
[18:42] <cory_fu> jamespage: Sorry, was on a call.  I'm not sure I understand your question?
[18:45] <cory_fu> Prabakaran: Your "else" condition should instead be this:
[18:45] <cory_fu> remove_state 'license.accepted'
[18:46] <cory_fu> Instead of: set_state 'license.not.accepted'
[18:48] <Prabakaran> k <cory_fu>.. let me change my code and try with this
[18:59] <mbruzek> cory_fu: Prabakaran wants to have a license.not.accepted because he wants to tack action to uninstall in that case
[19:00] <cory_fu> mbruzek: I understand he wants to install when the license is "unaccepted" but what that really means is that "if installed and not license-accepted" do the install.  So, in reactive, that's: @when('java.installed') + @when_not('license.accepted')
[19:01] <cory_fu> mbruzek: So, then, instead of adding a new state for "unaccepted" you would just react to the accepted state no longer being there.  But, then, you have to remove the accepted state instead of adding a new state
[19:02] <mbruzek> cory_fu: Yes I have some pseudo-code here
[19:02] <mbruzek> http://paste.ubuntu.com/14032853/
[19:02] <cory_fu> mbruzek: Did I explain that clearly?
[19:02] <mbruzek> Prabakaran: something like that.
[19:02] <cory_fu> mbruzek: The problem with your code is that you could end up in a situation where *both* states are set
[19:03] <cory_fu> mbruzek: Prabakaran's pastebin was actually closer to correct, save for my one suggested fix
[19:05] <cory_fu> mbruzek: With your code, if the user accepts the license, then ibm.javasdk.license.accepted gets set, and the java installed.  But if they then unaccept the license, then ibm.javasdk.license.declined gets set (but ibm.javasdk.license.accepted is *still* set!) and now both blocks will run!
[19:05] <mbruzek> cory_fu: it was just pseudo-code to show Prabakaran how to decorate a config-changed hook
[19:06] <cory_fu> mbruzek: Yes, but the thing you called out (having a "declined" state) is wrong.  :)
[19:06] <mbruzek> I wrote it while working on something else, so the logic may be off
[19:06] <mbruzek> cory_fu: thanks for pointing that out.
[19:06] <Prabakaran> finally.. got worked out .. my code is running successfully.. Thank u all for the ur help and ur kind support...
[19:07] <mbruzek> Prabakaran: I defer to cory_fu on the reactive logic
[19:07] <cory_fu> mbruzek: Also, while the @hook 'config-changed' wrapper does make it more clear what is triggering that code, it's technically unnecessary.  Without any @something wrapper, the code will *always* execute, which is actually ok for that particular block.
[19:07] <Prabakaran> Thank u so much <mbruzek> , <cory_fu>
[19:07] <cory_fu> Prabakaran: Glad to hear it.  :)
[19:07] <cory_fu> And no problem
[19:08] <lazypower> cory_fu: that technical detail though, is probably not somethign we want ot promote
[19:08] <lazypower> "dont decorate anything, and it runs"
[19:08] <lazypower> i would rather advcoate for having highly detailed charms with decorators as to when something should run
[19:08] <cory_fu> lazypower: I tend to agree, yes
[19:09] <Prabakaran> should i remove @hook 'config-changed' decorator
[19:10] <cory_fu> Prabakaran: It would be better to include it, because it makes your code more self-documenting
[19:10] <Prabakaran> k thanks <cory_fu>
[22:12] <icezimm> lazypower: I made more tests on juju bootstrapping
[22:12] <icezimm> seems the problem was on networks, but still can't solve how to setup correctly
[22:39] <icezimm> lazypower: on juju bootstrap it allocate a machine on MAAS, my private network has internet access because I did these procedures ( http://askubuntu.com/a/499311 ) but containers do not get a public/private ip address according to this gist https://gist.github.com/fernandes/b9196da2d09059f60bdd#file-juju_error-log-L221-L239