Skip to content

Commit 176d2b0

Browse files
Fix bugs in license sync script
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent 17dd1a2 commit 176d2b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

etc/scripts/licenses/synclic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -746,29 +746,29 @@ def create_or_update_license(api_url, api_key, lico, update=False):
746746
"""
747747
_owner = get_or_create_owner(api_url, api_key, lico.owner, create=True)
748748

749-
url = f"{api_url}/licenses/"
749+
new_license_url = f"{api_url}/licenses/"
750750
headers = get_api_headers(api_key)
751751

752752
# recheck that the license key does not exists remotely
753753
params = dict(key=lico.key)
754754
# note: we GET params
755-
response = requests.get(url, headers=headers, params=params)
755+
response = requests.get(new_license_url, headers=headers, params=params)
756756
if not response.ok:
757757
content = response.content
758758
headers = response.headers
759-
raise Exception(f"Failed to fetch license for {lico.key} at {url}:\n{headers}\n{content}")
759+
raise Exception(f"Failed to fetch license for {lico.key} at {new_license_url}:\n{headers}\n{content}")
760760

761761
results = response.json().get("results", [])
762762

763763
if not results:
764764
# add new license
765765
data = license_to_dict(lico)
766766
data = add_license_creation_fields(data)
767-
response = requests.post(url, headers=headers, json=data)
767+
response = requests.post(new_license_url, headers=headers, json=data)
768768
if not response.ok:
769769
content = response.content
770770
headers = response.headers
771-
raise Exception(f"Failed to create license: {lico.key} at {url}:\n{headers}\n{content}")
771+
raise Exception(f"Failed to create license: {lico.key} at {new_license_url}:\n{headers}\n{content}")
772772

773773
print("Created new license:", lico)
774774
created = response.json()

0 commit comments

Comments
 (0)