summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-03-20 09:36:09 +0000
committerMorph (on behalf of Adam Coldrick) <adam.coldrick@codethink.co.uk>2015-03-20 09:36:09 +0000
commitc7525cb3313e394ce32e6759e8e60d6816dc665e (patch)
treef1c891364f22618dce3d0d90a106ba561319e909
parent65ee2f821c8c642aae60f462ff8f209ebdc93e20 (diff)
downloadmorph-c7525cb3313e394ce32e6759e8e60d6816dc665e.tar.gz
Morph build bac824834a1646e591aaf23425933247
System branch: master
-rw-r--r--morphlib/plugins/deploy_plugin.py57
1 files changed, 37 insertions, 20 deletions
diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py
index c9890b13..1271fd86 100644
--- a/morphlib/plugins/deploy_plugin.py
+++ b/morphlib/plugins/deploy_plugin.py
@@ -562,8 +562,34 @@ class DeployPlugin(cliapp.Plugin):
self.checkout_stratum(path, stratum, lac, rac)
morphlib.builder.ldconfig(self.app.runcmd, path)
+ def checkout_system(self, path, artifact, build_command):
+ # Checkout the strata involved in the artifact into a tempdir
+ self.app.status(msg='Checking out strata in system')
+ self.checkout_strata(system_tree, artifact,
+ build_command.lac, build_command.rac)
+
+ self.app.status(msg='Checking out system for configuration')
+ if build_command.lac.has(artifact):
+ build_command.lac.get(artifact, system_tree)
+ elif build_command.rac.has(artifact):
+ build_command.cache_artifacts_locally([artifact])
+ build_command.lac.get(artifact, system_tree)
+ else:
+ raise cliapp.AppException('Deployment failed as system is'
+ ' not yet built.\nPlease ensure'
+ ' the system is built before'
+ ' deployment.')
+
+ def checkout_components(self, path, components, build_command):
+ if not components:
+ raise cliapp.AppException('Deployment failed as no components '
+ 'were specified for deployment and '
+ '--partial was set.')
+ # TODO: for each component: ostree_checkout(component)
+ pass
+
def setup_deploy(self, build_command, deploy_tempdir, root_repo_dir, ref,
- artifact, deployment_type, location, env):
+ artifact, deployment_type, location, env, components=[]):
# deployment_type, location and env are only used for saving metadata
deployment_dir = tempfile.mkdtemp(dir=deploy_tempdir)
@@ -583,26 +609,16 @@ class DeployPlugin(cliapp.Plugin):
deploy_tree = os.path.join(deployment_dir,
'overlay-deploy-%s' % artifact.name)
try:
- # Checkout the strata involved in the artifact into a tempdir
- self.app.status(msg='Checking out strata in system')
- self.checkout_strata(system_tree, artifact,
- build_command.lac, build_command.rac)
-
- self.app.status(msg='Checking out system for configuration')
- if build_command.lac.has(artifact):
- build_command.lac.get(artifact, system_tree)
- elif build_command.rac.has(artifact):
- build_command.cache_artifacts_locally([artifact])
- build_command.lac.get(artifact, system_tree)
+ if self.app.settings['partial']:
+ self.checkout_components(system_tree, components)
+ self.app.status(
+ msg='Components %(components)s checkout out at %(path)s',
+ components=', '.join(components), path=system_tree)
else:
- raise cliapp.AppException('Deployment failed as system is'
- ' not yet built.\nPlease ensure'
- ' the system is built before'
- ' deployment.')
-
- self.app.status(
- msg='System checked out at %(system_tree)s',
- system_tree=system_tree)
+ self.checkout_system(system_tree, artifact, build_command)
+ self.app.status(
+ msg='System checked out at %(system_tree)s',
+ system_tree=system_tree)
union_filesystem = self.app.settings['union-filesystem']
morphlib.fsutils.overlay_mount(self.app.runcmd,
@@ -717,6 +733,7 @@ class DeployPlugin(cliapp.Plugin):
is_password = morphlib.util.env_variable_is_password
return { k:v for k, v in env.iteritems() if not is_password(k) }
+ # TODO: put components in this if doing partial deployment
meta = {
'system-artifact-name': system_artifact.name,
'configuration': remove_passwords(env),