From 29f0115963bf43622c8113bb95c53dd8b425cc9e Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 16 Dec 2014 17:51:15 +0000 Subject: pxeboot.check: Check if nfs-server is running when is needed --- pxeboot.check | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'pxeboot.check') diff --git a/pxeboot.check b/pxeboot.check index 885a0541..468b76e2 100755 --- a/pxeboot.check +++ b/pxeboot.check @@ -2,6 +2,7 @@ import itertools import os +import subprocess import sys flatten = itertools.chain.from_iterable @@ -66,11 +67,18 @@ else: if all(o in os.environ for o in opt_set)) except ValueError as e: - print('More than one candidate for PXEBOOT_MODE, please ' - 'set a value for it. Type `morph help pxeboot.write for ' - 'more info') + print ('More than one candidate for PXEBOOT_MODE, please ' + 'set a value for it. Type `morph help pxeboot.write for ' + 'more info') sys.exit(1) if mode not in valid_modes: print('%s is not a valid PXEBOOT_MODE' % mode) sys.exit(1) + +if mode != 'existing-server': + if subprocess.call(['systemctl', 'status', 'nfs-server']) != 0: + print ('ERROR: nfs-server.service is not running and is needed ' + 'for this deployment. Please, run `systemctl start nfs-server` ' + 'and try `morph deploy` again.') + sys.exit(1) -- cgit v1.2.1