~jbauer/cloud-init/salt

« back to all changes in this revision

Viewing changes to cloudinit/CloudConfig/cc_ssh.py

  • Committer: Scott Moser
  • Date: 2012-01-17 20:59:21 UTC
  • mfrom: (505.1.4 trunk.cleanups)
  • Revision ID: smoser@ubuntu.com-20120117205921-pyf7ybik03gq3t3g
miscellaneous cleanups, and add tools/run-pylint

adding run-pylint makes it easy to run pylint with given configuration
against the code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
"no-X11-forwarding,command=\"echo \'Please login as the user \\\"$USER\\\" " \
26
26
"rather than the user \\\"root\\\".\';echo;sleep 10\""
27
27
 
28
 
global_log = None
29
 
 
30
28
 
31
29
def handle(_name, cfg, cloud, log, _args):
32
 
    global global_log
33
 
    global_log = log
34
30
 
35
31
    # remove the static keys from the pristine image
36
32
    if cfg.get("ssh_deletekeys", True):
87
83
            cfgkeys = cfg["ssh_authorized_keys"]
88
84
            keys.extend(cfgkeys)
89
85
 
90
 
        apply_credentials(keys, user, disable_root, disable_root_opts)
 
86
        apply_credentials(keys, user, disable_root, disable_root_opts, log)
91
87
    except:
92
88
        util.logexc(log)
93
89
        log.warn("applying credentials failed!\n")
94
90
 
95
91
 
96
92
def apply_credentials(keys, user, disable_root,
97
 
                      disable_root_opts=DISABLE_ROOT_OPTS, log=global_log):
 
93
                      disable_root_opts=DISABLE_ROOT_OPTS, log=None):
98
94
    keys = set(keys)
99
95
    if user:
100
96
        sshutil.setup_user_keys(keys, user, '', log)