summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2013-08-20 09:58:30 -0600
committerBen Howard <ben.howard@canonical.com>2013-08-20 09:58:30 -0600
commit89d58c94d59c62dddea3f77b7a805c1afa2ca955 (patch)
tree6b7cd86a373706730f0ec11f06517fc2a003f7c9 /cloudinit/sources
parente683ab2baa3e67614edcd409122bd1aec99737e0 (diff)
parentb2ee0966793f3a9c7d8e92ce1c13b9583a9a76e7 (diff)
downloadvyos-cloud-init-89d58c94d59c62dddea3f77b7a805c1afa2ca955.tar.gz
vyos-cloud-init-89d58c94d59c62dddea3f77b7a805c1afa2ca955.zip
Updated merge proposal with current tree
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceAzure.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 2f28702e..7ec622bf 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import base64
+import crypt
import os
import os.path
import time
@@ -138,13 +139,11 @@ class DataSourceAzureNet(sources.DataSource):
bname = pk['fingerprint'] + ".crt"
fp_files += [os.path.join(mycfg['data_dir'], bname)]
- start = time.time()
- missing = wait_for_files(wait_for + fp_files)
+ missing = util.log_time(logfunc=LOG.debug, msg="waiting for files",
+ func=wait_for_files,
+ args=(wait_for + fp_files,))
if len(missing):
LOG.warn("Did not find files, but going on: %s", missing)
- else:
- LOG.debug("waited %.3f seconds for %d files to appear",
- time.time() - start, len(wait_for))
if shcfgxml in missing:
LOG.warn("SharedConfig.xml missing, using static instance-id")
@@ -206,11 +205,12 @@ def apply_hostname_bounce(hostname, policy, interface, command,
command = BOUNCE_COMMAND
LOG.debug("pubhname: publishing hostname [%s]", msg)
- start = time.time()
shell = not isinstance(command, (list, tuple))
# capture=False, see comments in bug 1202758 and bug 1206164.
- (output, err) = util.subp(command, shell=shell, capture=False, env=env)
- LOG.debug("publishing hostname took %.3f seconds", time.time() - start)
+ util.log_time(logfunc=LOG.debug, msg="publishing hostname",
+ get_uptime=True, func=util.subp,
+ kwargs={'command': command, 'shell': shell, 'capture': False,
+ 'env': env})
def crtfile_to_pubkey(fname):
@@ -425,7 +425,7 @@ def read_azure_ovf(contents):
if username:
defuser['name'] = username
if password:
- defuser['password'] = password
+ defuser['passwd'] = encrypt_pass(password)
defuser['lock_passwd'] = False
if defuser:
@@ -437,6 +437,10 @@ def read_azure_ovf(contents):
return (md, ud, cfg)
+def encrypt_pass(password, salt_id="$6$"):
+ return crypt.crypt(password, salt_id + util.rand_str(strlen=16))
+
+
def list_possible_azure_ds_devs():
# return a sorted list of devices that might have a azure datasource
devlist = []