Skip to content

Commit

Permalink
Should sove logsol#20
Browse files Browse the repository at this point in the history
  • Loading branch information
tomfa committed Jun 21, 2014
1 parent df823d1 commit 4d66e45
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions GitAutoDeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ def getConfig(myClass):

def do_POST(self):
urls = self.parseRequest()
for url in urls:
paths = self.getMatchingPaths(url)
for path in paths:
self.pull(path)
self.deploy(path)
try:
for url in urls:
paths = self.getMatchingPaths(url)
for path in paths:
self.pull(path)
self.deploy(path)
self.respond_success()
except:
self.respons_failure()

def parseRequest(self):
length = int(self.headers.getheader('content-length'))
Expand All @@ -58,11 +62,15 @@ def getMatchingPaths(self, repoUrl):
res.append(repository['path'])
return res

def respond(self):
def respond_success(self):
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()

def respons_failure(self):
self.send_response(500)
self.end_headers()

def pull(self, path):
if(not self.quiet):
print "\nPost push request received"
Expand Down

0 comments on commit 4d66e45

Please sign in to comment.