summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_set_passwords.py
diff options
context:
space:
mode:
authorNate House nathan.house@rackspace.com <>2014-02-04 16:09:09 -0600
committerNate House nathan.house@rackspace.com <>2014-02-04 16:09:09 -0600
commit6e0aaf44c7a869d35a962a2d60be2d833023d4ec (patch)
tree2cf2bf8727e389c53e25190becb2ba44ac2ffd9d /cloudinit/config/cc_set_passwords.py
parent6922fc8294e38ee0780e9d74da7d3ec010a3cd3c (diff)
parent0efeb26736ddae2967c14a9440088594da32070d (diff)
downloadvyos-cloud-init-6e0aaf44c7a869d35a962a2d60be2d833023d4ec.tar.gz
vyos-cloud-init-6e0aaf44c7a869d35a962a2d60be2d833023d4ec.zip
Merge gentoo branch and updated set-password to support systemctl
Diffstat (limited to 'cloudinit/config/cc_set_passwords.py')
-rw-r--r--cloudinit/config/cc_set_passwords.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
index 56a36906..967769de 100644
--- a/cloudinit/config/cc_set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
@@ -36,6 +36,7 @@ PW_SET = (letters.translate(None, 'loLOI') +
def handle(_name, cfg, cloud, log, args):
+
if len(args) != 0:
# if run from command line, and give args, wipe the chpasswd['list']
password = args[0]
@@ -136,9 +137,12 @@ def handle(_name, cfg, cloud, log, args):
util.write_file(ssh_util.DEF_SSHD_CFG, "\n".join(lines))
try:
- cmd = ['service']
+ cmd = cloud.distro.init_cmd # Default service
cmd.append(cloud.distro.get_option('ssh_svcname', 'ssh'))
cmd.append('restart')
+ if 'systemctl' in cmd: # Switch action ordering
+ cmd[1], cmd[2] = cmd[2], cmd[1]
+ cmd = filter(None, cmd) # Remove empty arguments
util.subp(cmd)
log.debug("Restarted the ssh daemon")
except: