Skip to content

[BUG] Incorrect credentials are masked by traceback #517

@sadsfae

Description

@sadsfae

There is some improvement required to the find_session_uri method which after recent auth and event loop changes now masks legitimate errors when someone uses incorrect credentials:

-=>>PYTHONPATH="./src" python3 src/badfish/main.py -H mgmt-d23-h31-000-r650.example.com -u root -p awrongpassword --power-state
Traceback (most recent call last):
  File "/home/wfoster/git_modules/badfish-self/src/badfish/main.py", line 2773, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/wfoster/git_modules/badfish-self/src/badfish/main.py", line 2742, in main
    _host, result = loop.run_until_complete(
                    ~~~~~~~~~~~~~~~~~~~~~~~^
        execute_badfish(host, _args, bfl.logger, bfl.queue_listener.handlers[0])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib64/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/home/wfoster/git_modules/badfish-self/src/badfish/main.py", line 2526, in execute_badfish
    badfish = await badfish_factory(
              ^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/home/wfoster/git_modules/badfish-self/src/badfish/main.py", line 39, in badfish_factory
    await badfish.init()
  File "/home/wfoster/git_modules/badfish-self/src/badfish/main.py", line 78, in init
    self.session_uri = await self.find_session_uri()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wfoster/git_modules/badfish-self/src/badfish/main.py", line 387, in find_session_uri
    redfish_version = int(data["RedfishVersion"].replace(".", ""))
                          ~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'RedfishVersion'

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglogging

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions