Skip to content

Commit

Permalink
Merge pull request #13 from Salamek/dev
Browse files Browse the repository at this point in the history
Merge dev to master
  • Loading branch information
Salamek committed May 28, 2015
2 parents 99605c8 + 4db7d48 commit 164ed0a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions git_deploy/git_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import ConfigParser
import urlparse
import config_reader
import json

from classes import Git
from classes import Ftp
Expand Down Expand Up @@ -178,15 +179,28 @@ def deploy(self, target_config):
except Exception as e:
self.log.add(str(e), 'error')

if target_config['web_hook']:
import urllib2
try:
data = json.dumps({'errors': len(self.log.get('error')), 'warnings': len(self.log.get('warning'))})
req = urllib2.Request(target_config['web_hook'], data, {'Content-Type': 'application/json'})
f = urllib2.urlopen(req)
response = f.read()
f.close()
except:
self.log.add('Calling remote hook failed', 'warning')

self.log.add('Deploy done!', 'ok')
else:
self.log.add('Revisions match, no deploy needed.', 'ok')


def check_premisson(self, filename):
for path, premisson in self.config['file_rights'].iteritems():
if filename.endswith(path) or path == '*' or '*' in path and filename.startswith(path.replace('*', '')):
return int(premisson)
return None
if 'file_rights' in self.config:
for path, premisson in self.config['file_rights'].iteritems():
if filename.endswith(path) or path == '*' or '*' in path and filename.startswith(path.replace('*', '')):
return int(premisson)
return None

def get_log(self):
return self.log

0 comments on commit 164ed0a

Please sign in to comment.