deal with the initial "zen" message from github; fix things
authorRalf Jung <post@ralfj.de>
Sun, 22 Feb 2015 20:23:26 +0000 (21:23 +0100)
committerRalf Jung <post@ralfj.de>
Sun, 22 Feb 2015 20:23:26 +0000 (21:23 +0100)
git_mirror.py
ssh-set-ident.sh [changed mode: 0644->0755]
webhook-core.py

index af963dfe6cd7f19b50df863c5306a83322df1557..0bd4e81ecd8b793ad42abca32cf9777cc2a738fb 100644 (file)
@@ -111,10 +111,10 @@ class Repo:
     def setup_env(self):
         '''Setup the environment to work with this repository'''
         os.chdir(self.local)
-        ssh_set_ident = os.path.join(os.path.dirname(__file__), 'ssh-set-ident.conf')
-        os.setenv('GIT_SSH', ssh_set_ident)
+        ssh_set_ident = os.path.join(os.path.dirname(__file__), 'ssh-set-ident.sh')
+        os.putenv('GIT_SSH', ssh_set_ident)
         ssh_ident = os.path.join(os.path.expanduser('~/.ssh'), self.deploy_key)
-        os.setenv('SSH_IDENT', ssh_ident)
+        os.putenv('SSH_IDENT', ssh_ident)
     
     def update_mirrors(self, ref, oldsha, newsha, except_mirrors = [], suppress_stderr = False):
         '''Update the <ref> from <oldsha> to <newsha> on all mirrors. The update must already have happened locally.'''
@@ -184,7 +184,7 @@ def load_repos():
     global mail_sender
     conffile = os.path.join(os.path.dirname(__file__), 'git-mirror.conf')
     conf = read_config(conffile)
-    mail_sender = conf['mail-sender']
+    mail_sender = conf['DEFAULT']['mail-sender']
     
     repos = {}
     for name, section in conf.items():
old mode 100644 (file)
new mode 100755 (executable)
index bff1137f884e3481913b79301d41ba0557f93dfe..a9418bc858995b08f7a1350bfdbd8db3bf62d8e7 100755 (executable)
@@ -38,6 +38,12 @@ if __name__ == "__main__":
         
         # now sync this repository
         data = get_github_payload()
+        if 'zen' in data:
+            # github sends this initially
+            print("Content-Type: text/plain")
+            print()
+            print("Welcome!")
+            sys.exit(0)
         ref = data["ref"]
         oldsha = data["before"]
         newsha = data["after"]