Merge lp:~darkmuggle-deactivatedaccount/cloud-init/1494816 into lp:~cloud-init-dev/cloud-init/trunk

Proposed by Ben Howard
Status: Merged
Merged at revision: 1144
Proposed branch: lp:~darkmuggle-deactivatedaccount/cloud-init/1494816
Merge into: lp:~cloud-init-dev/cloud-init/trunk
Diff against target: 27 lines (+16/-1)
1 file modified
cloudinit/config/cc_snappy.py (+16/-1)
To merge this branch: bzr merge lp:~darkmuggle-deactivatedaccount/cloud-init/1494816
Reviewer Review Type Date Requested Status
Scott Moser Pending
cloud-init Commiters Pending
Review via email: mp+270865@code.launchpad.net

Description of the change

Conditional enablement for SSH on Snappy.

To post a comment you must log in.
1145. By Ben Howard

Refinements on SSH enablement

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cloudinit/config/cc_snappy.py'
2--- cloudinit/config/cc_snappy.py 2015-05-01 09:38:56 +0000
3+++ cloudinit/config/cc_snappy.py 2015-09-11 20:05:05 +0000
4@@ -274,7 +274,22 @@
5 LOG.warn("'%s' failed for '%s': %s",
6 pkg_op['op'], pkg_op['name'], e)
7
8- disable_enable_ssh(mycfg.get('ssh_enabled', False))
9+ # Default to disabling SSH
10+ ssh_enabled = mycfg.get('ssh_enabled', False)
11+
12+ # If the user has not explicitly enabled or disabled SSH, then enable it
13+ # when password SSH authentication is requested or there are SSH keys
14+ if mycfg.get('ssh_enabled', None) is not False:
15+ user_ssh_keys = cloud.get_public_ssh_keys() or None
16+ password_auth_enabled = cfg.get('ssh_pwauth', False)
17+ if user_ssh_keys:
18+ LOG.debug("Enabling SSH, user SSH keys provided")
19+ ssh_enabled = True
20+ elif password_auth_enabled:
21+ LOG.debug("Enabling SSH, password authentication requested")
22+ ssh_enabled = True
23+
24+ disable_enable_ssh(ssh_enabled)
25
26 if fails:
27 raise Exception("failed to install/configure snaps")