Commit 728d5551 authored by intrigeri's avatar intrigeri

Fix GitLab needs_validation query code

I see these scripts fail on Jenkins with:

  ValueError: Invalid header value b'SECRET\n'
                                           ^^

I suppose that's because our apikey file has a trailing newline.
So let's strip trailing whitespace after reading that file.
parent fdc2c10d
......@@ -12,7 +12,7 @@ API_URL = 'https://gitlab.tails.boum.org/api/v4/projects/tails%2Ftails/issues/{}
def needs_validation(apikeyfile, ticket):
with open(apikeyfile) as apikey_file:
apikey = apikey_file.read()
apikey = apikey_file.read().rstrip()
headers = {'Private-Token': apikey}
json = requests.get(API_URL.format(ticket), headers=headers).json()
return 'Needs Validation' in json['labels']
......
......@@ -35,7 +35,7 @@ def calculate_notification_vars(disabled_for_builds, disabled_for_tests, recipie
def needs_validation(apikeyfile, ticket):
with open(apikeyfile) as apikey_file:
apikey = apikey_file.read()
apikey = apikey_file.read().rstrip()
headers = {'Private-Token': apikey}
json = requests.get(API_URL.format(ticket), headers=headers).json()
return 'Needs Validation' in json['labels']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment