diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-07-09 14:41:55 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-07-09 14:41:55 -0400 |
commit | 6bea1cb867c13e05e3548c648d5f051d2c49f07b (patch) | |
tree | b46002961e5a9d798aa14db8c585ff64813abdfa /cloudinit | |
parent | d1d96451a420672a01d9097cc0b14ee13e8a9256 (diff) | |
download | vyos-cloud-init-6bea1cb867c13e05e3548c648d5f051d2c49f07b.tar.gz vyos-cloud-init-6bea1cb867c13e05e3548c648d5f051d2c49f07b.zip |
better handling for user/password
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/sources/DataSourceAzure.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index 143b7e4a..5037c1a3 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -160,6 +160,8 @@ def read_azure_ovf(contents): md = {'azure_data': {}} cfg = {} ud = "" + password = None + username = None for child in lpcs.childNodes: if child.nodeType == dom.TEXT_NODE or not child.localName: @@ -176,19 +178,36 @@ def read_azure_ovf(contents): if name == "userdata": ud = base64.b64decode(''.join(value.split())) elif name == "username": - cfg['system_info'] = {'default_user': {'name': value}} + username = value + elif name == "userpassword": + password = value elif name == "hostname": md['local-hostname'] = value elif name == "dscfg": cfg['datasource'] = {DS_NAME: util.load_yaml(value, default={})} elif name == "ssh": cfg['_pubkeys'] = loadAzurePubkeys(child) + elif name == "disablesshpasswordauthentication": + cfg['ssh_pwauth'] = util.is_true(value) elif simple: if name in md_props: md[name] = value else: md['azure_data'][name] = value + defuser = {} + if username: + defuser['name'] = username + if password: + defuser['password'] = password + defuser['lock_passwd'] = False + + if defuser: + cfg['system_info'] = {'default_user': defuser} + + if 'ssh_pwauth' not in cfg and password: + cfg['ssh_pwauth'] = True + return (md, ud, cfg) |