summaryrefslogtreecommitdiffstats
path: root/GitAutoDeploy.py
diff options
context:
space:
mode:
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-xGitAutoDeploy.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py
index 4ad013d..0b4aff8 100755
--- a/GitAutoDeploy.py
+++ b/GitAutoDeploy.py
@@ -19,23 +19,28 @@ class GitAutoDeploy(BaseHTTPRequestHandler):
try:
configString = open(myClass.CONFIG_FILEPATH).read()
except:
- sys.exit('Could not load ' + myClass.CONFIG_FILEPATH + ' file')
+ print "Could not load %s file" % myClass.CONFIG_FILEPATH
+ sys.exit(2)
try:
myClass.config = json.loads(configString)
except:
- sys.exit(myClass.CONFIG_FILEPATH + ' file is not valid json')
+ print "%s file is not valid JSON" % myClass.CONFIG_FILEPATH
+ sys.exit(2)
for repository in myClass.config['repositories']:
if(not os.path.isdir(repository['path'])):
- sys.exit('Directory ' + repository['path'] + ' not found')
+ print "Directory %s not found" % repository['path']
+ sys.exit(2)
if(not os.path.isdir(repository['path'] + '/.git')):
- sys.exit('Directory ' + repository['path'] + ' is not a Git repository')
+ print "Directory %s is not a Git repository" % repository['path']
+ sys.exit(2)
return myClass.config
def do_POST(self):
urls = self.parseRequest()
+ self.respond()
Timer(1.0, self.do_process, [urls]).start()
def do_process(self, urls):
@@ -44,7 +49,6 @@ class GitAutoDeploy(BaseHTTPRequestHandler):
for path in paths:
self.pull(path)
self.deploy(path)
- self.respond()
def parseRequest(self):
length = int(self.headers.getheader('content-length'))
@@ -125,7 +129,7 @@ class GitAutoDeployMain:
if(GitAutoDeploy.daemon):
pid = os.fork()
if(pid != 0):
- sys.exit()
+ sys.exit(1)
os.setsid()
self.create_pidfile()
@@ -235,7 +239,7 @@ class GitAutoDeployMain:
elif(signum == 6):
print 'Requested close by SIGABRT (process abort signal). Code 6.'
- self.exit()
+ self.exit(1)
if __name__ == '__main__':
gadm = GitAutoDeployMain()