Summary:
When you supply an invalid license key such as during the configure process or with the -l flag, a traceback occurs, rather than nicely handling an invalid key.
Environment:
v2.1.0-rc1 (built with pip)
Steps to Reproduce:
By any means, supply an invalid key such as during the configure process or with -l
Expected Result:
A traceback is shown such as follows:
License: asdf
Traceback (most recent call last):
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/licensing.py", line 44, in validate_license
if not client.ping_api_key():
^^^^^^^^^^^^^^^^^^^^^
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/api/noc1.py", line 126, in ping_api_key
return self.process_simple_request('ping_api_key')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/api/noc1.py", line 71, in process_simple_request
self.validate_response(response, validator)
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/api/noc1.py", line 57, in validate_response
raise ApiException(
wordfence.api.exceptions.ApiException: Error message received in response body: Wordfence API error: Your site did not send an API key when contacting the Wordfence servers.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/wordfence", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/cli.py", line 202, in main
exit_code = cli.invoke()
^^^^^^^^^^^^
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/cli.py", line 175, in invoke
configurer.check_config()
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/configurer.py", line 409, in check_config
self.prompt_for_missing_config()
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/configurer.py", line 386, in prompt_for_missing_config
self.prompt_for_config()
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/configurer.py", line 320, in prompt_for_config
license = self._prompt_for_license()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/configurer.py", line 253, in _prompt_for_license
license = prompt(
^^^^^^^
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/util/input.py", line 58, in prompt
return transformer(response)
^^^^^^^^^^^^^^^^^^^^^
File "/home/david/dev/defiant/temp/wordfence-cli/venv/lib64/python3.11/site-packages/wordfence/cli/licensing.py", line 52, in validate_license
raise LicenseValidationFailure(
wordfence.cli.licensing.LicenseValidationFailure: Invalid license: Wordfence API error: Your site did not send an API key when contacting the Wordfence servers.
Actual Result:
I expected the invalid license to be handled nicely without any traceback. I expeced just ot see the LicenseValidationFailure message "Invalid license: Wordfence API error: Your site did not send an API key when contacting the Wordfence servers."
Summary: When you supply an invalid license key such as during the
configure
process or with the-l
flag, a traceback occurs, rather than nicely handling an invalid key.Environment: v2.1.0-rc1 (built with pip)
Steps to Reproduce:
configure
process or with-l
Expected Result: A traceback is shown such as follows:
Actual Result: I expected the invalid license to be handled nicely without any traceback. I expeced just ot see the LicenseValidationFailure message "Invalid license: Wordfence API error: Your site did not send an API key when contacting the Wordfence servers."