From 407b82bd84bd2a40cfaa34b70ebe0405c5931720 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 9 Sep 2015 16:57:49 +0000 Subject: Allow flavour to be passed on CLI. --- scripts/release-test-os | 30 ++++++++++++++++++------------ 1 file 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 --net-id --image-file ') - self.deploy_and_test_systems(host_machine, - self.settings['net-id'], - self.settings['image-file']) + 'Usage: release-test-os --os-host --net-id --image-file --flavour ') + self.deploy_and_test_systems() if __name__ == '__main__': -- cgit v1.2.1