diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-05-19 10:41:07 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-05-27 14:28:07 +0000 |
commit | 87bfac4ebf7969319d34e1c2562c3179739bd868 (patch) | |
tree | 148852ff476ca028a7fd4070a8d256b161afb85d /morphlib/plugins/deploy_plugin.py | |
parent | 4ce4366ca03873da4c11000b564dbcd487399e59 (diff) | |
download | morph-87bfac4ebf7969319d34e1c2562c3179739bd868.tar.gz |
morph deploy: Allow overriding UPGRADE in definition or on command line
Concievably, you may want to force a cluster to behave as an upgrade
regardless of whether --upgrade is set or not.
This would allow two use cases that are not currently possible:
1. To force a cluster to be upgrade-only, which would make our
instructions for the upgrade-devel.morph cluster simpler.
2. To allow a cluster to deploy then immediately upgrade.
One potential use for this would be to create a disk image with
multiple versions on it.
This also works as a work-around for --upgrade implying UPGRADE=yes for
subsystem deployments, but that should be fixed separately.
Change-Id: I2ec4b880fc9bce37adee9df67696f088c76650f4
Diffstat (limited to 'morphlib/plugins/deploy_plugin.py')
-rw-r--r-- | morphlib/plugins/deploy_plugin.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 7ab2e64b..cca95e69 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -65,6 +65,12 @@ def configuration_for_system(system_id, vars_from_commandline, return final_env +def determine_if_upgrade(deploy_env, upgrade_config): + if 'UPGRADE' not in deploy_env: + return upgrade_config + return deploy_env['UPGRADE'].lower() in ('1', 'true', 'yes') + + def deployment_type_and_location(system_id, config, is_upgrade): '''Get method and location for deploying a given system. @@ -493,12 +499,13 @@ class DeployPlugin(cliapp.Plugin): final_env = configuration_for_system( system_id, env_vars, deploy_defaults, deploy_params) - is_upgrade = ('yes' if self.app.settings['upgrade'] - else 'no') - final_env['UPGRADE'] = is_upgrade + is_upgrade = determine_if_upgrade( + deploy_env=final_env, + upgrade_config=self.app.settings['upgrade']) + final_env['UPGRADE'] = ('yes' if is_upgrade else 'no') deployment_type, location = deployment_type_and_location( - system_id, final_env, self.app.settings['upgrade']) + system_id, final_env, is_upgrade) components = self._sanitise_morphology_paths( deploy_params.get('partial-deploy-components', []), sb) |