diff --git a/buildman/manager/executor.py b/buildman/manager/executor.py index e3a6a4f4a..beef14881 100644 --- a/buildman/manager/executor.py +++ b/buildman/manager/executor.py @@ -113,32 +113,32 @@ class EC2Executor(BuilderExecutor): logger.debug('Generated cloud config: %s', user_data) ec2_conn = self._get_conn() - reservation = yield ec2_conn.run_instances( + reservation = yield From(ec2_conn.run_instances( coreos_ami, instance_type=self.executor_config['EC2_INSTANCE_TYPE'], security_groups=self.executor_config['EC2_SECURITY_GROUP_IDS'], key_name=self.executor_config.get('EC2_KEY_NAME', None), user_data=user_data, instance_initiated_shutdown_behavior='terminate', - ) + )) if not reservation.instances: raise ExecutorException('Unable to spawn builder instance.') elif len(reservation.instances) != 1: raise ExecutorException('EC2 started wrong number of instances!') - launched = reservation.instances[0] - launched.add_tags({ + launched = AsyncWrapper(reservation.instances[0]) + yield From(launched.add_tags({ 'Name': 'Quay Ephemeral Builder', 'Realm': realm, 'Token': token, - }) + })) raise Return(launched.id) @coroutine def stop_builder(self, builder_id): ec2_conn = self._get_conn() - stopped_instances = yield ec2_conn.stop_instances([builder_id], force=True) + stopped_instances = yield From(ec2_conn.stop_instances([builder_id], force=True)) if builder_id not in [si.id for si in stopped_instances]: raise ExecutorException('Unable to stop instance: %s' % builder_id)