2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-02 15:36:05 +00:00

Address a redfish account by the id the bmc gave it

Redfish identifies an account by a string, and an implementation is free
to use the account name, which this one does.  The handler converted the
last element of the path to an integer, so every per user read, update and
delete answered "invalid literal for int() with base 10: 'root'" as an
unexpected error, with a traceback to match.  Confluent offered the id
itself, listing the account as "root", and then could not accept it back.

Take the element as given.  Everything below already compares ids as
strings, and the input parsing already keeps a non numeric uid, so only
this conversion stood in the way.  nodebmcpassword goes through exactly
this path, reading users/all for the id and then writing to that account,
so it could not work at all on such a bmc.

ipmi users really are numbered slots, so the conversion is right there and
stays, but say so when it fails rather than letting a ValueError surface
as an unexpected error.
This commit is contained in:
Markus Hilger
2026-08-14 02:52:20 +02:00
parent ba3edc2c02
commit bd5d7ffb94
2 changed files with 12 additions and 2 deletions
@@ -838,7 +838,14 @@ class IpmiHandler:
return
# Update user
elif len(self.element) == 4:
user = int(self.element[-1])
# ipmi users really are numbered slots, unlike redfish accounts, so
# say that rather than letting the conversion fail as a surprise
try:
user = int(self.element[-1])
except ValueError:
raise pygexc.InvalidParameterValue(
'ipmi users are numbered, and "{0}" is not a user '
'number'.format(self.element[-1]))
if self.op == 'read':
data = await self.ipmicmd.get_user(uid=user)
await self.output.put(msg.User(
@@ -734,7 +734,10 @@ class IpmiHandler:
return
# Update user
elif len(self.element) == 4:
user = int(self.element[-1])
# A redfish account is identified by a string, and an
# implementation is free to use the account name as one, so take it
# as given rather than assuming a number
user = self.element[-1]
if self.op == 'read':
data = await self.ipmicmd.get_user(uid=user)
await self.output.put(msg.User(