Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError During Integration Install When Pre-Existing Install Present #60

Closed
kolanos opened this issue Jan 10, 2020 · 0 comments · Fixed by #61
Closed

IndexError During Integration Install When Pre-Existing Install Present #60

kolanos opened this issue Jan 10, 2020 · 0 comments · Fixed by #61
Labels
bug Something isn't working

Comments

@kolanos
Copy link
Contributor

kolanos commented Jan 10, 2020

The link_account method is too brittle. Additional checks are needed to verify that the integration was created by the CLI before attempting to link it. Also handling the case where no integrations are returned from the API.

~/tools/NewRelic $ newrelic-lambda integrations install --nr-account-id XXXXXX --linked-account-name XXXXXX --nr-api-key XXXXXXX
Validating New Relic credentials
Retrieving integration license key
Checking for a pre-existing link between New Relic and AWS
Creating the AWS role for the New Relic AWS Lambda Integration
✔️ New Relic AWS Lambda integration role 'NewRelicLambdaIntegrationRole_XXXXXX' already exists
Linking New Relic account to AWS account
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/newrelic-lambda", line 11, in <module>
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/newrelic_lambda_cli/utils.py", line 24, in _boto_error_wrapper
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/newrelic_lambda_cli/cli/__init__.py", line 25, in main
cli()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/newrelic_lambda_cli/cli/integrations.py", line 68, in install
gql_client, nr_account_id, linked_account_name, role
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/newrelic_lambda_cli/api.py", line 295, in create_integration_account
account = gql.link_account(role_arn, linked_account_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/newrelic_lambda_cli/api.py", line 134, in link_account
return res["cloudLinkAccount"]["linkedAccounts"][0]
IndexError: list index out of range
@kolanos kolanos added the bug Something isn't working label Jan 13, 2020
kolanos added a commit that referenced this issue Jan 13, 2020
kolanos added a commit that referenced this issue Jan 14, 2020
* Handle IndexError, KeyError; add help messages

Closes #58
Closes #60

* Output errors returned by GQL to assist support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant