Skip to content

Commit

Permalink
set private attributed based on value of private attribute in GitHub …
Browse files Browse the repository at this point in the history
…JSON. cleaned per pylint.
  • Loading branch information
roder committed Jul 14, 2009
1 parent 85d3fa6 commit 8111ba8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions contrib/github_buildbot.py
Expand Up @@ -51,14 +51,15 @@ def render_POST(self, request):
payload = json.loads(request.args['payload'][0])
user = payload['repository']['owner']['name']
repo = payload['repository']['name']
self.private = payload['repository']['Private']
logging.debug("Payload: " + str(payload))
try:
self.github_sync(self.local_dir, user, repo, self.github)
self.process_change(payload)
except Exception:
logging.error("Encountered an exception:")
for l in traceback.format_exception(*sys.exc_info()):
logging.error(l.strip())
for msg in traceback.format_exception(*sys.exc_info()):
logging.error(msg.strip())

def process_change(self, payload):
"""
Expand Down Expand Up @@ -154,7 +155,8 @@ def github_sync(self, tmp, user, repo, github_url = 'github.com'):
Syncs the github repository to the server which hosts the buildmaster.
"""
if not os.path.exists(tmp):
raise RuntimeError("temporary directory %s does not exist; please create it" % tmp)
raise RuntimeError("temporary directory %s does not exist; \
please create it" % tmp)
repodir = tmp + "/" + repo + ".git"
if os.path.exists(repodir):
os.chdir(repodir)
Expand Down Expand Up @@ -210,10 +212,6 @@ def main():
help="Port the HTTP server listens to for the GitHub Service Hook"
+ " [default: %default]", default=4000, dest="port")

parser.add_option("--private",
help="Use a private github URL (you must have SSH keys set up for this to work)"
+ " [default: %default]", default=False, action="store_true", dest="private")

parser.add_option("-m", "--buildmaster",
help="Buildbot Master host and port. ie: localhost:9989 [default:"
+ " %default]", default="localhost:9989", dest="buildmaster")
Expand Down Expand Up @@ -251,7 +249,6 @@ def main():
github_bot.github = options.github
github_bot.master = options.buildmaster
github_bot.local_dir = options.dir
github_bot.private = options.private

site = server.Site(github_bot)
reactor.listenTCP(options.port, site)
Expand Down

0 comments on commit 8111ba8

Please sign in to comment.