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
1=== modified file 'nova/api/ec2/cloud.py'
2--- nova/api/ec2/cloud.py 2011-09-15 19:30:26 +0000
3+++ nova/api/ec2/cloud.py 2011-09-15 19:54:43 +0000
4@@ -326,11 +326,6 @@
5 instance_ref = db.instance_get(ctxt, instance_ref[0]['id'])
6
7 mpi = self._get_mpi_data(ctxt, instance_ref['project_id'])
8- if instance_ref['key_name']:
9- keys = {'0': {'_name': instance_ref['key_name'],
10- 'openssh-key': instance_ref['key_data']}}
11- else:
12- keys = ''
13 hostname = instance_ref['hostname']
14 host = instance_ref['host']
15 availability_zone = self._get_availability_zone_by_host(ctxt, host)
16@@ -358,11 +353,16 @@
17 'placement': {'availability-zone': availability_zone},
18 'public-hostname': hostname,
19 'public-ipv4': floating_ip or '',
20- 'public-keys': keys,
21 'reservation-id': instance_ref['reservation_id'],
22 'security-groups': security_groups,
23 'mpi': mpi}}
24
25+ # public-keys should be in meta-data only if user specified one
26+ if instance_ref['key_name']:
27+ data['meta-data']['public-keys'] = {
28+ '0': {'_name': instance_ref['key_name'],
29+ 'openssh-key': instance_ref['key_data']}}
30+
31 for image_type in ['kernel', 'ramdisk']:
32 if instance_ref.get('%s_id' % image_type):
33 ec2_id = self.image_ec2_id(instance_ref['%s_id' % image_type],

Subscribers

People subscribed via source and target branches