mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
fix linting
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
This commit is contained in:
parent
cbe7e8c03f
commit
c963b2ac14
2 changed files with 9 additions and 7 deletions
|
@ -20,11 +20,13 @@ module Inspec::Resources
|
|||
def initialize(selinux_path = "/etc/selinux/config")
|
||||
@path = selinux_path
|
||||
cmd = inspec.command("sestatus")
|
||||
|
||||
if cmd.exit_status != 0
|
||||
return skip_resource "#{cmd.stdout}"
|
||||
end
|
||||
result = cmd.stdout.delete(" ").gsub(/\n/, ",").gsub(/\r/,"").downcase
|
||||
@data = Hash[result.scan /([^:]+):([^,]+)[,$]/]
|
||||
|
||||
result = cmd.stdout.delete(" ").gsub(/\n/, ",").gsub(/\r/, "").downcase
|
||||
@data = Hash[result.scan(/([^:]+):([^,]+)[,$]/)]
|
||||
|
||||
return if inspec.os.linux?
|
||||
|
||||
|
@ -37,15 +39,15 @@ module Inspec::Resources
|
|||
end
|
||||
|
||||
def disabled?
|
||||
@data["selinuxstatus"] == 'disabled' unless @data.empty?
|
||||
@data["selinuxstatus"] == "disabled" unless @data.empty?
|
||||
end
|
||||
|
||||
def enforcing?
|
||||
@data["currentmode"] == 'enforcing' unless @data.empty?
|
||||
@data["currentmode"] == "enforcing" unless @data.empty?
|
||||
end
|
||||
|
||||
def permissive?
|
||||
@data["currentmode"] == 'permissive' unless @data.empty?
|
||||
@data["currentmode"] == "permissive" unless @data.empty?
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -556,7 +556,7 @@ class MockLoader
|
|||
|
||||
# filesystem command
|
||||
"2e7e0d4546342cee799748ec7e2b1c87ca00afbe590fa422a7c27371eefa88f0" => cmd.call("get-wmiobject-filesystem"),
|
||||
'sestatus' => cmd.call("sestatus")
|
||||
"sestatus" => cmd.call("sestatus"),
|
||||
}
|
||||
|
||||
# ports on linux
|
||||
|
|
Loading…
Reference in a new issue