Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug where server would get stuck in infinite loop when adding a member. #100

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

omnistat
Copy link
Contributor

@omnistat omnistat commented Nov 30, 2023

Fix for #98. This should prevent an infinite loop in the event of adding a member when:

  • No ID is present but an existing member exists with no number in the end (occurs when requesting a session using the publicrackmount1 schema example)
  • An ID specified in the body is added that already exists in members. If so it defaults to the pattern made by the first member (less likely to happen as you usually wouldn’t POST with an ID).

I encountered this immediately upon spinning up the mockup server to use a redfish query tool which naturally requested a session. I understand that Redfish-Mockup-Server is meant to be a demo limited in functionality and scope, however I’m hoping these fixes just add a bit more reliability for those that don’t want to spend time debugging or changing their mockup server schema.

… member

Signed-off-by: James Shaw <james.omnistat@gmail.com>
@mraineri
Copy link
Contributor

mraineri commented Dec 1, 2023

Great addition!

One thing I think that would also be very handy while you're adding this... Would you be willing to also add the X-Auth-Token header to the response with a random value if the user is performing a POST to the SessionCollection? I think that would greatly help other tools that use session login by default and expect a session token. It shouldn't need to be tracked by the mockup server; it could be generated, returned, and tossed.

@mraineri
Copy link
Contributor

mraineri commented Dec 1, 2023

Actually, the token value doesn't even need to be random... it could be static since the mockup server has no enforcement of the token usage...

Signed-off-by: James Shaw <james.omnistat@gmail.com>
@omnistat
Copy link
Contributor Author

omnistat commented Dec 1, 2023

This latest commit should do it. An X-Auth-Token of 1234567890ABCDEF will be returned in the header if sending a POST to SessionService/Sessions. I don't think the X-Auth-Token needs to have a specific format as far as I am aware.

@mraineri
Copy link
Contributor

mraineri commented Dec 1, 2023

Looks good to me! I'll show this to others and we'll get a new version of the tool published.

@mraineri
Copy link
Contributor

mraineri commented Dec 1, 2023

Merging; thanks for adding this!

@mraineri mraineri merged commit 6350e6a into DMTF:main Dec 1, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants