Merge lp:~smoser/nova/lp845155 into lp:~hudson-openstack/nova/milestone-proposed

Proposed by Vish Ishaya
Status: Merged
Approved by: Vish Ishaya
Approved revision: 1543
Merged at revision: 1171
Proposed branch: lp:~smoser/nova/lp845155
Merge into: lp:~hudson-openstack/nova/milestone-proposed
Diff against target: 33 lines (+6/-6)
1 file modified
nova/api/ec2/cloud.py (+6/-6)
To merge this branch: bzr merge lp:~smoser/nova/lp845155
Reviewer Review Type Date Requested Status
OpenStack release team Pending
Review via email: mp+75621@code.launchpad.net

Description of the change

if no public-key is given (--key), do not show public-keys in metadata service

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/api/ec2/cloud.py'
--- nova/api/ec2/cloud.py 2011-09-15 19:30:26 +0000
+++ nova/api/ec2/cloud.py 2011-09-15 19:54:43 +0000
@@ -326,11 +326,6 @@
326 instance_ref = db.instance_get(ctxt, instance_ref[0]['id'])326 instance_ref = db.instance_get(ctxt, instance_ref[0]['id'])
327327
328 mpi = self._get_mpi_data(ctxt, instance_ref['project_id'])328 mpi = self._get_mpi_data(ctxt, instance_ref['project_id'])
329 if instance_ref['key_name']:
330 keys = {'0': {'_name': instance_ref['key_name'],
331 'openssh-key': instance_ref['key_data']}}
332 else:
333 keys = ''
334 hostname = instance_ref['hostname']329 hostname = instance_ref['hostname']
335 host = instance_ref['host']330 host = instance_ref['host']
336 availability_zone = self._get_availability_zone_by_host(ctxt, host)331 availability_zone = self._get_availability_zone_by_host(ctxt, host)
@@ -358,11 +353,16 @@
358 'placement': {'availability-zone': availability_zone},353 'placement': {'availability-zone': availability_zone},
359 'public-hostname': hostname,354 'public-hostname': hostname,
360 'public-ipv4': floating_ip or '',355 'public-ipv4': floating_ip or '',
361 'public-keys': keys,
362 'reservation-id': instance_ref['reservation_id'],356 'reservation-id': instance_ref['reservation_id'],
363 'security-groups': security_groups,357 'security-groups': security_groups,
364 'mpi': mpi}}358 'mpi': mpi}}
365359
360 # public-keys should be in meta-data only if user specified one
361 if instance_ref['key_name']:
362 data['meta-data']['public-keys'] = {
363 '0': {'_name': instance_ref['key_name'],
364 'openssh-key': instance_ref['key_data']}}
365
366 for image_type in ['kernel', 'ramdisk']:366 for image_type in ['kernel', 'ramdisk']:
367 if instance_ref.get('%s_id' % image_type):367 if instance_ref.get('%s_id' % image_type):
368 ec2_id = self.image_ec2_id(instance_ref['%s_id' % image_type],368 ec2_id = self.image_ec2_id(instance_ref['%s_id' % image_type],

Subscribers

People subscribed via source and target branches