From c1f12869cf929468d73d9549bb0a3f6920ca3bbd Mon Sep 17 00:00:00 2001 From: FeRD (Frank Dana) Date: Sep 22 2024 06:08:01 +0000 Subject: Update expired token exception instructions The exception used to instruct the user to run the command `fedpkg set-pagure-token `, which doesn't work. The command only accepts the token interactively at a prompt, not on the command line (presumably for security purposes). Exception message and unit test for same adjusted accordingly. Signed-off-by: FeRD (Frank Dana) --- diff --git a/fedpkg/utils.py b/fedpkg/utils.py index 0669c3f..0c54ba1 100644 --- a/fedpkg/utils.py +++ b/fedpkg/utils.py @@ -93,8 +93,10 @@ def new_pagure_issue(logger, url, token, title, body, cli_name): # show hint for expired token if re.search(r"Invalid or expired token", rv_error, re.IGNORECASE): base_error_msg += '\nFor invalid or expired tokens please ' \ - 'set a new token in your user configuration with:' \ - '\n\n\t{0} set-pagure-token \n'.format(cli_name) + 'set a new token in your user configuration by running:' \ + '\n\n\t{0} set-pagure-token\n\n' \ + 'The command is interactive; enter the new token when ' \ + 'prompted.\n'.format(cli_name) raise rpkgError(base_error_msg.format(rv_error)) return '{0}/releng/fedora-scm-requests/issue/{1}'.format( diff --git a/test/test_utils.py b/test/test_utils.py index 09ddbdb..19ad2f8 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -388,8 +388,9 @@ class TestNewPagureIssue(unittest.TestCase): self.assertRaisesRegex( rpkgError, '\nFor invalid or expired tokens please ' - 'set a new token in your user configuration with:' - '\n\n\tfedpkg set-pagure-token \n', + 'set a new token in your user configuration by running:' + '\n\n\tfedpkg set-pagure-token\n\n' + 'The command is interactive; enter the new token when prompted.', utils.new_pagure_issue, logger, 'http://distgit/', '123456', 'new package', {'repo': 'pkg1'}, 'fedpkg')