diff options
| author | Scott Moser <smoser@ubuntu.com> | 2011-09-15 20:04:31 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-09-15 20:04:31 +0000 |
| commit | 09752178191cd18c12e7845d1e199a112170ba17 (patch) | |
| tree | 6303c275ba97dda7d480f96be5d4f3ce36263cb3 /nova/api | |
| parent | 0e5e684b4079749c922143be76183c65e6403e5c (diff) | |
| parent | 5ddfd1c1add955aa14c5e5174b1942eb8f748031 (diff) | |
| download | nova-09752178191cd18c12e7845d1e199a112170ba17.tar.gz nova-09752178191cd18c12e7845d1e199a112170ba17.tar.xz nova-09752178191cd18c12e7845d1e199a112170ba17.zip | |
if no public-key is given (--key), do not show public-keys in metadata service
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 0efb90d6e..fb1afa43a 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -326,11 +326,6 @@ class CloudController(object): instance_ref = db.instance_get(ctxt, instance_ref[0]['id']) mpi = self._get_mpi_data(ctxt, instance_ref['project_id']) - if instance_ref['key_name']: - keys = {'0': {'_name': instance_ref['key_name'], - 'openssh-key': instance_ref['key_data']}} - else: - keys = '' hostname = instance_ref['hostname'] host = instance_ref['host'] availability_zone = self._get_availability_zone_by_host(ctxt, host) @@ -358,11 +353,16 @@ class CloudController(object): 'placement': {'availability-zone': availability_zone}, 'public-hostname': hostname, 'public-ipv4': floating_ip or '', - 'public-keys': keys, 'reservation-id': instance_ref['reservation_id'], 'security-groups': security_groups, 'mpi': mpi}} + # public-keys should be in meta-data only if user specified one + if instance_ref['key_name']: + data['meta-data']['public-keys'] = { + '0': {'_name': instance_ref['key_name'], + 'openssh-key': instance_ref['key_data']}} + for image_type in ['kernel', 'ramdisk']: if instance_ref.get('%s_id' % image_type): ec2_id = self.image_ec2_id(instance_ref['%s_id' % image_type], |
