summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Cavalca <dcavalca@fb.com>2020-04-22 13:50:22 -0700
committerDavide Cavalca <dcavalca@fb.com>2020-04-22 13:50:22 -0700
commitc62887ecf455689bc61b5b290bc3f5853b0e92a1 (patch)
treec74d7a1ee5e75fa8056835ac93748295165ff523
parent5180078faab17c1e4b33739b7d2f069364062cf7 (diff)
downloadohai-c62887ecf455689bc61b5b290bc3f5853b0e92a1.tar.gz
selinux: fix rubocop issues
Signed-off-by: Davide Cavalca <dcavalca@fb.com>
-rw-r--r--lib/ohai/plugins/linux/selinux.rb3
-rw-r--r--spec/unit/plugins/linux/selinux_spec.rb4
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/ohai/plugins/linux/selinux.rb b/lib/ohai/plugins/linux/selinux.rb
index c12424f2..8cbb6a4d 100644
--- a/lib/ohai/plugins/linux/selinux.rb
+++ b/lib/ohai/plugins/linux/selinux.rb
@@ -51,8 +51,9 @@ Ohai.plugin(:Selinux) do
end
end
- key, val = line.split(%r{:?\s\s+}, 2)
+ key, val = line.split(/:?\s\s+/, 2)
next if key.nil?
+
unless key.start_with?("/")
key.downcase!
key.tr!(" ", "_")
diff --git a/spec/unit/plugins/linux/selinux_spec.rb b/spec/unit/plugins/linux/selinux_spec.rb
index 29545919..6f8ceef4 100644
--- a/spec/unit/plugins/linux/selinux_spec.rb
+++ b/spec/unit/plugins/linux/selinux_spec.rb
@@ -69,7 +69,7 @@ Controlling terminal: system_u:object_r:file_t
"/sbin/agetty" => "user_u:object_r:file_t",
"/sbin/init" => "user_u:object_r:file_t -> user_u:object_r:init_exec_t",
"/usr/sbin/sshd" => "user_u:object_r:file_t",
- "controlling_terminal" => "system_u:object_r:file_t"
+ "controlling_terminal" => "system_u:object_r:file_t",
},
"policy_booleans" => {
"secure_mode_policyload" => "off",
@@ -77,7 +77,7 @@ Controlling terminal: system_u:object_r:file_t
"process_contexts" => {
"/usr/sbin/sshd" => "system_u:base_r:base_t",
"current_context" => "user_u:base_r:admin_t",
- "init_context" => "system_u:system_r:init_t"
+ "init_context" => "system_u:system_r:init_t",
},
"status" => {
"current_mode" => "permissive",