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

Specify the FQ class name for the provisioning manager #23330

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented Feb 5, 2025

Rails 7.1 added validations here that raise in the foreman provider specs. This commit resolves it for those specs:

    3) ManageIQ::Providers::Foreman::Provider#destroy will remove all child objects
       Failure/Error: provider.provisioning_manager.operating_system_flavors =

       NameError:
         Missing model class ProvisioningManager for the OperatingSystemFlavor#provisioning_manager association. You can specify a different model class with the :class_name option.
       # ./spec/models/manageiq/providers/foreman/provider_spec.rb:50:in `block (3 levels) in <top (required)>'
       # ------------------
       # --- Caused by: ---
       # NameError:
       #   uninitialized constant OperatingSystemFlavor::ProvisioningManager
       #   ./spec/models/manageiq/providers/foreman/provider_spec.rb:50:in `block (3 levels) in <top (required)>'

Extracted from #23225

Rails 7.1 added validations here that raise in the foreman provider specs.
This commit resolves it for those specs:

    3) ManageIQ::Providers::Foreman::Provider#destroy will remove all child objects
       Failure/Error: provider.provisioning_manager.operating_system_flavors =

       NameError:
         Missing model class ProvisioningManager for the OperatingSystemFlavor#provisioning_manager association. You can specify a different model class with the :class_name option.
       # ./spec/models/manageiq/providers/foreman/provider_spec.rb:50:in `block (3 levels) in <top (required)>'
       # ------------------
       # --- Caused by: ---
       # NameError:
       #   uninitialized constant OperatingSystemFlavor::ProvisioningManager
       #   ./spec/models/manageiq/providers/foreman/provider_spec.rb:50:in `block (3 levels) in <top (required)>'
@jrafanie
Copy link
Member Author

jrafanie commented Feb 5, 2025

@miq-bot cross-repo-tests /providers

miq-bot pushed a commit to ManageIQ/manageiq-cross_repo-tests that referenced this pull request Feb 5, 2025
@jrafanie jrafanie mentioned this pull request Feb 5, 2025
54 tasks
@@ -1,6 +1,6 @@
class OperatingSystemFlavor < ApplicationRecord
acts_as_miq_taggable
belongs_to :provisioning_manager
belongs_to :provisioning_manager, :class_name => "ManageIQ::Providers::ProvisioningManager"
Copy link
Member Author

Choose a reason for hiding this comment

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

I believe this is a problem because this class is outside of the ManageIQ::Provider namespace so it doesn't resolve the name solely by the name of the association.

@Fryguy
Copy link
Member

Fryguy commented Feb 5, 2025

I'm kind of amazed this ever worked

@jrafanie
Copy link
Member Author

jrafanie commented Feb 6, 2025

I'm kind of amazed this ever worked

Agreed. It makes me worried how we can find others if they're not covered by tests. 🤔

@Fryguy Fryguy merged commit d5c763c into ManageIQ:master Feb 6, 2025
8 checks passed
@Fryguy Fryguy self-assigned this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants