Introduce run_settings in build_servers.yml

Will be used when starting instances during integration testing.
This commit is contained in:
Anders Ingemann 2015-12-13 18:00:40 +01:00
parent 35121f9c7f
commit bd7675bedf
4 changed files with 35 additions and 5 deletions

View file

@ -165,7 +165,26 @@ at ``/root/guest_additions.iso`` on server 1, while server 2 has it at
* ``guest_additions`` specifies the path to the VirtualBox guest additions ISO
on the remote machine.
* ``apt_proxy`` sets the configuration for the `apt_proxy plugin <../plugins/apt_proxy>`.
* ``ec2-credentials`` contains all the settings you know from EC2 manifests,
note that when running `integration tests <../../tests/integration>`__,
these credentials are also used when running instances.
* ``ec2-credentials`` contains all the settings you know from EC2 manifests.
* ``s3-region`` overrides the s3 bucket region when bootstrapping S3 backed images.
Run settings
~~~~~~~~~~~~~~
The run settings hold information about how to start a bootstrapped image.
This is useful only when running integration tests.
.. code:: yaml
local:
type: local
can_bootstrap:
- ec2-s3
release: jessie
run_settings:
ec2-credentials:
access-key: AFAKEACCESSKEYFORAWS
secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
* ``ec2-credentials`` contains the access key and secret key used to boot
an EC2 AMI.

View file

@ -50,6 +50,16 @@ definitions:
port: {type: integer}
persistent: {type: boolean}
required: [address, port]
run_settings:
type: object
properties:
ec2-credentials:
required: [access-key, secret-key]
type: object
properties:
access-key: {type: string}
secret-key: {type: string}
additional_properties: false
ssh:
type: object

View file

@ -6,6 +6,7 @@ class BuildServer(object):
self.name = name
self.settings = settings
self.build_settings = settings.get('build_settings', {})
self.run_settings = settings.get('run_settings', {})
self.can_bootstrap = settings['can_bootstrap']
self.release = settings.get('release', None)

View file

@ -29,8 +29,8 @@ def prepare_bootstrap(manifest, build_server):
@contextmanager
def boot_image(manifest, build_server, bootstrap_info, instance_type=None):
credentials = {'access-key': build_server.build_settings['ec2-credentials']['access-key'],
'secret-key': build_server.build_settings['ec2-credentials']['secret-key']}
credentials = {'access-key': build_server.run_settings['ec2-credentials']['access-key'],
'secret-key': build_server.run_settings['ec2-credentials']['secret-key']}
from boto.ec2 import connect_to_region as ec2_connect
ec2_connection = ec2_connect(bootstrap_info._ec2['region'],
aws_access_key_id=credentials['access-key'],