diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-06-04 16:22:47 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-06-05 13:12:46 +0000 |
commit | 05c366e2ea93d1f7739054bf723d9e3441245733 (patch) | |
tree | a4029aa9ff4b4eb44b37be8aeadda96d33a53f29 | |
parent | e4ec4af6a2056bb5912aabac453d8e0c58d8a38e (diff) | |
download | morph-05c366e2ea93d1f7739054bf723d9e3441245733.tar.gz |
S7904: Add disk space checks before build & deploy
The same check that cachedir and tempdir are large enough is used
for both build and build-morphology.
Deploy only checks for tempdir being large enough.
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 7 | ||||
-rw-r--r-- | morphlib/plugins/build_plugin.py | 9 | ||||
-rw-r--r-- | morphlib/plugins/deploy_plugin.py | 9 |
3 files changed, 24 insertions, 1 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 215ac6c8..38e9ccc3 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -1527,6 +1527,13 @@ class BranchAndMergePlugin(cliapp.Plugin): raise cliapp.AppException('morph build expects exactly one ' 'parameter: the system to build') + # Raise an exception if there is not enough space + morphlib.util.check_disk_available( + self.app.settings['tempdir'], + self.app.settings['tempdir-min-space'], + self.app.settings['cachedir'], + self.app.settings['cachedir-min-space']) + system_name = args[0] # Deduce workspace and system branch and branch root repository. diff --git a/morphlib/plugins/build_plugin.py b/morphlib/plugins/build_plugin.py index 6583a6a8..128187cf 100644 --- a/morphlib/plugins/build_plugin.py +++ b/morphlib/plugins/build_plugin.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012,2013 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -36,6 +36,13 @@ class BuildPlugin(cliapp.Plugin): ''' + # Raise an exception if there is not enough space + morphlib.util.check_disk_available( + self.app.settings['tempdir'], + self.app.settings['tempdir-min-space'], + self.app.settings['cachedir'], + self.app.settings['cachedir-min-space']) + build_command = morphlib.buildcommand.BuildCommand(self.app) build_command = self.app.hookmgr.call('new-build-command', build_command) diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py index 7a6f2b92..574a5e04 100644 --- a/morphlib/plugins/deploy_plugin.py +++ b/morphlib/plugins/deploy_plugin.py @@ -66,6 +66,15 @@ class DeployPlugin(cliapp.Plugin): raise cliapp.AppException( 'Too few arguments to deploy command (see help)') + # Raise an exception if there is not enough space in tempdir + # / for the path and 0 for the minimum size is a no-op + # it exists because it is complicated to check the available + # disk space given dirs may be on the same device + morphlib.util.check_disk_available( + self.app.settings['tempdir'], + self.app.settings['tempdir-min-space'], + '/', 0) + deployment_type = args[0] system_name = args[1] location = args[2] |