[sysadmin-bin] strings/integers always evaluate to true boolean speaking, thanks G. Campagna for reminding me



commit 51f8401e22e44bb8af610884d1edbdf51f838956
Author: Andrea Veri <averi redhat com>
Date:   Tue Sep 5 11:09:59 2017 +0200

    strings/integers always evaluate to true boolean speaking, thanks G. Campagna for reminding me

 git/post-receive-mirror-github |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index e0f32c5..acee7e8 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -108,14 +108,13 @@ def get_repo_settings (repo_name):
     nss = {'doap': 'http://usefulinc.com/ns/doap#',
            'rdf':  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'}
 
-    hostname = socket.gethostname()
-    if hostname.split('.')[0] == ('gitlab' or 'gitlab-test'):
+    if socket.gethostname().startswith('gitlab'):
         doap_url = 'https://%s/GNOME/%s/raw/master/%s.doap' % (hostname, repo_name, repo_name)
     else:
         doap_url = "https://git.gnome.org/browse/%s/plain/%s.doap"; % (repo_name, repo_name)
 
     rq = requests.get(doap_url)
-    if rq.status_code != (200 or 301 or 302):
+    if rq.status_code not in (200, 301, 302):
         raise Exception ("Could not get doap: %s" % doap_url)
 
     prj = et.fromstring(rq.content)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]