~oddbloke/cloud-init/lp1506187

« back to all changes in this revision

Viewing changes to cloudinit/sources/DataSourceAzure.py

  • Committer: Daniel Watkins
  • Date: 2015-10-20 09:36:04 UTC
  • mfrom: (1149.1.1 cloud-init)
  • Revision ID: daniel.watkins@canonical.com-20151020093604-4luumedfqkjj2r9a
AltCloud: Remove --quiet option from udevadm call

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
            wait_for = [shcfgxml]
149
149
 
150
150
            fp_files = []
 
151
            key_value = None
151
152
            for pk in self.cfg.get('_pubkeys', []):
152
 
                bname = str(pk['fingerprint'] + ".crt")
153
 
                fp_files += [os.path.join(ddir, bname)]
 
153
                if pk.get('value', None):
 
154
                    key_value = pk['value']
 
155
                    LOG.debug("ssh authentication: using value from fabric")
 
156
                else:
 
157
                    bname = str(pk['fingerprint'] + ".crt")
 
158
                    fp_files += [os.path.join(ddir, bname)]
 
159
                    LOG.debug("ssh authentication: using fingerprint from fabirc")
154
160
 
155
161
            missing = util.log_time(logfunc=LOG.debug, msg="waiting for files",
156
162
                                    func=wait_for_files,
166
172
                metadata['instance-id'] = iid_from_shared_config(shcfgxml)
167
173
            except ValueError as e:
168
174
                LOG.warn("failed to get instance id in %s: %s", shcfgxml, e)
169
 
        metadata['public-keys'] = pubkeys_from_crt_files(fp_files)
 
175
 
 
176
        metadata['public-keys'] = key_value or pubkeys_from_crt_files(fp_files)
170
177
        return metadata
171
178
 
172
179
    def get_data(self):
497
504
    for pk_node in pubkeys:
498
505
        if not pk_node.hasChildNodes():
499
506
            continue
500
 
        cur = {'fingerprint': "", 'path': ""}
 
507
 
 
508
        cur = {'fingerprint': "", 'path': "", 'value': ""}
501
509
        for child in pk_node.childNodes:
502
510
            if child.nodeType == text_node or not child.localName:
503
511
                continue