Don't translate null to 0000000

Like I9886cd44f8b4bae6f4a5ce3644f0598a73ecfe0a, have the zuul client
send actual null values for oldrev/newrev instead of 0000000 which
could lead to unintended behavior.

Change-Id: I44994426493d05a039b5a1051504958b36729c9d
Depends-On: https://review.opendev.org/867177
This commit is contained in:
James E. Blair 2024-01-12 06:51:51 -08:00
parent f58fe01d6d
commit 6250b3eb4d
2 changed files with 4 additions and 9 deletions

View File

@ -370,8 +370,8 @@ verify_ssl=True"""
'project/project1/enqueue',
json={'ref': 'refs/heads/stable',
'pipeline': 'check',
'oldrev': '0000000000000000000000000000000000000000',
'newrev': '0000000000000000000000000000000000000000'}
'oldrev': None,
'newrev': None}
)
self.assertEqual(0, exit_code)
exit_code = ZC._main(
@ -387,7 +387,7 @@ verify_ssl=True"""
json={'ref': 'refs/heads/stable',
'pipeline': 'check',
'oldrev': 'ababababab',
'newrev': '0000000000000000000000000000000000000000'}
'newrev': None}
)
self.assertEqual(0, exit_code)
exit_code = ZC._main(
@ -403,7 +403,7 @@ verify_ssl=True"""
json={'ref': 'refs/heads/stable',
'pipeline': 'check',
'newrev': 'ababababab',
'oldrev': '0000000000000000000000000000000000000000'}
'oldrev': None}
)
self.assertEqual(0, exit_code)
exit_code = ZC._main(

View File

@ -153,11 +153,6 @@ class ZuulClient():
if self.args.oldrev == self.args.newrev:
raise ArgumentException(
"The old and new revisions must not be the same.")
# if they're not set, we pad them out to zero
if self.args.oldrev is None:
self.args.oldrev = '0000000000000000000000000000000000000000'
if self.args.newrev is None:
self.args.newrev = '0000000000000000000000000000000000000000'
if self.args.func == self.dequeue:
if self.args.change is None and self.args.ref is None:
raise ArgumentException("Change or ref needed.")