/srv/irclogs.ubuntu.com/2014/11/12/#juju-gui.txt

=== kadams54 is now known as kadams54-away
=== kadams54 is now known as kadams54-away
=== kadams54-away is now known as kadams54
=== kadams54 is now known as kadams54-away
rick_h_morning huwshimi 02:24
huwshimirick_h_: Hey :)02:24
=== urulama___ is now known as urulama
hatchuiteam what's the proper way to test for null config value within a python charm hook? 15:18
frankbanself.assertIsNull(value)?15:19
frankbanhatch: ^^^15:19
hatchfrankban: I mean as a conditional15:19
hatchI need to know if the user has defined a config value or not15:19
hatchso I need to test for null and ""15:19
rick_h_hatch: I'd just check if it's a digit and if it is, then try to use it as a port15:19
frankbanvalue = config.get('my-option'); if value...15:20
hatchrick_h_: int(config.get('...')) ?15:20
hatchbasically the default config value is null (it's actually empty default which juju considers null)15:21
frankbanhatch: if the value is declared as an int on the config.yaml, I am fairly sure that you cannot get another type15:21
rick_h_ah gotcha15:21
hatchok the docs are very confusing then15:21
rick_h_hatch: yea, frankban has it 15:21
hatch  port:15:22
hatch    description: |15:22
hatch      Supply a different port to host the GUI on besides the default 80 and 443.15:22
hatch    type: int15:22
hatch    default:15:22
hatchaccording to the docs that should be null15:22
rick_h_hatch: it depends on juju version and such. There was some work on their end to split up null vs "" and the GUI doesn't respect it currently :/15:23
hatchso I'm trying to make the parser as resilient as possible in the event the user sets it to "" as well15:23
rick_h_hatch: so frankban's idea will work because "" is falsey in python15:23
rick_h_if "": 15:23
rick_h_    print 'false'15:23
rick_h_err true I mean15:23
hatchright, but what is null if it's an int field15:23
kadams54lol15:23
hatchdoes it send "null" ?15:23
hatchor...15:23
hatchI could test it, but testing these hooks is painful :)15:24
rick_h_hatch: try it out :)15:24
rick_h_lxc deploy away!15:24
hatchit's in the install hook 15:24
hatchso I can't really do the hooks debugging15:24
rick_h_log it out what you get and any checks you want15:24
frankbanhatch: I think that value can be either None (the Python spelling for null/nil) or an empty string, and even if it's just 0 (the zero value for integers in Go) that check would still be ok15:25
hatchYAML > Go > JSON > Python 15:26
hatchyay 15:26
hatchlol15:26
rick_h_hatch: never bored :)15:26
frankbanbool(None) == bool('') == bool(0) == False15:26
hatchfrankban: yeah I'm just concerned that it'll send something like "null" which will be truthy15:27
rick_h_frankban: right but he's worried about getitng bool('null')15:27
hatchyeah15:27
rick_h_hatch: just try it 15:27
rick_h_hatch: we're all just guessing for you15:27
hatchyup trying now15:27
hatch:)15:27
frankbanhatch: if you get the string "null" the problem is elsewhere15:27
hatchthe local charm deploy api needs some work :/15:38
hatchinteresting, it fails15:44
hatch        log('default null is')15:45
hatch        log(config['port'])15:45
hatchunit-juju-gui-0: 2014-11-12 15:38:55 INFO start KeyError: 'port'15:45
hatchmaybe charmtools doesn't support null config values15:45
hatcher charmhelpers15:47
hatcherror: invalid value "json" for flag --format: unknown format "json"15:52
hatchuhhh15:52
rick_h_hatch: there was a bug around that a while back. Maybe time to update charmhelpers?15:52
hatchohh - there just may be :)15:53
hatchany idea why that format flag on get doesn't work?15:53
hatchjuju get --format=json juju-gui15:53
hatchthrows that error15:53
hatch_config_get = command('config-get', '--format=json')15:54
hatchthat's in the helpers15:54
hatchso I'm just trying to determine what's failing15:54
hatchor maybe format only works in hooks?15:54
hatch(which would be odd)15:54
rick_h_hatch: right, I'm saying there was a bug I'm trying to find around that15:54
hatch1.20.11-trusty-amd6415:55
rick_h_hatch: that's your juju version? and the charmhelpers version?15:55
rick_h_bah I swear I saw this thing and google is failing me15:56
hatchno version information in the charmhelpers.py file15:56
rick_h_uiteam call in 515:56
rick_h_kanban please15:56
hatchbut --format doesn't work on the CLI either15:56
rick_h_right15:56
rogpeppehatch: what output do you get from the CLI ?15:57
hatchrogpeppe: <hatch> error: invalid value "json" for flag --format: unknown format "json"15:57
rogpeppehatch: ha, so i see15:58
rogpeppehatch: there's a TODO in the code15:58
rick_h_damn I love having good docs search now15:58
rogpeppehatch: i'm surprised it isn't implemented15:58
hatchrogpeppe: but it works in the hooks?15:58
rick_h_http://qa.storefront.theblues.io:6543/docs/authors-hook-environment#hook-tools15:58
rick_h_hatch: yea, it's a hook tool15:58
rogpeppehatch: it should work in the hook tool15:59
rick_h_kadams54: call?16:00
mhiltonbac, rick_h: It looks like mojo is creating blues-browser tarballs with all the bzr history in them so they are 170odd MB is that enough to explain the timing?16:00
kadams54rick_h_: joining.16:00
rick_h_mhilton: call?16:00
rick_h_mhilton: wrong channel please16:01
hatchrick_h_: rogpeppe ahh ok16:01
hatchok I can probably test this via the hooks I guess16:03
hatchrogpeppe: is there a bug about that --format? Or just a note in the code? :)16:03
rogpeppehatch: there's no bug referenced in the code comment16:06
hatchok do I just file a bug on the Juju project?16:07
hatchjuju-core that is16:07
hatchuiteam is there a way I can deploy a local charm without it being in the specific undocumented folder structure? Or should I just create a symlink to the real folder?16:24
frankbanhatch: if you are talking about the gui charm, just run make deploy16:24
mhiltonhatch I do the symlink thing16:25
hatchfrankban: yeah I was just hoping I didn't have to do workarounds for such a basic functionality heh16:26
hatchmhilton: ok thanks16:26
hatchsymlink appears to work well16:34
rick_h_hatch: so I have a /src/charms directory with trusty/precise directories and do all my charm dev in those for just that reason. Once I set it up it's been cool but yea annoying16:35
hatchrick_h_: yeah I tried that workflow but it doesn't really work when you have the same charm for both versions of ubuntu16:35
hatchghost, juju-gui etc16:35
rick_h_hatch: right, just have two checkouts really16:35
hatchthen you also have to have very odd names for repositories16:35
hatchohh16:35
hatchI think I'm going to file a bug around this16:36
rick_h_hatch: and have to sync between them, and since you forked and can work between your branches it's ok16:36
hatchit's really a poor UX imho16:36
hatchit's not intuitive16:36
hatchrogpeppe: could you point me to the line of code in GH where the note is about --format=json?16:45
hatchuiteam does the config-changed hook get any indication of the  old/new values? Or which fields have been changed?16:52
jcsacketthatch: don't think so.16:52
hatchI didn't think so16:53
hatchany ideas on how I may close a previously opened port?16:53
mhiltonhatch: Are you using charmhelpers?16:53
frankbanhatch: the gui charm stores previous values16:53
hatchmhilton: yes16:53
hatchfrankban: oh?16:53
mhiltonhatch: in that case the Config option can do that for you.16:53
mhiltons/option/object/16:53
frankbanmhilton: the gui charm does not use charmhelpers16:55
rick_h_hatch: there was an email about the latest juju alpha that adds support for finding what ports are open though16:55
frankbanhatch: look at backend.py16:55
mhiltonhatch: http://pythonhosted.org/charmhelpers/api/charmhelpers.core.html#charmhelpers.core.hookenv.Config16:55
hatchfrankban: right so I have backend.config16:55
hatchwhich is utils.get_config()16:56
frankbanhatch: I think that the backend.different method is used there16:56
hatchahh I see how it does it16:56
hatchmhilton: yeah the version of charmhelpers we have here doesn't have that16:57
hatchfrankban: thanks16:57
jcsackettrogpeppe: archivedownloadcount in stats is supposed to show deploys for a charm, right?16:57
frankbannp16:57
mhiltonhatch: sorry, you might be able to crib what it does though.16:58
hatchmhilton: yeah looks like the guicharm already has the functionality baked in16:58
rogpeppejcsackett: it shows downloads, which might not be the same thing16:58
rogpeppejcsackett: if you deploy a charm twice in an environment, it will only download once16:58
jcsackettrogpeppe: ok--so is that why the discrepancy between downloads here http://manage.jujucharms.com/charms/trusty/wordpress and here https://api.jujucharms.com/v4/trusty/wordpress/meta/any?include=stats16:59
hatchman I miss chrome devtools :P16:59
jcsackettb/c i'm noticing basically everything has *very* low counts.16:59
rogpeppejcsackett: we didn't grandfather in the old counts16:59
jcsacketthm, ok.16:59
rogpeppejcsackett: so everything has started from scratch16:59
rogpeppejcsackett: perhaps raise an issue about that17:00
jcsackettthat's reasonable, but some of the feedback we've gotten is about the low counts we're showing.17:00
jcsackettrogpeppe: yeah... rick_h_, thoughts ^17:00
hatchrogpeppe: could you point me to the line of code in GH where the note is about --format=json? (whenever you have a moment, I'd like to add it to the bug report)17:01
rogpeppehatch: line 31 here https://github.com/juju/juju/blob/master/cmd/juju/get.go17:02
hatchthanks :)17:03
rick_h_jcsackett: rogpeppe yea, I wasn't sure if we wanted to try to split things up a bit and reset since there's so much legacy numbers but I think having 0 is bugging people more than my hope for a fresh start :)17:04
hatchgolang syntax highlighting in github is pretty nice17:04
jcsackettrick_h_, rogpeppe ok, i've filed an issue.17:08
hatchkadams54: will review your branch17:19
kadams54uiteam: looking for reviews on https://github.com/juju/juju-gui/pull/654 < hatch, rick_h_ 17:19
kadams54Damn you hatch, you're fast.17:19
hatchgithub pinged me17:19
hatchsaid 'check this ish out yo'17:19
kadams54FYI, build failed fast, so I'm guessing a lint issue. Fixing now.17:20
kadams54hatch, rick_h_: checkout this code diff: https://github.com/juju/juju-gui/pull/654/files#diff-f49ed99ac4fd4002b0649222733b6feaL5017:21
kadams54Great example of how much the code was simplified by this change.17:21
hatchbahahaha17:22
hatch+1M17:22
* rick_h_ gets a cigar out "I love it when a plan comes together"17:22
hatchbrb17:22
hatchrick_h_: hahahahaahaha17:22
hatchwe need a MR T17:22
* hatch will be Face17:22
* kadams54 nominates Wayne Witzel for Mr. T.17:23
rick_h_I nominate urulama for Mr T, I want to see him with mad chains :)17:23
kadams54lol17:23
kadams54bling galore17:23
rick_h_the best would be getting wayne for Mr T17:23
rick_h_but not ready to adopt him over here yet :P17:23
kadams54Maybe next year I'll add some gold chains to the gamehawk: http://imgur.com/a/OVbqs17:24
rick_h_lol17:25
* rick_h_ donates to that kickstarter17:25
hatch"and the winner goes to.....The A Team with the real black guy" 17:25
hatch- family guy17:25
hatchahh funny episode 17:25
rick_h_hatch: looking at the review, can you do QA please?17:26
hatchlol urulama with bling17:26
hatchhe's going to look at these dings later and be like 'uhhhh?' :D17:26
hatchrick_h_: yep on it17:26
rick_h_ty17:26
hatchkadams54: are these handlers just copy/pasted or were there internal changes?17:31
kadams54hatch: the actual handler code worked mostly without change.17:32
hatchalright17:32
kadams54I did make one internal change, which was to shift from serviceName to using ID everywehre17:32
kadams54That also simplified code17:32
hatchdoesn't that cause issues with ghost services?17:32
kadams54Nope.17:33
rick_h_hatch: can you make sure to QA with subordinates please? It's been on my mind that I've not tried that yet17:33
kadams54Works better for ghosts17:33
kadams54The issue we had with ghosts was that we were using service names everywhere and on ghosts the ID is different from the name.17:34
hatchright - but if you change the visibility status of the ghost then deploy17:34
hatchdoes it break then?17:34
hatch( I haven't got to qa yet)17:34
kadams54Shouldn't. The code handles ID changes.17:36
hatchcool17:36
kadams54The token will re-render with the new ID.17:36
kadams54But definitely worth testing the snot out of it :-)17:36
hatchok qa'ing now17:40
hatchkadams54: +1 QA OK - there is a qa issue but it's minor17:45
kadams54I'll check it out17:45
hatchoh crap I just found another bug17:46
hatchblarg17:46
hatchok one sec I'll try and reproduce it and then add to the PR17:46
hatch(might be pre-existing though_17:46
kadams54Let's get them all out of the system now :-)17:49
hatchkadams54: ok added this new bug to the PR17:49
hatchI'm pretty confident it's how it calculates what's related or not17:50
hatchso likely pre-existing17:50
hatchkadams54: I replied to the multi handler reply18:00
kadams54hatch: And I replied back :-)18:04
hatchwe really need to figure out a better system for discussions on PR's18:04
hatchlol18:04
hatchmaybe a rasp-pi with an led which turns green when review comments are done18:05
hatchand red again when new ones need discussing18:05
hatchlol18:05
hatchrasp-pi might beoverkill :)18:05
hatchlunching18:07
kadams54hatch: when you get back, I commented on the QA issues.18:42
hatchlooks good thx18:43
* hatch isn't back18:43
kadams54OK, if this build passes, I'll ship PR#654.18:44
hatch__kadams54: did you need me to create cards/bugs for those qa issues?19:01
=== kadams54 is now known as kadams54-away
=== alexpilotti_ is now known as alexpilotti
=== kadams54-away is now known as kadams54
kadams54hatch__: I can create them.19:16
hatch__kadams54: so we should probably focus on those bugs next19:23
kadams54True. I'll pick them up before optimizing the events.19:23
hatch__great - if there is anything I can help with lemme know19:24
rick_h_hatch__: woot it works!19:35
hatch__rick_h_: lol YEAHHHHHHHH19:35
rick_h_hatch__: and I didn't see the dns name because hover paginates your dns entries after 10 :/19:35
hatch__lol19:35
rick_h_it was name #11 for my dns 19:35
=== kadams54 is now known as kadams54-away
hatch__took it up to 11!19:49
=== kadams54-away is now known as kadams54
=== kadams54 is now known as kadams54-away
=== kadams54-away is now known as kadams54
hatch__rick_h_: so here is what i have https://gist.github.com/hatched/9b0a1723be672a1ee3fe21:15
hatch__but it's never using the custom ports21:15
rick_h_hatch__: looking21:16
hatch__so I need to debug this script somehow21:16
hatch__so I can use debug  hooks, but then I need to install pdb?21:16
rick_h_hatch__: so I'd log out what backend.config and backend.prev_config are21:16
rick_h_hatch__: are your log items in the modify_open_ports function getting called?21:17
rick_h_hatch__: e.g. you have log items there?21:17
hatch__yes it's saying it's using the default values21:17
hatch__if hasattr(config, 'port')21:17
hatch__so this is never resolving to true21:17
rick_h_hatch__: ok, so yea I'd look at what the config has in it by logging the config/prev_config21:18
rick_h_hatch__: I'd also log in the closing command above close_port21:18
hatch__ok cool, and best way to dump a complex object in python?21:18
rick_h_I bet backend.config, backend.prev_config is wrong21:18
rick_h_hatch__: just str() it 21:18
hatch__ahh ok sounds good - will try21:18
rick_h_log(str(config))21:18
hatch__thx21:18
rick_h_np21:19
hatch__deploying the same local charm increments the counter but still deploys the old code21:22
hatch__how awesome 21:22
hatch__lol21:22
rick_h_heh21:22
hatch__good thing I got my lxc going fast again somehow21:22
hatch__rick_h_: https://gist.github.com/hatched/a455aae7cae3c5b35bc5 so as you'll see port is available in the first dump which is `config`21:27
hatch__oh wth21:28
rick_h_hatch__: oh, but you're checking hasattr21:28
rick_h_that's for a class21:28
rick_h_you just want to do 21:28
rick_h_if 'port' in config21:28
hatch__odly enough it resolves to true for the first confitional though lol21:28
rick_h_it's a key in dict check21:28
rick_h_hatch__: and the same with the prev config21:28
hatch__damn, I had that but thought hasattr was more appropriate because it's a method :)21:29
hatch__https://docs.python.org/2/library/functions.html#hasattr21:29
hatch__makes no mention of it requiring a class21:29
rick_h_no, it's for a class if you do obj.port21:29
hatch__just says object21:29
rick_h_you would check obj.hasattr('port')21:29
hatch__wow docs fail heh21:30
hatch__so which approach do you prefer?21:30
rick_h_if 'port' in config21:31
hatch__alright will give that a go21:31
hatch__so am I nuts or are the docs incorrect?21:31
rick_h_you're confusing a key with an attribute21:31
rick_h_JS has magic 'hash is an object' stuff21:32
hatch__OHHH now I see 21:32
hatch__yes my terminology name clashing21:32
hatch__oops21:32
rick_h_hatch__: http://paste.ubuntu.com/8972163/ for some clarity21:33
hatch__gotcha - I'm going to have to bust out the python book again this week21:34
rick_h_all good21:34
hatch__"use it or lose it" :P21:35
rick_h_woot, guimaas update complete and email sent out. 21:35
kadams54uiteam: Question: what happens to the units attached to a ghost service once that ghost service is committed?21:37
rick_h_kadams54: so the service is first put into juju, then units are added to it after it's real21:37
rick_h_kadams54: I believe we first have a 0 unit service and then add to it21:37
kadams54So the old units, the ones associated with the ghost service, are blown away rather than being updated.21:37
rick_h_kadams54: no, they're updated I believe. They turn from ghost units to real units? 21:38
kadams54rick_h_: it looks like the highlight/fade/hide flags are not being carried over when that transition happens… any pointers on where to look in code?21:39
rick_h_looking21:39
rick_h_kadams54: https://github.com/juju/juju-gui/blob/486c9b93632b5582a8c4b2c65c85efbf0c9c5614/app/utils/environment-change-set.js#L116021:41
kadams54thanks21:42
rick_h_kadams54: I think that's where the new live units come in and we turn the ghosts into real models21:42
rick_h_kadams54: at least a point to put a debugger and see what happens21:43
hatch__is there a way to unset a juju config value? Set it back to null?21:45
rick_h_hatch__: juju unset21:45
hatch__that's for all config values though21:46
rick_h_oh21:46
rick_h_well no idea then21:46
hatch__rick_h_: atm if you set a port there is no way to get 80 and 443 back open without setting it to 443 manually21:46
hatch__because 80 just redirects to 443 :)21:46
rick_h_hatch__: gotcha, oh well gui is stateless-ish just blow it away and redeploy :P21:46
hatch__haha it's an int, the only way to even flag off of that is to set it to 0 or something21:47
hatch__because it errors if you try to pass empty string21:47
hatch__I could of course make it a string field21:47
hatch__but....that doesn't feel right21:47
hatch__heh21:47
rick_h_Makyo: do you have time to peek at https://codereview.appspot.com/172410043 today please?21:47
rick_h_Makyo: oh, you had an appt, if not all good we'll get it looked at21:48
hatch__rick_h_: nm I read the cli docs incorrectly :/21:50
rick_h_you and docs don't get along :P21:50
hatch__no kidding! today just isn't my day it seems 21:50
kadams54rick_h_: The code you pointed me to updates the unit's service… but there seems to be code elsewhere that's changing unit.id from '8163515$/0' to 'mysql/0'.22:03
kadams54Either that or it's creating a new unit. Either way, somewhere along the line the unit ID changes. Within that same space of code, the fade flag is also dropped from the object we store in the DB.22:04
huwshimiMorning22:04
kadams54huwshimi: Morning22:04
huwshimikadams54: Hey!22:05
hatch__rick_h_: citizen M is advertising to me again...you know what THAT means!!!!22:08
rick_h_hatch__: :P22:08
hatch__lol22:08
rick_h_kadams54: yea, have to chase it down. Can you set a watch or stop on the db or something?22:09
kadams54Yeah, I can setup a temporary event handler that inspects unit changes/adds22:09
rick_h_kadams54: might be able to get hatch__ or Makyo to help chase it as they did more of it. 22:09
rick_h_kadams54: cool yea that should hopefully work out. 22:10
hatch__sorry what? I'm just reading Tornado docs22:10
rick_h_hatch__: lol22:10
hatch__right? more docs22:10
hatch__lol22:10
rick_h_hatch__: kadams54 is trying to figure out how ghost units turn into real units and why the hide/show flags are getting dropped22:10
hatch__gotcha22:10
hatch__ok lemme open that code and refresh my mmeory22:10
hatch__^ kadams5422:11
rick_h_hatch__: I started pointing him at https://github.com/juju/juju-gui/blob/486c9b93632b5582a8c4b2c65c85efbf0c9c5614/app/utils/environment-change-set.js#L116022:11
rick_h_but that's not quite the right spot22:11
hatch__kadams54: models.js:85722:13
hatch__thats the first handler from the delta updates22:14
hatch__kadams54: also line 40 of the same file is the generic process_delta handler22:15
hatch__which is called from the method on 85722:15
hatch__hmm wait sorry turns out my version is different than trunk heh22:16
hatch__oops one sec22:16
hatch__https://github.com/juju/juju-gui/blob/486c9b93632b5582a8c4b2c65c85efbf0c9c5614/app/models/models.js#L79622:17
kadams54thanks… I just hit EOD for now so I'm going to have to dig in more later tonight22:18
hatch__yeah sure np hope that puts you on the right track22:18
=== kadams54 is now known as kadams54-away

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