Commit 30f1555d authored by Patrick J Cherry's avatar Patrick J Cherry
Browse files

Changed further instances of File.exists? to File.exist?

parent c7d4ddcf
......@@ -69,7 +69,7 @@ def all_packages
@all_packages = Dir["*"].collect do |pkgdir|
next unless File.exists?(pkgdir+"/debian/changelog")
next unless File.exist?(pkgdir+"/debian/changelog")
bin_pkgs = []
source = pkg = arch = version = distro = nil
......
......@@ -17,7 +17,7 @@ database_dump_cmd = "/usr/bin/mysqldump"
# If we don't have a backup directory then create it. Backup2l will complain
# if this isn't present.
#
Symbiosis::Utils.mkdir_p backup_dir unless File.exists?(backup_dir)
Symbiosis::Utils.mkdir_p backup_dir unless File.exist?(backup_dir)
#
# If we don't have mysqld installed exit.
......
......@@ -15,7 +15,7 @@ backup_dir = "/var/backups/postgresql"
# If we don't have a backup directory then create it. Backup2l will complain
# if this isn't present.
#
Symbiosis::Utils.mkdir_p backup_dir unless File.exists?(backup_dir)
Symbiosis::Utils.mkdir_p backup_dir unless File.exist?(backup_dir)
begin
user = Etc.getpwnam("postgres")
......
......@@ -131,7 +131,7 @@ if ARGV.length == 0
# Read the password in from STDIN
#
password = STDIN.gets.chomp
elsif File.exists?(ARGV.first)
elsif File.exist?(ARGV.first)
#
# Read the password from a file
#
......
......@@ -216,7 +216,7 @@ Symbiosis::Domains.each do |domain|
#
# Create directory with the same ownership as the parent
#
domain.create_dir(output_dir) unless File.exists?(output_dir)
domain.create_dir(output_dir) unless File.exist?(output_dir)
#
# Write the snippet
......@@ -295,7 +295,7 @@ begin
#
hash_file = File.expand_path(File.join(bytemarkdns_dir,".hash"))
if File.exists?(hash_file)
if File.exist?(hash_file)
old_hash = File.readlines(hash_file).first.to_s.chomp
else
old_hash = nil
......
......@@ -43,7 +43,7 @@ class ClamdCheck < Symbiosis::Monitor::Check
#
def should_ignore?
self.class.dpkg_running? or
(not File.exists?(@process.initscript) and not should_be_running)
(not File.exist?(@process.initscript) and not should_be_running)
end
end
......
......@@ -22,7 +22,7 @@ class SpamdCheck < Symbiosis::Monitor::Check
#
def should_ignore?
self.class.dpkg_running? or
(not File.exists?(@process.initscript) and not should_be_running)
(not File.exist?(@process.initscript) and not should_be_running)
end
def do_check
......
......@@ -68,7 +68,7 @@ done
#
% %w(whitelist blacklist).each do |chain|
% dir = File.join(base_dir, "#{chain}.d")
% disabled = (!File.directory?(dir) or File.exists?(File.join(dir,"disabled.#{chain}")) or File.exists?(File.join(dir,"disabled")))
% disabled = (!File.directory?(dir) or File.exist?(File.join(dir,"disabled.#{chain}")) or File.exist?(File.join(dir,"disabled")))
#######################################################################
for cmd in <%= iptables_cmds.join(" ") %> ; do
#
......
......@@ -24,7 +24,7 @@ set -v
#
% chain = "blacklist"
% dir = File.join(base_dir, "#{chain}.d")
% disabled = (!File.directory?(dir) or File.exists?(File.join(dir,"disabled.#{chain}")) or File.exists?(File.join(dir,"disabled")))
% disabled = (!File.directory?(dir) or File.exist?(File.join(dir,"disabled.#{chain}")) or File.exist?(File.join(dir,"disabled")))
#######################################################################
for cmd in <%= iptables_cmds.join(" ") %> ; do
#
......
......@@ -24,7 +24,7 @@ set -v
#
% chain = "whitelist"
% dir = File.join(base_dir, "#{chain}.d")
% disabled = (!File.directory?(dir) or File.exists?(File.join(dir,"disabled.#{chain}")) or File.exists?(File.join(dir,"disabled")))
% disabled = (!File.directory?(dir) or File.exist?(File.join(dir,"disabled.#{chain}")) or File.exist?(File.join(dir,"disabled")))
#######################################################################
for cmd in <%= iptables_cmds.join(" ") %> ; do
#
......
......@@ -247,7 +247,7 @@ end
#
# Exit if we've been disabled, but not if we're flushing the firewall.
#
if File.exists?(File.join(base_dir, "disabled")) and action != "flush"
if File.exist?(File.join(base_dir, "disabled")) and action != "flush"
verbose "Firewall disabled. Exiting."
exit 0
end
......@@ -406,13 +406,13 @@ begin
#
Template.directories.collect{|d| d.sub("rule.d","action.d") }.each do |script_dir|
script_path = File.join(script_dir, "#{action}.sh.erb")
break if File.exists?(script_path)
break if File.exist?(script_path)
end
#
# Make sure we can find the script
#
unless ( File.exists?(script_path) )
unless ( File.exist?(script_path) )
warn "symbiosis-firewall: Could not find action script for #{action.inspect}"
exit 1
end
......
......@@ -176,7 +176,7 @@ require 'symbiosis/firewall/pattern'
#
# Exit if we've been disabled
#
if %w(disabled.blacklist blacklist.d/disabled).any?{|fn| File.exists?(File.join(base_dir, fn))}
if %w(disabled.blacklist blacklist.d/disabled).any?{|fn| File.exist?(File.join(base_dir, fn))}
puts "Firewall blacklist disabled. Exiting." if $VERBOSE
exit 0
end
......
......@@ -158,7 +158,7 @@ require 'symbiosis/ipaddr'
#
# Exit if we've been disabled
#
if %w(disabled.whitelist whitelist.d/disabled).any?{|fn| File.exists?(File.join(base_dir, fn))}
if %w(disabled.whitelist whitelist.d/disabled).any?{|fn| File.exist?(File.join(base_dir, fn))}
puts "Firewall whitelist disabled. Exiting." if $VERBOSE
exit 0
end
......@@ -208,7 +208,7 @@ expire_before = time_now - ( expire_after * ( 24 * 60 * 60 ) )
#
stamp_file = '/var/lib/symbiosis/symbiosis-firewall-whitelist.stamp'
if File.exists?(stamp_file)
if File.exist?(stamp_file)
last_run = File.stat(stamp_file).mtime
else
last_run = nil
......
......@@ -227,7 +227,7 @@ Symbiosis::Domains.each(prefix) do |domain|
#
# Now stat() it -- webalizer updates this file with each run.
#
if File.exists?(history_file)
if File.exist?(history_file)
last_run = File.stat(history_file).mtime
end
......@@ -251,7 +251,7 @@ Symbiosis::Domains.each(prefix) do |domain|
#
cdir = output_dir
while cdir != "/"
break if File.exists?(cdir)
break if File.exist?(cdir)
cdir, odir = File.split(cdir)
end
......
......@@ -141,7 +141,7 @@ Symbiosis::Domains.each(prefix) do |domain|
#
# Check the log directory exists.
#
unless ( File.exists?(domain.log_dir) )
unless ( File.exist?(domain.log_dir) )
verbose "\tSkipping as #{domain.log_dir} doesn't exist."
next
end
......
......@@ -14,7 +14,7 @@ class SshdCheck < Symbiosis::Monitor::Check
sshd_config = "/etc/ssh/sshd_config"
@port = @host = nil
if ( File.exists?( sshd_config ) )
if ( File.exist?( sshd_config ) )
# Need to parse for:
#
# ListenAddress host|IPv4_addr|IPv6_addr
......
......@@ -247,7 +247,7 @@ require 'log4r/outputter/syslogoutputter'
#
# Exit if we've been disabled
#
if File.exists?(File.join(dir, "disabled"))
if File.exist?(File.join(dir, "disabled"))
msg = "symbiosis-monit: disabled. "
if force
warn msg + "Ignoring as --force given." if $VERBOSE
......@@ -260,7 +260,7 @@ end
#
# Don't run if the machine is still booting
#
if File.exists?("/var/lib/initscripts/nologin")
if File.exist?("/var/lib/initscripts/nologin")
msg = "symbiosis-monit: This machine is still booting. "
if force
warn msg + "Ignoring as --force given." if $VERBOSE
......
......@@ -131,7 +131,7 @@ end
#
# Disable creation of mass hosting sites.
#
if File.exists?("/etc/symbiosis/xmpp.d/disabled")
if File.exist?("/etc/symbiosis/xmpp.d/disabled")
verbose "Symbiosis automatic prosody configuration disabled. Exiting."
exit 0
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment