From 6250b3eb4dad745d8d6ebf303aa2a2d42956d45b Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 12 Jan 2024 06:51:51 -0800 Subject: [PATCH] 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 --- tests/unit/test_cmd.py | 8 ++++---- zuulclient/cmd/__init__.py | 5 ----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/unit/test_cmd.py b/tests/unit/test_cmd.py index 89b6d76..d6cf973 100644 --- a/tests/unit/test_cmd.py +++ b/tests/unit/test_cmd.py @@ -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( diff --git a/zuulclient/cmd/__init__.py b/zuulclient/cmd/__init__.py index 6eec0ef..77d7ddc 100644 --- a/zuulclient/cmd/__init__.py +++ b/zuulclient/cmd/__init__.py @@ -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.")