-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
I found wrong code in Blinky-Hello-World/register_thing.py
$ git diff fix_error_handling -- register_thing.py
diff --git a/Blinky-Hello-World/register_thing.py b/Blinky-Hello-World/register_thing.py
index a7d9fec..6f8ce13 100644
--- a/Blinky-Hello-World/register_thing.py
+++ b/Blinky-Hello-World/register_thing.py
@@ -142,12 +142,11 @@ def generate_signer_certificate():
print("Generating self-signed x.509 certificate...")
try:
aws_iot_reg_code = iot.get_registration_code()
- except ClientError as e:
- print(str(e))
- print(e.response['Error']['Code'])
+ except ClientError:
+ print(ClientError.response['Error']['Code'])
print("Error with the AWS CLI when running the command 'aws iot get-registration-code'.")
- exit(1)
-
+ exit(0)
+
signer_public_key = signer_key.public_key()
time_now = datetime.utcnow()
days_to_expire = 365
When I used the modified code, I encountered the following error:
An error occurred (AccessDeniedException) when calling the GetRegistrationCode operation: User: arn:aws:iam::xxxxxxxxxxxx:user/xxx-xxx is not authorized to perform: iot:GetRegistrationCode on resource: * because no identity-based policy allows the iot:GetRegistrationCode action
AccessDeniedException
Metadata
Metadata
Assignees
Labels
No labels