mirror of
https://github.com/goharbor/harbor.git
synced 2025-03-02 10:41:59 +01:00
Remove id field from payload when update purge audit or gc schedule (#21408)
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
parent
67654f26bf
commit
7c502a8581
@ -32,6 +32,9 @@ class Permission:
|
||||
def call(self):
|
||||
if ID_PLACEHOLDER in self.url:
|
||||
self.url = self.url.replace(ID_PLACEHOLDER, str(self.payload.get(self.payload_id_field)))
|
||||
# remove the id field in the payload when calling the gc and purgeaudit schedule api with PUT method
|
||||
if self.method == "PUT" and (self.url.endswith("system/gc/schedule") or self.url.endswith("system/purgeaudit/schedule")):
|
||||
self.payload.pop("id", None)
|
||||
response = requests.request(self.method, self.url, data=json.dumps(self.payload), verify=False, auth=(user_name, password), headers={"Content-Type": "application/json"})
|
||||
if self.expect_status_code == None:
|
||||
assert response.status_code != 403, "Failed to call the {} {}, expected status code is not 403, but got {}, error msg is {}".format(self.method, self.url, response.status_code, response.text)
|
||||
|
Loading…
Reference in New Issue
Block a user