diff options
author | Scott Moser <smoser@brickies.net> | 2016-09-20 10:27:54 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-10-07 12:29:43 -0400 |
commit | 808edb127507d91ecee1834aaf5cf1f000cd6e28 (patch) | |
tree | 4be70ca6d08e2d5c625be6aabb4500f4cae5aded | |
parent | c4aeba3f54eca687dd11837d1ec59de9f82c1cf6 (diff) | |
download | vyos-cloud-init-808edb127507d91ecee1834aaf5cf1f000cd6e28.tar.gz vyos-cloud-init-808edb127507d91ecee1834aaf5cf1f000cd6e28.zip |
MAAS: improve the main of datasource to look at kernel cmdline config.
This just looks in one other maas related path for a config file.
The file '91_kernel_cmdline_url' is written by cloud-init when it
gets a cloud-config-url parameter.
Also now we read the config even if a url is specified to potentially
fill in credentials.
-rw-r--r-- | cloudinit/sources/DataSourceMAAS.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cloudinit/sources/DataSourceMAAS.py b/cloudinit/sources/DataSourceMAAS.py index ab93c0a2..81abcd47 100644 --- a/cloudinit/sources/DataSourceMAAS.py +++ b/cloudinit/sources/DataSourceMAAS.py @@ -310,12 +310,12 @@ if __name__ == "__main__": creds = {'consumer_key': args.ckey, 'token_key': args.tkey, 'token_secret': args.tsec, 'consumer_secret': args.csec} - maaspkg_cfg = "/etc/cloud/cloud.cfg.d/90_dpkg_maas.cfg" - if (args.config is None and args.url is None and - os.path.exists(maaspkg_cfg) and - os.access(maaspkg_cfg, os.R_OK)): - sys.stderr.write("Used config in %s.\n" % maaspkg_cfg) - args.config = maaspkg_cfg + if args.config is None: + for fname in ('91_kernel_cmdline_url', '90_dpkg_maas'): + fpath = "/etc/cloud/cloud.cfg.d/" + fname + ".cfg" + if os.path.exists(fpath) and os.access(fpath, os.R_OK): + sys.stderr.write("Used config in %s.\n" % fpath) + args.config = fpath if args.config: cfg = util.read_conf(args.config) |