/srv/irclogs.ubuntu.com/2017/03/16/#cloud-init.txt

=== shardy is now known as shardy_lunch
=== shardy_lunch is now known as shardy
=== rangerpbzzzz is now known as rangerpb
rharpersmoser: I'm going to merge the policy branch into my net-passthrough and then see if this all still works =)14:07
smoserrharper, ok... i just did something, tried to test yiour branch and lxc and didn't seem to do what i expected.14:07
smoserputting together something to show you what i tried.14:08
rharperok14:08
rharpersmoser: in the policy feature; you've not yet wired it into the distro yet, right?  also not poked at what the systemconfig key/val would be yet?14:13
rharpersmoser: so, we don't have a common config dictionary for renders;  that makes the distro part where it fetches the first renderer via policy, it still needs to know which renderer it is can construct possible different configs;  unless we come up with a common config structure14:20
smoserrharper, well, at first i dont think we *need* any configuration on nit.14:21
rharperrenderers today all that a config dict; and they're all different; that's just the code today without any new code;14:26
rharpersome things are common, for example, eni and sysconfig take a 'netrules_path' key for udev rule hooks14:26
rharperbut eni has a eni_header (which we could truncate to header, and reuse for netplan as well, we use the same one anyhow);14:27
smoserrharper, right. so we do have to know how to call each of the renderers, which kind of suck14:27
rharpersysconfig uses dns_path  and sysconf_dir,14:27
rharperyeah14:27
smoserbut we do not need to necessarily have that configured14:28
smoserthe datasource can just raise a RunTimeError if it doens't know how to call the selected_renderer14:28
smoserbut even then, i think the renderers all take config={}14:28
rharperthey all take the config; I'm saying it's annoying in the distro that supports multiple renders14:28
smoserand probably do something sane-ish... they can  just be improved to better dtrt14:28
rharperthe logic should be 1) render_cls = load_net_render_by_policy();  2) render  = render_cls(config)14:29
rharperbut instead, we have to ask well, if render_cls == 'eni' then X; elif render_cls == 'netplan' Y14:30
rharperwhere the config dict looks different14:30
rharperthat's what I don't like;14:30
smoseri understand.14:31
smoserbut 2 things14:31
smosera.) maybe you dont' have to do that.... you just call renderer(config={})14:31
smoser  (why can't that do the right thing)14:31
smoseri dont remember 'b'14:32
rharperyeah, looking at the constructors; they all have sane defaults;  save the HEADER isn;'t enabled by default;14:33
rharperand the header is common, so that could work14:33
rharperalternatively, the distro could pack both sets of config into a single dict; they do not overlap14:34
* rharper plays with some code an unittests14:34
smoserrharper, right. i considered that too14:36
smoser(putting both configs in)14:36
smoserbut honestly that isn't any more difficult than this:14:36
smoserconfigs = {'eni': {'eni_data_for_config_param': 1}, 'netplan': {'netplan stuff'}}14:37
smosername, renderer = load_net_render_by_policy()14:37
smoserrenderer(config=configs[name])14:37
smoseror config=configs.get(name, {})14:38
rharperwell, load_renderer instantiates the class, you pass the config in14:40
rharperbut I'll play around with something14:41
rharperwe could pass the config dict as you show with the class name configs and have the loader pull out the config14:41
rharperthat seems sane14:41
smoserrharper, http://paste.ubuntu.com/24189094/14:53
smoserthat doesnt seem to get networking. it ends up rendering yaml, but with only 'lo' in the 50-cloud-init14:53
smosertrying with:14:53
smoser /tmp/try-lxc-v2 ubuntu-daily:zesty /tmp/cloud-init_all.deb14:53
rharperk14:54
rharperunrelated, I merged your feature branch in and I'm getting unittest errors with 'is_exe' is not defined14:55
smoserrharper, i was i might not have committeed that... let me check. i did see that.14:56
smoserthought i had fixed it.14:56
smoserwill fix now14:56
rharperk14:56
smoserso that paste above... i verify in logs that you're rendering netplan14:56
smoserand there is a netplan config, and there is no 50-cloud-* (i was wrong)14:56
smoserbut it does not get networking14:57
rharperok, it;s likely related to other systemd unit changes14:57
rharperyou can check: systemctl status systemd-networkd (it should be active) and systemctl status sytemd-network-wait-online.service (should be active too)14:58
rharperit's likely that one or the other didn't trigger which means we write the file but nothing runs14:58
rharperalso /run/systemd/network/* should have 10-netplan-* files if cloud-init called netplan generate (which it should if it rendered the 50-cloud-init.yaml )14:58
rharperthis is the "fun" of systemd unit magic14:59
smoserrharper,  i pushed my renderes branch... i had the is_exe change locally but not pushed. sorry15:29
smoserand confirmed that lxd works after reboot15:29
smoserwith your branch network comes up after reboot15:29
rharpersmoser: ok; I hacked in my own is_exe, but will switch15:32
rharperI need to update my unittests now that the default policy is to use eni; my netplan paths which I mocked out a which('netplan') require a bit more work since it finds 'eni' first15:33
rharpersmoser: do you have an idea on what we'd put in sysconfig dict to override the default policy and pass it ?  I think the Distro object would config.get('network_render_policy') or something like that15:34
smoserrharper, looking15:37
szbhi all, I'm getting errors from apt 'Could not get lock /var/lib/apt/lists/lock' when trying to add a source. It looks like the initial apt-get update/upgrade is still running? Why doesn't this block the rest of the script?17:04
paulmeyI'm thinking about the scenario where we make the Azure datasource a local datasource...17:20
paulmeydo local datasource get to execute any code at the end of cloud-init provisioning?17:21
smoser\o/17:30
smoserpaulmey, yes.17:30
smoserwell, as much as network datasources do17:30
smoserszb, what is "the rest of the script" ?17:31
paulmeyok, so even a local data source gets to signal successful provisioning over the network in the end...?17:31
smosereverything is serial currently in cloud-init. perhaps you had an old lock file there that had got captured?17:31
smoserpaulmey, where does that happen for azure now ?17:32
paulmeylet me look...17:33
smoserso the answer is... we'll make it work and fix what we have to to do so.17:33
szb@smoser: I have "package_upgrade: true" at the top, and then farther down I have an "apt: sources:" section and it breaks there because apt is still locked upgrading.17:35
smoserszb, can you show me what you have for apt: sources: ?17:38
smoserbut fwiw, this is not run "top down".17:38
szb@smoser: http://pastebin.com/BURKWmZs17:40
smoserszb, can you paste a /var/log/cloud-init.log ?17:45
smoser(and fwiw, xenial ubuntu images have 'pastebinit') so you can just run 'pastebinit /var/log/cloud-init.log'17:45
smoserszb, i dropped the 'fs_setup' section, and it worked for me here.17:47
szb@smoser: http://paste.ubuntu.com/24190140/17:53
szb@smoser: Hmm, interesting. Is this not a good use for cloud-init, setting up mongo? I'm not sure but I like settings things up this way rather than coding a shell script.17:54
smoserunrelated suggestion, i suggest even though its much longer that you specify the key, not the keyid.  that way you remove the dependency on a gpg server.17:56
smoserszb, it seems sane to me.17:56
smosercan you paste /var/log/cloud-init-output.log ?17:56
smoseri suspect that is what showed you the lock complaint17:57
smoserbut i dont know what would cause apt to be running that early.17:57
paulmey@smoser, it's currently done at the end of the func that gets the metadata17:57
paulmeythat's not the right place anyway17:57
paulmey:-/17:58
smoserwell, it doesnt seem terrible at the end of that func. as its deciding that its "done" at taht point.17:58
smoseri think it might fit in 'activate'17:58
smoseractivate will be called when networking is configured.17:59
szb@smoser: http://paste.ubuntu.com/24190179/17:59
smoserszb, i'm not sure what has that lock18:02
szb@smoser: Ah, well ty for looking18:05
smoserso, i'm pretty sure that cloud-init is not doing it.18:06
smoseri've never seen this error before.18:06
smoseris this a stock ubuntu image ?18:06
smoserszb, ^ ?18:07
szbbase 16.04 LTS AMI with some customizations, built from packer.18:08
szb@smoer, could this in our APT config be it? APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1";18:17
rharperharlowja: on the sysconfig path, in rhel.py if we use the 'apply_network_config' path which uses the renderer instead of the _write_network_config() path I noticed that the section that writes out 'etc/sysconfig/network' file isn't rendered;  I suspect that should be common ?18:18
harlowjai would agree18:19
rharperhttps://git.launchpad.net/cloud-init/tree/cloudinit/distros/rhel.py#n10018:19
rharperin practice, is that already configured?18:19
harlowjano afaik18:20
harlowja*not18:20
rharperI would have thought that fedora/rhel images would have failed if they were using the apply_network_config path if those values aren't set18:20
harlowjaya perhaps cut off the 'if dev_names'18:21
harlowjaand just let it happen18:21
rharpery18:21
rharperit needs a bit more to make it common between the two methods; but I'll see what I can do18:22
rharpersomething like a _enable_networking() method18:22
rharperwhich takes the v6 booloean18:22
rharperthen we can call it from both methods18:22
harlowjawfm18:22
rangerpbheya Odd_Bloke , you around possible to talk about https://git.launchpad.net/cloud-init/tree/cloudinit/sources/DataSourceAzure.py#n77 ?18:29
rangerpblooking for a little background in it18:29
Odd_Blokerangerpb: I'm in a meeting ATM, but should be out soon; if you ask me some questions I'll answer once I have a minute. :)18:32
rangerpbOdd_Bloke, well , lets start with what is the purpose of that method?  can you remember why it is needed?18:33
rangerpbthen the next question is that I have had to recently patch the non-agent provisioning path in DataSourceAzure to perform the whole set hostname and bounce of the network to propogate things to DDNS.  it duplicates a lot of code like https://git.launchpad.net/cloud-init/tree/cloudinit/sources/DataSourceAzure.py#n115 and lines following (including the call to the bounce method).18:35
rangerpbsmoser has suggested I see if I can refactor some of the code between both paths to reduce duplication ... but that contextlib method seems like it is going to be problematic18:35
smoserrangerpb, hey.18:43
smoserso on azure, i thought you sue NetworkManager rahter than sysconfig ?18:43
smoserdid i make that up?18:43
smoserah. never mind. i understand what i was going to ask. i was wondering how we render networking. but i guess on your images there, fallback networking gets rendered, but nothing uses it.18:44
rangerpbnot sure what you mean18:46
smoseryou use network manager in some images right?18:46
rangerpbin some yes18:47
rangerpbbut i guess that decision is made by who makes the image18:47
smoserwell, as it is right now, cloud-initdoes not support reading network configuration from a datasource and rendering it to NetworkManager.18:50
smoserso it works for you just because cloud-init will render the sysconfig networkign on fedora, but your image doesnt pay any attention to it.18:51
rangerpbI believe the only thing that is read is the hostname18:54
rharpersmoser: maybe time for netplan19:01
rharperit writes NetworkManager configs19:01
smoser:)19:02
smoserrangerpb, on azure that is true.19:02
smoserthere, cloud-init selects a "fallback network configuration" that equates to "run dhcp on the first network interface".19:03
smoserbut on other clouds (digital ocean, openstack, lxd, smartos) the cloud provider provides information on how the network should be configured19:03
szb@smoser: Fixed, I think the APT unattended upgrades in the base AMI were the issue. I removed those and rebuilt the AMI and now it's working. ty for your hlep!19:07
smoserszb, yeah... you want to file a bug ?19:15
smoserthat is quite obnoxious...19:15
Odd_Blokerangerpb: Hmm, let me see if I can remember.19:15
smosergenerally speaking, i think that apt unattended upgrades thing is a pita. as it can cause *anything* to fail19:15
Odd_Blokerangerpb: https://bugs.launchpad.net/ubuntu/+source/walinuxagent/+bug/1375252 was the bug I was fixing.19:18
Odd_Blokerangerpb: IIRC, the Azure fabric expects you to use the hostname that it has recorded for your instance.19:18
Odd_Blokerangerpb: So cloud-init was always resetting to that hostname on boot.19:18
Odd_Blokerangerpb: Whereas temporary_hostname just sets back to that hostname while the agent is talking to the fabric, and then returns it to the previously-set one.19:19
Odd_Bloke(So that users can modify hostnames.)19:19
smoserpowersj, around ?19:58
smoserhttps://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/31987819:58
powersjsmoser: yes19:58
smoserjane's entry in /etc/shadow should have $1$xyz$sPMsLNmf66Ohl.ol6JvzE.19:58
smoserright?19:58
powersjyes19:59
powersjwant a simple test of that one?19:59
smoseryea20:00
smoserdo you know what that passowrd is ?20:00
powersjI don't I think I grabbed a string and messed it up more20:01
smoser ?20:02
smoser !$1$ssisyfpf$YqvuJLfrrW6Cg/l53Pi1n120:02
smoserhttps://git.launchpad.net/cirros/commit/?id=95f4ffa2f5339aa04226718895a780f2994817b920:02
powersjoh well then maybe I didn't lol20:02
powersjwant me to change it?20:03
smoseryeah, lets use that.20:07
smoserjust becauase its good to use something i think that we knwo.20:07
smoserand [put a comment in there.20:07
smoseror we can just put their names for each one20:09
smoserpowersj, i'll do this an give you a suggestion20:11
powersjsmoser: ok, are you fine with the Random -> RANDOM changes as well? I kind of lumped those in and was not sure if that should be another merge or not20:12
smoserits fine. its supposed to be RANDOM to indicate a random password, right?20:14
powersjyes20:14
rangerpbOdd_Bloke, but it appears to me in the code it sets the hostname to what azure expects by getting the hostname from the metadata...20:17
Odd_Blokerangerpb: Right, because walinuxagent does a DHCP bounce which includes the hostname.20:18
rangerpbso ... why is the method needed then ?20:18
* rangerpb must be misunderstanding something20:19
Odd_Blokerangerpb: I think it's this: (1) User boots instance, (2) user changes hostname of instance, (3) user reboots.  At that second boot, we still need to report the original hostname.20:21
Odd_BlokeThese assumptions may no longer hold; I was modifying a strategy that was already in place.20:22
rangerpbso this covers an instance when the user changes the hostname for some ungodly reason ?20:23
rangerpbinteresting ...20:23
rangerpbnot something I had considered20:23
Odd_Blokerangerpb: I believe so, yes.20:24
rangerpbpaulmey, do you know if this still holds water?20:25
rangerpbthanks Odd_Bloke !20:25
Odd_Bloke:)20:26
rangerpbOdd_Bloke, one reason I am questioning this method is that if the hostname is not set up correctly and the network bounces, then things like DNS may not work correctly20:31
rangerpbspecifically resolving the VMs DNS name <> IP20:31
Odd_Blokerangerpb: What do you mean by "the hostname is not set up correctly"?  When might that happen?20:32
rangerpbmeaning, the hostname is not what azure wants it to be20:32
Odd_BlokeAh, you mean if the network bounces outside of cloud-init's control?20:33
Odd_Bloke(Rather than the intentional bounce on boot?)20:33
Odd_BlokeI think it only needs to be configured as Azure expects when walinuxagent starts.20:34
smoserOdd_Bloke, well, in the "builtin"  path, cloud-init is not currently bouncing the interface.20:42
smoserthe goal for rangerpb was to get the hostname from the environment file and then "publish" it to azure (where "publish" means "dhcp with set-hostname")20:43
smoserwhich is why we were ever bouncing the hostname20:43
rangerpbOdd_Bloke, sure, but frankly everyone wants off of the agent for provisioning21:02
rangerpband what smoser said21:02
* rangerpb runs out of gass21:03
=== rangerpb is now known as rangerpbzzzz
smoserpowersj, how do i save the collect stuff ?21:11
smoserso that i can verify --data-dir= ?21:11
smosermagicalChicken, ?^21:11
powersjsmoser: instead of a run you want to do a collect21:11
powersjcollect -n xenial -d /tmp/collection for example21:12
magicalChickensmoser: yeah, if you run collect you can then use verify afterwards on the collected data21:12
smoserso just instead of 'run' i 'collect' ?21:14
magicalChickenyeah21:14
smoseri think i'd like an option to 'run' to take --data-dir21:14
magicalChickenthe rest of the args are the same, but you have to add --data-dir21:14
powersjhttps://cloudinit.readthedocs.io/en/latest/topics/tests.html#collect ;)21:14
magicalChickensmoser: i have plans for adding a --preserve=always for run and a --data-dir option there too21:15
magicalChickenjust haven't gotten to that yet, too much other stuff first21:15
magicalChickenand that would be based on the tmpdir stuff from the bddeb branch which needs to be merged as well21:16
smoserpowersj, i'm about to leave21:19
smoserbut21:19
smoserhttp://paste.ubuntu.com/24191229/21:19
smoseris what ihave21:19
powersjsmoser: thx I'll take a look at it21:19
smoserhm.m21:21
smosertest_shadow_passwords (tests.cloud_tests.testcases.get_suite.<locals>.tmp) ... ok21:21
smoser'<locals>'21:21
smoserpowersj, that just passed a 'run' for me. so i think its good.21:21
smoserthe password -> passwd  change i found when one of my asserts failed.21:22
powersjinteresting is that worth a doc change?21:23
smoserdoc is right :)21:23
powersjhttps://cloudinit.readthedocs.io/en/latest/topics/modules.html#set-passwords says password21:24
smoserits correct there.21:24
powersjI made all these test based off of the read the docs21:24
powersjoh21:24
smoserin a users: it is 'passwd'21:24
smoserso.. based on that quite reasonable misundstanding of yours...21:24
smosermaybe we should make the code take 'password' or 'passwd'21:25
powersjah right21:25
smoserhttps://cloudinit.readthedocs.io/en/latest/topics/modules.html#users-and-groups21:25
smoserthats what you were writing to. 'passwd'21:25
smoseri got to run.21:25
smoserlater21:25
smoser.21:25
powersjthx o/21:25

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