Skip to content

Stack trace on incorrect PMAPPER_STORAGE environment variable #134

Description

@rdegraaf

Describe the bug
If a user attempts to re-use pre-gathered data from a custom storage location but gives an incorrect path, the application dumps a stack trace.

To Reproduce
Steps to reproduce the behavior, please include information on suspected users/roles that are the source of the issue when possible:

  1. Gather data for some account 1234567899012, storing the data in a custom location (PMAPPER_STORAGE=/tmp/pmapper pmapper graph create, etc.)

  2. Attempt to use that data but give the wrong path (PMAPPER_STORAGE=/tmp/pmapper/123456789012 pmapper analyze)

  3. Stack trace:

     Traceback (most recent call last):
       File "/home/rdegraaf/aws-venv/bin/pmapper", line 8, in <module>
         sys.exit(main())
       File "/home/rdegraaf/aws-venv/lib/python3.8/site-packages/principalmapper/__main__.py", line 157, in main
         return analysis_cli.process_arguments(parsed_args)
       File "/home/rdegraaf/aws-venv/lib/python3.8/site-packages/principalmapper/analysis/cli.py", line 45, in process_arguments
         graph = graph_actions.get_existing_graph(session, parsed_args.account)
       File "/home/rdegraaf/aws-venv/lib/python3.8/site-packages/principalmapper/graphing/graph_actions.py", line 75, in get_existing_graph
         graph = get_graph_from_disk(get_default_graph_path(account))
       File "/home/rdegraaf/aws-venv/lib/python3.8/site-packages/principalmapper/graphing/graph_actions.py", line 65, in get_graph_from_disk
         return Graph.create_graph_from_local_disk(location)
       File "/home/rdegraaf/aws-venv/lib/python3.8/site-packages/principalmapper/common/graphs.py", line 132, in create_graph_from_local_disk
         raise ValueError('Did not find file at: {}'.format(rootpath))
     ValueError: Did not find file at: /tmp/pmapper/123456789012/123456789012
    

Expected behavior
A useful error message with no stack trace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions