/srv/irclogs.ubuntu.com/2015/12/15/#juju.txt

cmarsanastasiamac, can I get a review of http://reviews.vapour.ws/r/3385/diff/# ?00:04
cmarssorry, wrong channel00:05
cholcombemarcoceppi, i think string is fine.  just wondering if it'll be weird for people wanting to enter an int for the same field00:50
anastasiamaccmars: looking00:57
anastasiamaccmars: lgtm \o/00:58
blrdoes anyone have any thoughts on the best way to manage state in between hook runs? (other than updating the juju config)?04:07
blror alternatively, is there any way to introspect which hooks have run, assuming juju maintains that state?04:13
lazypowerblr are you using the traditional charming method or are you working with reactive?14:42
marcoceppilazypower: we should just start calling it "Classic Charming"14:44
lazypowerhmm, ok14:44
lazypowermarcoceppi: 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 systems15:38
lazypowerare we forced into waiting for a series change to promote the new charms?15:39
lazypowerits in a namespace, so we can be shifty if required15:39
mbruzekmarcoceppi: 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 charm15:40
marcoceppideprecate away, it's personal namespace15:41
lazypowerwelp15:41
lazypowerhere goes something :)15:41
=== JoshStrobl is now known as JoshStrobl|Nap
=== ddellav_ is now known as ddellav
cfxmbruzek: 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
mbruzekcfx: Thanks! I am working on event cycle now16:29
cfxawesome. :)16:29
cfxI 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:30
mbruzekcfx thanks again for the feedback and the detailed review16:31
cfxmy pleasure sir16:31
lazypoweraxw_ : storage hooks run before install, correct?16:44
beisnerthedac, 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/27683116:55
thedacbeisner: I'll take a look shortly16:55
beisnerthedac, much thanks.  actually last 2 comments.  i shifted my position slightly.16:56
PrabakaranHello 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
PrabakaranI 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:00
Prabakaran@hook('config-changed')17:01
Prabakarandef 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:01
kwmonroehey 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:08
kwmonroeso 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
kwmonroefunction do_something() {17:09
kwmonroe  if check_eula() == good; install()17:09
kwmonroe}17:09
kwmonroeyou can get an idea of the install procedure with the openjdk reactive charm:17:10
kwmonroehttps://github.com/juju-solutions/layer-openjdk/blob/master/reactive/openjdk.sh#L1817:10
kwmonroei would start with that source and simple add the eula check just before the actual install.17:10
PrabakaranHi 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 suggest17:12
Prabakaranjavasdk_license_accepted=`config-get accept-ibm-javasdk-license` @when 'java.connected' 'java.installed' '$javasdk_license_accepted== 'False'17:12
kwmonroePrabakaran: see the config check for 'install-type' on the openjdk charm: https://github.com/juju-solutions/layer-openjdk/blob/master/reactive/openjdk.sh#L2117:13
kwmonroeyou would do the same, but instead of 'install-type', make it 'accept-ibm-javajdk-license'17:13
kwmonroethen see the conditional for openjdk: https://github.com/juju-solutions/layer-openjdk/blob/master/reactive/openjdk.sh#L2917:14
kwmonroedo something similar, if accept-ibm-license == True, apt-get install ibm-java; else, apt-get remove ibm-java.17:14
Prabakarani 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:15
kwmonroeok cool - that sounds right17:16
mbruzekHello Prabakaran welcome back.  When you say it was not working can you explain ?17:16
kwmonroePrabakaran: perhaps a link to your reactive source so we can take a look?17:16
Prabakarani 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 hook17:18
Prabakaranlike that17:18
Prabakaranbut 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:18
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:19
Prabakaranmy actual config-changed hooks is http://paste.ubuntu.com/14006238/17:20
Prabakaranso i will have to set_state in here..17:20
mbruzekPrabakaran: OK what you have in the paste bin is a generic python charm hook that allows the system to run the reactive code.17:21
mbruzekPrabakaran: 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:22
Prabakarank .. thn so i will have to include this in reactive/install.sh file?17:23
mbruzekPrabakaran: so this pastebin was config-changed, but what does your reactive/install.sh look like?17:23
Prabakaranhttp://paste.ubuntu.com/14005951/17:23
mbruzeklet 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:25
mbruzekPrabakaran: 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 license17:26
Prabakaranya we need to uninstall the product if the EULA is FALSE17:27
mbruzekPrabakaran: OK understood.17:28
thedacbeisner: 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
PrabakaranOutside of decorated pattern.. i have written like that..17:28
Prabakaranif [ $javasdk_license_accepted == "True" ]; then set_state 'license.accepted' else set_state 'license.not.accepted' fi17:28
mbruzekPrabakaran: OK what is not working then?17:29
beisnerthedac, thx, i've got it.  i just got so excited to have tests complete!17:30
thedacha17:30
PrabakaranAs 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:31
Prabakarani will deploy and test my code... and come back if i have any doubts... thank u all for ur help...17:32
mbruzekPrabakaran: 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 to17:33
mbruzekthe reactive.main() method will invoke functions with @hook 'config-changed' at the appropriate times17:34
mbruzekwhen configuration changes17:34
mbruzekPrabakaran: let me or kwmonroe know if you have any further questions after testing.17:34
beisnerthedac, 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:34
thedac+1. I'll back you up on that.17:35
beisnerthedac, so i understand the other thing raised on that mp ... so the concern is that this assumes LE?17:36
marcoceppijhobbs: 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 it17:36
jamespagecory_fu, lazypower: hey - so what do you find your 'final layer' charm source repo is looking like?17:36
thedacbeisner: Right. Which I go back and forth on whether that is acceptable.17:37
jamespageour first versions as not the charm per say, but the bits to make the charm17:37
beisnerthedac, err nvm.   i grok.17:37
thedacbeisner: and in this case we cannot use the legacy is_newer() because that assumes it is in a relation hook.17:38
jhobbsmarcoceppi: oops, was talking in other room17:38
jhobbsmarcoceppi: ok, i'll go with mine for now just to get everything working and then come back and look into yours more17:38
Prabakaranya sure <mbruzek>17:39
marcoceppijhobbs: 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 layer17:39
marcoceppijhobbs: IE, pip: '/usr/bin/php3' would get you a python3 gunicorn17:39
blrlazypower: this is a 'classic' charm (not one I've written) unfortunately.17:40
jhobbsmarcoceppi: how's that work? You're calling 'pip' directly from the OS17:40
marcoceppijhobbs: it's a bug17:40
* lazypower reads backscroll - sorry blr i lost context 1 sec17:40
lazypowerblr ah!17:41
blrlazypower: throwing the state in juju config would certainly work, it just seems a bit ugly.17:41
lazypowerso if you need to manage local state in a classic charm, use the charmhelpers.unitdata.kv storage helper17:41
marcoceppijhobbs: line 49 should be doing what;s in this line: https://github.com/marcoceppi/layer-django/blob/master/reactive/django.py#L14317:41
blrthis charm isn't even using charmhelpers :(17:41
* marcoceppi patches17:41
lazypowerits specific to the unit, and gives you a consistent interface to store data.17:41
lazypowerblr: thats a simple import away though :)17:41
* marcoceppi writes an email to the list to announce the layer so it has more visibility17:42
jhobbscool, 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 ago17:42
beisnerthedac, thx, re-commented.  reviewed as re-submit.17:42
jhobbsthanks for the heads up17:42
blrlazypower: true, it is just going to make our eventual diff for upstream require more explanation, but that's okay.17:42
lazypowerblr: which charm?17:42
blrlazypower: thanks, that kv store sounds perfect17:42
blrlazypower: squid-forwardproxy17:42
lazypoweraahhh ok.17:42
blrit really should be rewritten17:43
lazypowerlayers are a thing :)17:43
blrright17:43
lazypowerhaving a squid-common layer, then a layer for the different proxy types would be stellar17:43
blrit would!17:43
lazypowerit would certainly ease your maintenance burden... might be worth the effort if you have the project scope to do it blr17:45
PrabakaranHi <mbruzek>, Unfortunately uninstallation part was not getting called while setting EULA value to False.18:33
PrabakaranFirst I deployed my charm and set EULA value to true. Installation was successful.18:33
PrabakaranI 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:34
cory_fujamespage: Sorry, was on a call.  I'm not sure I understand your question?18:42
cory_fuPrabakaran: Your "else" condition should instead be this:18:45
cory_furemove_state 'license.accepted'18:45
cory_fuInstead of: set_state 'license.not.accepted'18:46
Prabakarank <cory_fu>.. let me change my code and try with this18:48
mbruzekcory_fu: Prabakaran wants to have a license.not.accepted because he wants to tack action to uninstall in that case18:59
cory_fumbruzek: 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:00
cory_fumbruzek: 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 state19:01
mbruzekcory_fu: Yes I have some pseudo-code here19:02
mbruzekhttp://paste.ubuntu.com/14032853/19:02
cory_fumbruzek: Did I explain that clearly?19:02
mbruzekPrabakaran: something like that.19:02
cory_fumbruzek: The problem with your code is that you could end up in a situation where *both* states are set19:02
cory_fumbruzek: Prabakaran's pastebin was actually closer to correct, save for my one suggested fix19:03
cory_fumbruzek: 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
mbruzekcory_fu: it was just pseudo-code to show Prabakaran how to decorate a config-changed hook19:05
cory_fumbruzek: Yes, but the thing you called out (having a "declined" state) is wrong.  :)19:06
mbruzekI wrote it while working on something else, so the logic may be off19:06
mbruzekcory_fu: thanks for pointing that out.19:06
Prabakaranfinally.. got worked out .. my code is running successfully.. Thank u all for the ur help and ur kind support...19:06
mbruzekPrabakaran: I defer to cory_fu on the reactive logic19:07
cory_fumbruzek: 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
PrabakaranThank u so much <mbruzek> , <cory_fu>19:07
cory_fuPrabakaran: Glad to hear it.  :)19:07
cory_fuAnd no problem19:07
lazypowercory_fu: that technical detail though, is probably not somethign we want ot promote19:08
lazypower"dont decorate anything, and it runs"19:08
lazypoweri would rather advcoate for having highly detailed charms with decorators as to when something should run19:08
cory_fulazypower: I tend to agree, yes19:08
Prabakaranshould i remove @hook 'config-changed' decorator19:09
cory_fuPrabakaran: It would be better to include it, because it makes your code more self-documenting19:10
Prabakarank thanks <cory_fu>19:10
=== JoshStrobl|Nap is now known as JoshStrobl
=== natefinch is now known as natefinch-afk
icezimmlazypower: I made more tests on juju bootstrapping22:12
icezimmseems the problem was on networks, but still can't solve how to setup correctly22:12
=== icezimm1 is now known as icezimm
icezimmlazypower: 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-L23922:39

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