Skip to content

Improve --config error when file not found #45

@rdmarsh

Description

@rdmarsh

Problem

When --config is passed a file that does not exist, elm falls through to a
generic credentials error:

Error: access_id, access_key or account_name not set via cli or config file
Default config file: /home/user/.config/logicmonitor/credentials/config.ini

This is misleading — the user passed an explicit path and the real problem is
that the file was not found, not that credentials are missing.

Expected behaviour

A clear error pointing at the missing file, similar to what --profile does:

Error: config file not found: /home/user/.config/logicmonitor/credentials/bob.ini

Notes

  • This is a click_config_file behaviour — it silently ignores a missing config
    file rather than erroring.
  • Fix likely belongs in _capture_config_path callback in _jnja/elm.py.j2:
    check os.path.exists(value) and exit with a clear message if not.
  • --profile already does this correctly for its resolved path.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions