automatically grab the ssh key needed for each server exported

Change-Id: Ia051089b5ac18f2e17fb7e5171ebfcc278fd6d03
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-04-30 21:55:07 +00:00
parent 2d06e50ac6
commit 21e4d45eb1
1 changed files with 9 additions and 3 deletions

View File

@ -183,17 +183,23 @@ class Resolver:
yield self._map_uuids('subnet', subnet.name, subnet.id, 'subnet.id') yield self._map_uuids('subnet', subnet.name, subnet.id, 'subnet.id')
def server(self, server, save_state): def server(self, server, save_state):
# The ssh key needed to login to the server.
keypair = self.cloud.get_keypair(server.key_name)
yield from self.keypair(keypair)
# The security groups and other network settings for the
# server.
for sg in server.security_groups: for sg in server.security_groups:
sg_data = self.cloud.get_security_group(sg.name) sg_data = self.cloud.get_security_group(sg.name)
yield from self.security_group(sg_data) yield from self.security_group(sg_data)
for net_name in server.networks:
net_data = self.cloud.get_network(net_name)
yield from self.network(net_data)
# Any volumes attached to the server.
vol_names = [] vol_names = []
for vol in server.volumes: for vol in server.volumes:
vol_data = self.cloud.get_volume(vol.id) vol_data = self.cloud.get_volume(vol.id)
vol_names.append(vol_data.name) vol_names.append(vol_data.name)
yield from self.volume(vol_data, save_state) yield from self.volume(vol_data, save_state)
for net_name in server.networks:
net_data = self.cloud.get_network(net_name)
yield from self.network(net_data)
# FIXME(dhellmann): Need to handle public IPs. Use auto_ip? # FIXME(dhellmann): Need to handle public IPs. Use auto_ip?
# FIXME(dhellmann): For now assume the image exists, but we may # FIXME(dhellmann): For now assume the image exists, but we may
# have to dump and recreate it. # have to dump and recreate it.