willbengtson / trailblazer-aws

Blazing CloudTrail since 2018
134 stars 23 forks source link

global name 'service_file_json' is not defined #1

Closed 0xdabbad00 closed 5 years ago

0xdabbad00 commented 6 years ago

I ended up with a crash at:

Calling s3.upload_file with params {} in us-west-2
Traceback (most recent call last):
  File "./trailblazer-aws/venv/bin/trailblazer", line 11, in <module>
    sys.exit(cli())
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/trailblazer/cli.py", line 98, in cloudtrail_calls
    enumerate_services(ctx.config, services, dry_run=ctx.dry_run)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/trailblazer/enumerate.py", line 90, in enumerate_services
    make_api_call(service, new_func, region, func_params)
  File "./trailblazer-aws/venv/lib/python2.7/site-packages/trailblazer/boto/service.py", line 98, in make_api_call
    function[1](service_file_json[service], 'testbucket', 'testkey')
NameError: global name 'service_file_json' is not defined

I ran with:

trailblazer --config config/config.yaml enumerate cloudtrail_calls

The crash is here: https://github.com/willbengtson/trailblazer-aws/blob/bc264a71587d1ebc86cd4b8eaa92541546920a73/trailblazer/boto/service.py#L102

Looks like it wants access to this variable: https://github.com/willbengtson/trailblazer-aws/blob/bc264a71587d1ebc86cd4b8eaa92541546920a73/trailblazer/enumerate.py#L43

willbengtson commented 6 years ago

Thanks, will look into this.

0xdabbad00 commented 5 years ago

This is resolved in #5