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

Improve CLI response when AWS credentials not set #461

Closed
earmenda opened this issue Apr 6, 2022 · 1 comment
Closed

Improve CLI response when AWS credentials not set #461

earmenda opened this issue Apr 6, 2022 · 1 comment
Milestone

Comments

@earmenda
Copy link
Contributor

earmenda commented Apr 6, 2022

Is your feature request related to a specific problem?

Right now if a user calls the aws related cli commands they will get an ugly python stack trace. We should have an user friendly output which directs an user on how to set credentials for these commands.

Current behavior:

root@7da6bfd30c0d:/fides/fidesctl# export AWS_ACCESS_KEY_ID=""
root@7da6bfd30c0d:/fides/fidesctl# export AWS_SECRET_ACCESS_KEY=""
root@7da6bfd30c0d:/fides/fidesctl# fidesctl generate system aws manifest.yml

Traceback (most recent call last):
  File "/usr/local/bin/fidesctl", line 33, in <module>
    sys.exit(load_entry_point('fidesctl', 'console_scripts', 'fidesctl')())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/fides/fidesctl/src/fidesctl/cli/commands/generate.py", line 104, in generate_system_aws
    with_analytics(
  File "/fides/fidesctl/src/fidesctl/cli/utils.py", line 121, in with_analytics
    raise err
  File "/fides/fidesctl/src/fidesctl/cli/utils.py", line 117, in with_analytics
    return command_handler(**kwargs)
  File "/fides/fidesctl/src/fidesctl/core/system.py", line 224, in generate_system_aws
    aws_systems = generate_aws_systems(organization_key=organization_key)
  File "/fides/fidesctl/src/fidesctl/core/system.py", line 204, in generate_aws_systems
    aws_systems = [
  File "/fides/fidesctl/src/fidesctl/core/system.py", line 207, in <listcomp>
    for found_system in generate_function(organization_key)
  File "/fides/fidesctl/src/fidesctl/core/system.py", line 65, in generate_redshift_systems
    describe_clusters = describe_redshift_clusters()
  File "/fides/fidesctl/src/fidesctl/core/system.py", line 27, in describe_redshift_clusters
    describe_clusters = redshift_client.describe_clusters()
  File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 391, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 705, in _make_api_call
    http, parsed_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 725, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.8/site-packages/botocore/endpoint.py", line 106, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python3.8/site-packages/botocore/endpoint.py", line 179, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.8/site-packages/botocore/endpoint.py", line 119, in create_request
    self._event_emitter.emit(event_name, request=request,
  File "/usr/local/lib/python3.8/site-packages/botocore/hooks.py", line 357, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/botocore/signers.py", line 93, in handler
    return self.sign(operation_name, request)
  File "/usr/local/lib/python3.8/site-packages/botocore/signers.py", line 165, in sign
    auth.add_auth(request)
  File "/usr/local/lib/python3.8/site-packages/botocore/auth.py", line 380, in add_auth
    raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials

Describe the solution you'd like

root@7da6bfd30c0d:/fides/fidesctl# export AWS_ACCESS_KEY_ID=""
root@7da6bfd30c0d:/fides/fidesctl# export AWS_SECRET_ACCESS_KEY=""
root@7da6bfd30c0d:/fides/fidesctl# fidesctl generate system aws manifest.yml

No credentials found for aws command. blah blah do something
@ThomasLaPiana ThomasLaPiana added this to the Backlog milestone May 5, 2022
@earmenda
Copy link
Contributor Author

Should be able to leverage some of the logic added here - #722

@NevilleS NevilleS closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants