Skip to content

Commit 0085bcf

Browse files
committed
Use blank?' instead of nil?'
1 parent a50ac40 commit 0085bcf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/post/linux/gather/enum_users_history.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def run
5353
last = execute("/usr/bin/last && /usr/bin/lastlog")
5454
sudoers = cat_file("/etc/sudoers")
5555

56-
save("Last logs", last) unless last.nil?
57-
save("Sudoers", sudoers) unless sudoers.nil? || sudoers =~ /Permission denied/
56+
save("Last logs", last) unless last.blank?
57+
save("Sudoers", sudoers) unless sudoers.blank? || sudoers =~ /Permission denied/
5858
end
5959

6060
def save(msg, data, ctype="text/plain")
@@ -121,13 +121,13 @@ def get_mysql_history(users, user)
121121
vprint_status("Extracting MySQL history for #{u}")
122122
sql_hist = cat_file("/home/#{u}/.mysql_history")
123123
end
124-
save("MySQL History for #{u}", sql_hist) unless sql_hist.nil? || sql_hist =~ /No such file or directory/
124+
save("MySQL History for #{u}", sql_hist) unless sql_hist.blank? || sql_hist =~ /No such file or directory/
125125
end
126126
else
127127
vprint_status("Extracting MySQL history for #{user}")
128128
sql_hist = cat_file("/home/#{user}/.mysql_history")
129129
vprint_status(sql_hist) if sql_hist
130-
save("MySQL History for #{user}", sql_hist) unless sql_hist.nil? || sql_hist =~ /No such file or directory/
130+
save("MySQL History for #{user}", sql_hist) unless sql_hist.blank? || sql_hist =~ /No such file or directory/
131131
end
132132
end
133133

@@ -164,13 +164,13 @@ def get_vim_history(users, user)
164164
vim_hist = cat_file("/home/#{u}/.viminfo")
165165
end
166166

167-
save("VIM History for #{u}", vim_hist) unless vim_hist.nil? || vim_hist =~ /No such file or directory/
167+
save("VIM History for #{u}", vim_hist) unless vim_hist.blank? || vim_hist =~ /No such file or directory/
168168
end
169169
else
170170
vprint_status("Extracting history for #{user}")
171171
vim_hist = cat_file("/home/#{user}/.viminfo")
172172
vprint_status(vim_hist)
173-
save("VIM History for #{user}", vim_hist) unless vim_hist.nil? || vim_hist =~ /No such file or directory/
173+
save("VIM History for #{user}", vim_hist) unless vim_hist.blank? || vim_hist =~ /No such file or directory/
174174
end
175175
end
176176
end

0 commit comments

Comments
 (0)