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

Add platform attribute to Scap class #191

Merged
merged 1 commit into from
Sep 28, 2017

Conversation

carbonin
Copy link
Member

Newer versions of scap-security-guide (> 0.1.32) add new xccdf files which match our glob pattern, but do not contain the remediations for the rules we want to run.

If we edit one of these files rather than the one for our target platform, the rules will not be remediated properly.

Specifying the platform allows us to find the file we need.

https://bugzilla.redhat.com/show_bug.cgi?id=1493193

end

def tempdir
@tempdir ||= Pathname.new(Dir.tmpdir)
end

def xccdf_file
@xccdf_file ||= self.class.xccdf_file
@xccdf_file ||= self.class.xccdf_file(platform)
Copy link
Member

Choose a reason for hiding this comment

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

If the platform changes via the accessor, then this cache should be cleared, right? (same with oval_file)

Copy link
Member

Choose a reason for hiding this comment

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

Alternately, use attr_reader instead, then enforce that callers must set the platform on initialize.

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'm for the attr_reader approach, I don't see someone reusing this object for different platforms so I think it makes sense to set it on initialization.

Newer versions of scap-security-guide (> 0.1.32) add new xccdf
files which match our glob pattern, but do not contain the
remediations for the rules we want to run.

If we edit one of these files rather than the one for our
target platform, the rules will not be remediated properly.

Specifying the platform allows us to find the file we need.

https://bugzilla.redhat.com/show_bug.cgi?id=1493193
@carbonin carbonin force-pushed the add_platform_attr_to_scap branch from a7534e2 to 8f90905 Compare September 27, 2017 15:48
@miq-bot
Copy link
Member

miq-bot commented Sep 27, 2017

Checked commit carbonin@8f90905 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 3 offenses detected

lib/linux_admin/scap.rb

  • ⚠️ - Line 57, Col 5 - Lint/IneffectiveAccessModifier - private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
  • ⚠️ - Line 61, Col 5 - Lint/IneffectiveAccessModifier - private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
  • ⚠️ - Line 65, Col 5 - Lint/IneffectiveAccessModifier - private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.

@Fryguy Fryguy merged commit 1d911f7 into ManageIQ:master Sep 28, 2017
@carbonin carbonin deleted the add_platform_attr_to_scap branch October 13, 2017 19:33
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.

4 participants