summaryrefslogtreecommitdiff
path: root/extensions/ssh-rsync.check
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-19 15:33:22 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-06-19 15:33:22 +0000
commit53a5919884b98613a99fe7a8397e9f2f01190b8f (patch)
tree1422b88cbba6ca6da5e45bf50690d152ceb529ab /extensions/ssh-rsync.check
parentcd9e3ba567a704af2585ad5b46d5b1eb9609fdd4 (diff)
parente4c6b8a69f0df2d0b3beac46865a66e0de527151 (diff)
downloaddefinitions-53a5919884b98613a99fe7a8397e9f2f01190b8f.tar.gz
Merge branch 'baserock/adamcoldrick/remove-dependencies-v3'
This stops the deployment extensions from depending on morphlib and cliapp, as well as setting the definitions version to 5. Reviewed-by: Sam Thursfield <sam.thursfield@codethink.co.uk> Reviewed-by: Paul Sherwood <paul.sherwood@codethink.co.uk>
Diffstat (limited to 'extensions/ssh-rsync.check')
-rwxr-xr-xextensions/ssh-rsync.check26
1 files changed, 14 insertions, 12 deletions
diff --git a/extensions/ssh-rsync.check b/extensions/ssh-rsync.check
index c3bdfd29..436aaae0 100755
--- a/extensions/ssh-rsync.check
+++ b/extensions/ssh-rsync.check
@@ -15,26 +15,27 @@
'''Preparatory checks for Morph 'ssh-rsync' write extension'''
-import cliapp
import os
-import morphlib.writeexts
+import writeexts
-class SshRsyncCheckExtension(morphlib.writeexts.WriteExtension):
+
+class SshRsyncCheckExtension(writeexts.WriteExtension):
def process_args(self, args):
if len(args) != 1:
- raise cliapp.AppException('Wrong number of command line args')
+ raise writeexts.ExtensionError(
+ 'Wrong number of command line args')
upgrade = self.get_environment_boolean('UPGRADE')
if not upgrade:
- raise cliapp.AppException(
+ raise writeexts.ExtensionError(
'The ssh-rsync write is for upgrading existing remote '
'Baserock machines. It cannot be used for an initial '
'deployment.')
if os.environ.get('VERSION_LABEL', '') == '':
- raise cliapp.AppException(
+ raise writeexts.ExtensionError(
'A VERSION_LABEL must be set when deploying an upgrade.')
location = args[0]
@@ -47,17 +48,18 @@ class SshRsyncCheckExtension(morphlib.writeexts.WriteExtension):
self.check_command_exists(location, 'rsync')
def check_is_baserock_system(self, location):
- output = cliapp.ssh_runcmd(location, ['sh', '-c',
- 'test -d /baserock || echo -n dirnotfound'])
+ output = writeexts.ssh_runcmd(
+ location,
+ ['sh', '-c', 'test -d /baserock || echo -n dirnotfound'])
if output == 'dirnotfound':
- raise cliapp.AppException('%s is not a baserock system'
- % location)
+ raise writeexts.ExtensionError('%s is not a baserock system'
+ % location)
def check_command_exists(self, location, command):
test = 'type %s > /dev/null 2>&1 || echo -n cmdnotfound' % command
- output = cliapp.ssh_runcmd(location, ['sh', '-c', test])
+ output = writeexts.ssh_runcmd(location, ['sh', '-c', test])
if output == 'cmdnotfound':
- raise cliapp.AppException(
+ raise writeexts.ExtensionError(
"%s does not have %s" % (location, command))