diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2015-09-09 16:57:49 +0000 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2015-09-11 08:50:45 +0000 |
commit | 407b82bd84bd2a40cfaa34b70ebe0405c5931720 (patch) | |
tree | 3b60a468fe1c041853503aaff46b141cb8d047f7 | |
parent | af06b9ef3de9ae794132973b45bb8ae4d0da2b68 (diff) | |
download | definitions-407b82bd84bd2a40cfaa34b70ebe0405c5931720.tar.gz |
Allow flavour to be passed on CLI.
-rwxr-xr-x | scripts/release-test-os | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/scripts/release-test-os b/scripts/release-test-os index 3db27e11..20339174 100755 --- a/scripts/release-test-os +++ b/scripts/release-test-os @@ -158,10 +158,11 @@ class DeployedSystemInstance(object): class Deployment(object): - def __init__(self, host_machine, net_id, image_file): + def __init__(self, host_machine, net_id, image_file, flavour): self.host_machine = host_machine self.net_id = net_id self.image_file = image_file + self.flavour = flavour @staticmethod def _ssh_host_key_exists(hostname): @@ -207,7 +208,7 @@ class Deployment(object): # TODO: Ensure this is cleaned up when something raises an exception # TODO: use python-novaclient args = ['nova', 'boot', - '--flavor', 'm1.medium', + '--flavor', self.flavour, '--image', hostname, '--user-data', '/usr/lib/mason/os-init-script', '--nic', "net-id=%s" % (self.net_id), @@ -269,6 +270,10 @@ class ReleaseApp(cliapp.Application): 'Path to system image to test', default=None, group=group_main) + self.settings.string(['flavour'], + 'Name of flavour to use for instance', + default=None, + group=group_main) def run_tests(self, instance): instance.wait_until_online() @@ -291,10 +296,16 @@ class ReleaseApp(cliapp.Application): for test in tests: test(instance) - def deploy_and_test_systems(self, host_machine, net_id, image_file): + def deploy_and_test_systems(self): """Run the deployments and tests""" - deployment = Deployment(host_machine, net_id, image_file) + # TODO: Don't assume root is the user we ssh to for tests + host_machine = VMHost('root', self.settings['os-host']) + + deployment = Deployment(host_machine, + self.settings['net-id'], + self.settings['image-file'], + self.settings['flavour']) instance = deployment.deploy() try: @@ -304,18 +315,13 @@ class ReleaseApp(cliapp.Application): def process_args(self, args): """Process the command line args and kick off the builds/tests""" - for setting in ('os-host', 'net-id', 'image-file'): + for setting in ('os-host', 'net-id', 'image-file', 'flavour'): self.settings.require(setting) - # TODO: Don't assume root is the user we ssh to for tests - host_machine = VMHost('root', self.settings['os-host']) - if len(args) != 0: raise cliapp.AppException( - 'Usage: release-test-os --os-host <HOST> --net-id <ID> --image-file <PATH>') - self.deploy_and_test_systems(host_machine, - self.settings['net-id'], - self.settings['image-file']) + 'Usage: release-test-os --os-host <HOST> --net-id <ID> --image-file <PATH> --flavour <NAME>') + self.deploy_and_test_systems() if __name__ == '__main__': |