windows_cert_connect.py --cert argument required and unrecognized
ecepep opened this issue · 4 comments
Describe the bug
windows_cert_connect.py fails when provided the "--cert" argument because it is unrecognized and fails when it is lacking "--cert" because it is required. 🤯
Expected Behavior
One can provide --cert without exit
Current Behavior
With "--cert":
python.exe windows_cert_connect.py --cert LocalMachine\\MY\\<thumbprint> --endpoint [...]-ats.iot.eu-west-1.amazonaws.com --client_id me-cert-store
usage: windows_cert_connect.py [-h] --endpoint [--ca_file ]
[--verbosity ] [--client_id ]
windows_cert_connect.py: error: unrecognized arguments: --cert LocalMachine\MY\
Without "--cert":
python.exe windows_cert_connect.py --endpoint [...]-ats.iot.eu-west-1.amazonaws.com --client_id me-cert-store
usage: windows_cert_connect.py [-h] --endpoint [--ca_file ]
[--verbosity ] [--client_id ]Send and receive messages through and MQTT connection.
optional arguments:
-h, --help show this help message and exit
--endpoint The endpoint of the mqtt server not including a port.
--ca_file Path to AmazonRootCA1.pem (optional, system trust
store used by default)
--verbosity
Logging level.
--client_id Client ID to use for MQTT connection (optional,
default='test-*').
Command --cert required.Process finished with exit code 0
Reproduction Steps
python.exe windows_cert_connect.py --cert LocalMachine\\MY\\<thumbprint> --endpoint [...]-ats.iot.eu-west-1.amazonaws.com --client_id me-cert-store
python.exe windows_cert_connect.py --endpoint [...]-ats.iot.eu-west-1.amazonaws.com --client_id me-cert-store
Possible Solution
No response
Additional Information/Context
No response
SDK version used
aws-iot-device-sdk-python-v2 checkout at tag: v1.11.9
Environment details (OS name and version, etc.)
Win 10 Python 3.8
Thank you for making this issue! We did not catch this bug initially but it is on our radar and will be fixed in the following PR: #357
In the mean time, to fix the sample, please add the following to the windows_cert_connect.py
sample under line 22:
cmdUtils.register_command("cert", "<path>", "Path to certificate in Windows cert store. "
"e.g. \"CurrentUser\\MY\\6ac133ac58f0a88b83e9c794eba156a98da39b4c\"", True, str)
cmdUtils.register_command("port", "<int>", "Connection port. AWS IoT supports 443 and 8883 (optional, default=auto).", type=int)
And then it will work as expected! I am going to leave this issue open and will close it once #357 is merged 🙂
@TwistedTwigleg Thank you
The PR with the fix has been merged! Now the sample should work when using the latest version of main
.
Closing this issue, but if you have any other issues running the sample or similar, please let us know! Thanks!
Closing...
⚠️ COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.