/srv/irclogs.ubuntu.com/2019/07/25/#cloud-init.txt

chillysurferhey, all! what's the best way to test out data source changes without having to reprovision a machine in the cloud provider for every code change iteration?16:05
chillysurferfor instance, to change vendordata in the datasource, is the only way to test this out by patching cloud-init and then reprovision a machine with the patch?16:05
chillysurferseems to make for a very long dev iteration loop16:05
rharperchillysurfer: you'll likely want 'cloud-init clean --logs'  and possible add --reboot ; that will reset most of the cloud-init state and re-run like firstboot16:38
chillysurferrharper: ah cool! so basically just run that command and then reboot the machine?16:39
rharperchillysurfer: yes16:40
chillysurferrharper: great thanks! i'll give it a try!16:41
rharperchillysurfer: you also don't _have_ to reboot; it depends on what your testing; you can just call cloud-init like boot does;  cloud-init init --local; cloud-init init, cloud-init modules --mode=config; cloud-init modules --final16:42
chillysurferrharper: i'm really just testing out injecting vendordata16:42
chillysurferi'm not sure exactly what part of cloud-init that we crawl metadata (and therefore get vendordata i think..?) and then handle and execute vendordata16:43
rharperchillysurfer: local16:44
rharper https://cloudinit.readthedocs.io/en/latest/topics/boot.html16:44
rharperchillysurfer: depending on the datasource, we like to create main functions on the DataSource.py which just crawls the metadata and dumps what had (and you could merge it)16:45
chillysurferrharper: i'm working with the azure datasource16:45
rharperchillysurfer: if you look at cloudinit/sources/DataSourcesGCE.py for example16:45
chillysurferi'll check out the gce esample16:46
rharperchillysurfer:  so you can use the crawl_metadata()16:46
chillysurfer*example16:46
chillysurferthat would be a good way to see what i end up with for sure16:46
chillysurferrharper: but to see the actual metadata (in this case, vendordata) applied to the machine then i should be running the entire local stage i think right?16:47
rharperchillysurfer: right16:47
chillysurferperfect16:47
chillysurferthanks so much! going to play around with this16:47
rharperwell, and dpending on what you put into the config; some things happen at different stages16:47
chillysurferyep i'm just injecting some 'hello world' in vendodata runcmd16:48
rharperok, runcmds will happen at final time16:48
chillysurferah i see16:48
chillysurferso the final stage then?16:48
rharperalso, generally vendoring runcmds is going to be problematic since users likely want to include those, and then merging rules apply16:48
chillysurferyep totally understand about merging and that sort16:48
rharperchillysurfer: you'd need to run local, init, and final16:48
chillysurferi need to do some research on the default merging of vendordata + userdata16:49
rharperhttps://cloudinit.readthedocs.io/en/latest/topics/merging.html16:49
rharpershould help16:49
rharperparticuarlly at the bottom; exaples on merging multiple run commands16:49
chillysurferawesome16:50
rharperit's somewhat awkward to allow things to merge "the way you want"  which may be different than how users want16:50
Odd_Blokehttps://bugs.launchpad.net/cloud-init/+bug/1837927 <-- this bug stems from a broken OpenStack metadata service.  On xenial we end up using Ec2, so instances are at least usable, but on bionic we don't (because we correctly detect we're on OpenStack, so only use that DS).  Is there anything the user can do when launching an OpenStack instance to work around the broken IMDS by selecting the Ec2 DS?20:17
ubot5Ubuntu bug 1837927 in cloud-init "Missing mandatory path: http://169.254.169.254/openstack/2018-08-27/meta_data.json" [Undecided,New]20:17
Odd_BlokeOr will they need to bake their own image to select the working DS?20:17
Odd_Bloke(I think this bug is Invalid regardless, would just like to give them a bit more direction than "go bug your cloud admin" if possible.)20:18
rharperOdd_Bloke: huh20:31
rharperOdd_Bloke: how would we know that Ec2 would work? I guess you're suggesting we could try ...20:31
rharperOdd_Bloke: IIC, on Xenial, the _get_data() returns False, but because we _search_ all known datasources, we'll try Ec2 last20:32
rharperon bionic, since ds-identify says, just OpenStack, then it won't try anything else20:32
rharperwe would sort of want to allow cloud-init to try a list of maybe datasources20:33
rharperthe user could modify ds-identify, with found=all, like so:  ci.di.poliyc=search,found=all,maybe=none,notfound=disabled;  which is equivalent to the Xenial defaults20:34
rharpers/ds-identify/ds-identify-policy20:34
Odd_BlokeYes, on xenial we try OpenStack and it fails so we move on, eventually to Ec2.20:36
Odd_Blokerharper: That should be notfound=enabled, right?20:59
rharperno20:59
rharperoh, well for fully xenial equivalent yes21:00
rharperbut the goal is to fallback, not emulate xenial behavior21:00
rharperso, if we don't find any datasources, then we shouldn't enable21:00
Odd_BlokeBut in this case, we aren't going to "find" the Ec2 DS, right?21:01
Odd_Blokexenial also has mode=report.21:01
Odd_BlokeWhich is I think why it works, because that means we try everything anyway?21:01
rharperwe will find OpenStack21:02
Odd_BlokeRight, but OpenStack is broken.21:03
rharperand di-identify returns a datasource_list like: ['OpenStack', None]21:03
rharperI think it will list all network sources as maybe since we're not in strict mode21:04
Odd_BlokeI think the problem is going to be that it will identify OpenStack as definitely found.21:06
Odd_BlokeSo we might just want ci.di.policy=enabled, with OpenStack,Ec2 configured as the data sources in /etc/cloud/... ?21:09
rharperyeah; I think you're right;   I think we'd need to either disable ds-identify via the report mode21:09
rharperright21:09
rharperwell, via command line for images booted on this broken openstack21:10
rharpereither both configs on the kernel command line or in the image itself if someone is making modifications21:10
Odd_BlokeOh, can you change the command-line when launching via Nova?  Or are you saying that the cloud admin could work around their broken cloud by changing the default command line that's used?21:11
rharperI was looking for image attributes21:12
rharperand I thought one could pass things through but I think I'm not right about that; the iamge has a boot loader21:12
Odd_BlokeOh, looks like ci.di.datasource=OpenStack,Ec2 should DTRT.21:17
Odd_Blokeenabled/disabled would mean we couldn't configure _anything_ via ds-identify.21:17
Odd_BlokeBut ci.di.datasource returns before the report/search behaviour is used.21:18
rharperyes, if you specify them; then we don't bother detecting them21:22
Odd_BlokeRight, which is what we want here.21:23
Odd_BlokeRight?21:23
rharperyes21:23
rharpereffectively setting the list to OpenStack and then Ec221:23
rharperthough in this case they shoud just set Ec221:23
rharperno point in trying a broken openstack21:23
Odd_BlokeYeah; I put that in there so that they'll switch to OpenStack if the cloud is fixed.21:24
Odd_BlokeI'll include a note in my reply explaining that.21:24
rharperthat can just use non-modified image  to verify21:25
rharperbut yeah21:25
rharperso Ec2 doesn't do a check-instance id21:25
rharperwhich means that if we use Ec2, on next boot if it found OpenStack, I think it would use that;  I wonder about the transition on upgrade21:25
rharperwith such a setting21:25
Odd_BlokeOK, I'll just put Ec2 in there then.21:26
Odd_BlokeMy guess is they'll either fix the cloud soon or never.21:26
rharperright21:26
chillysurferanybody know how to hit a breakpoint with nosetest3? doing `import pdb; pdb.set_trace()` and then running nosetest3 doesn't seem to do it21:53
chillysurfernor does the `--pdb` option (which breaks on failure and error, but not breakpoing)21:54
chillysurferand the manpages for it don't mention a thing about breakpoints21:56
rharperchillysurfer: you want to pass -s22:07
rharperso you get standard input/output to console22:07
rharperwell, I've not used breakpoints, but I've dropped an import pdb; pdb.set_trace() into various parts of code or tests;then used -s on the nose commandline22:07
chillysurferrharper: that did it!!22:12
chillysurferthanks so much!22:12
rharper\o/22:12

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