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

Fixes #38031 - Use the same routes constraints as Foreman #743

Merged

Conversation

ofedoren
Copy link
Member

Overview of Changes

  • Somewhat reverts and updates 73bb74a.

Implementation Considerations

  • Without this change GET /api/v2/hosts/<fqdn_or_id>/power is not recognized in API calls, even though it's listed internally (e.g. rails routes command) on Rails 7.0.

Testing Steps

  • I've tried to write a test, but locally it didn't discover this issue (test passed), I've tested it by running the app with/out this patch checked on hosts index page the power state icons (they should not be grey for real machines) or just check in the logs for failed requests.

Checklists

  • I am familiar with the contributing guidelines.
  • [?] I have added relevant tests for my changes.
  • [?] I have updated the documentation accordingly.

Additional Notes

@ofedoren ofedoren force-pushed the ref-38031-use-foreman-constr branch from 498649e to b05fa02 Compare November 21, 2024 16:12
@@ -7,14 +7,14 @@
:defaults => { apiv: 'v2' },
:apiv => /v2/,
:constraints => ApiConstraints.new(version: 2, default: true) do
constraints(:id => %r{[^\/]+}) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine merging this because it exactly matches what's in Foreman, but I wonder if %r{[^/]+} would also work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should, since it's still accurate than the previous one, but I'd rather sync between core and plugins.

@nofaralfasi nofaralfasi merged commit 6238ea6 into theforeman:master Nov 27, 2024
26 of 27 checks passed
@nofaralfasi
Copy link
Contributor

Thanks @ofedoren!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants