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 #36207 - assign puppet attributes from hostgroup #401

Closed
wants to merge 2 commits into from

Conversation

sbernhard
Copy link
Contributor

No description provided.

save
end

def inherited_attributes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is missing for sure so that attributes from hostgroup are used. Same as in katello, openscap, salt...

Copy link
Contributor Author

@sbernhard sbernhard Jul 1, 2024

Choose a reason for hiding this comment

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

Do you know @ekohl (or know someone who maybe can answer this question), why this method did not exist in puppet but is used for Katello, OpenSCAP, Salt.
How does this work, if you create a host which is using a hostgroup, that this host is using the "templated values" from hostgroup without this code?

Copy link
Collaborator

Choose a reason for hiding this comment

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

As this is related to facets (environment_id is provided by the puppet facet), maybe we can also ping @ShimShtein

@@ -55,6 +55,15 @@ def search_by_config_group(_key, operator, value)
end

module PrependedMethods
def environment_id=(id)
self.environment = ForemanPuppet::Environment.find(id)
save
Copy link
Contributor Author

@sbernhard sbernhard Jun 28, 2024

Choose a reason for hiding this comment

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

Is this good or does it break something to have a environment_id method?

can the save be improved?

@@ -30,6 +30,26 @@ class << self
ext_method: :search_by_config_group
end

def inherited_puppet_hostgroup_attribute(attribute)
if ancestry.present?
Copy link
Contributor Author

@sbernhard sbernhard Jun 28, 2024

Choose a reason for hiding this comment

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

grabbed and adapted from foreman_openscap

@nadjaheitmann
Copy link
Collaborator

Looks like it breaks the tests. Can you please verify?

Also could this be related to #396 and #397?

@sbernhard sbernhard closed this Jul 3, 2024
@nadjaheitmann nadjaheitmann deleted the fix_36207 branch August 13, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants