taskcat icon indicating copy to clipboard operation
taskcat copied to clipboard

profile and access key/secret key passed in on the commandline not honored

Open jaymccon opened this issue 7 years ago • 4 comments

Describe the bug When specifying a profile with -P taskcat fails at validation. Successfully uploads to existing, private bucket in the profile's specified account, but seems to be attempting validation using the default boto profile

[DEBUG  ] :Tags:[]
[ERROR  ] :An error occurred (ValidationError) when calling the CreateStack operation: S3 error: Access Denied
For more information check http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
[ERROR  ] :Cannot launch suse-cap-master.template.yaml
[ERROR  ] :Cannot launch suse-cap-master.template.yaml

To Reproduce Steps to reproduce the behavior:

  1. create a aws cli profile
  2. create a private bucket in the profile's account
  3. launch taskcat with a config that includes s3bucket: mybucket

Expected behavior all operations should use the profile specified

**Version (Please make sure you are running the latest version of taskcat)

  • Taskcat Version 0.8.19

jaymccon avatar Dec 14 '18 02:12 jaymccon

This is fixed in release 0.8.27. Can you confirm and close after verification? @jaymccon

sshvans avatar Jan 31 '19 04:01 sshvans

I can confirm that the issue is still present in the current master branch

botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the CreateStack operation: S3 error: Access Denied
For more information check http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html

I have also checked passing in creds using -A and -S this is also broken in an environment where there are not credentials available in ~/.aws/credentials the describe_availability_zones call made for generate_azs does not use the provided credentials, resulting in:

[DEBUG  ] :Requested 3 az's
Traceback (most recent call last):
  File "/Users/jmmccon/.pyenv/versions/3.6.4/bin/taskcat", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/Users/jmmccon/taskcat/bin/taskcat", line 101, in <module>
    main()
  File "/Users/jmmccon/taskcat/bin/taskcat", line 88, in main
    testdata = tcat_instance.stackcreate(taskcat_cfg, test_list, args.stack_prefix)
  File "/Users/jmmccon/taskcat/taskcat/stacker.py", line 714, in stackcreate
    j_params = self.generate_input_param_values(s_parms, region)
  File "/Users/jmmccon/taskcat/taskcat/stacker.py", line 679, in generate_input_param_values
    return ParamGen(param_list=s_parms, bucket_name=self.get_s3bucket(), boto_client=self._boto_client, region=region, verbose=True).results
  File "/Users/jmmccon/taskcat/taskcat/template_params.py", line 45, in __init__
    self.transform_parameter()
  File "/Users/jmmccon/taskcat/taskcat/template_params.py", line 72, in transform_parameter
    self._gen_az_wrapper(self.RE_GENAZ, self.RE_COUNT)
  File "/Users/jmmccon/taskcat/taskcat/template_params.py", line 303, in _gen_az_wrapper
    self._regex_replace_param_value(genaz_regex, self.get_available_azs(numazs))
  File "/Users/jmmccon/taskcat/taskcat/template_params.py", line 130, in get_available_azs
    Filters=[{'Name': 'state', 'Values': ['available']}])
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/client.py", line 320, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/client.py", line 610, in _make_api_call
    operation_model, request_dict)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/endpoint.py", line 132, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/endpoint.py", line 116, in create_request
    operation_name=operation_model.name)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/signers.py", line 157, in sign
    auth.add_auth(request)
  File "/Users/jmmccon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/botocore/auth.py", line 356, in add_auth
    raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials

jaymccon avatar Feb 01 '19 22:02 jaymccon

Just verified this is still present. Will be addressed organically in V0.9

https://github.com/taskcat/taskcat-v9/issues/3

andrew-glenn avatar Jul 22 '19 14:07 andrew-glenn

v0.9.0 released; This issue is no longer present.

andrew-glenn avatar Nov 01 '19 00:11 andrew-glenn