Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ian Eiloart
Sympl
Commits
30f1555d
Commit
30f1555d
authored
Apr 10, 2015
by
Patrick J Cherry
Browse files
Changed further instances of File.exists? to File.exist?
parent
c7d4ddcf
Changes
18
Hide whitespace changes
Inline
Side-by-side
Rakefile
View file @
30f1555d
...
...
@@ -69,7 +69,7 @@ def all_packages
@all_packages
=
Dir
[
"*"
].
collect
do
|
pkgdir
|
next
unless
File
.
exist
s
?
(
pkgdir
+
"/debian/changelog"
)
next
unless
File
.
exist?
(
pkgdir
+
"/debian/changelog"
)
bin_pkgs
=
[]
source
=
pkg
=
arch
=
version
=
distro
=
nil
...
...
backup/backup.d/pre-backup.d/10-dump-mysql
View file @
30f1555d
...
...
@@ -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
.
exist
s
?
(
backup_dir
)
Symbiosis
::
Utils
.
mkdir_p
backup_dir
unless
File
.
exist?
(
backup_dir
)
#
# If we don't have mysqld installed exit.
...
...
backup/backup.d/pre-backup.d/20-dump-postgres
View file @
30f1555d
...
...
@@ -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
.
exist
s
?
(
backup_dir
)
Symbiosis
::
Utils
.
mkdir_p
backup_dir
unless
File
.
exist?
(
backup_dir
)
begin
user
=
Etc
.
getpwnam
(
"postgres"
)
...
...
common/bin/symbiosis-encrypt-password
View file @
30f1555d
...
...
@@ -131,7 +131,7 @@ if ARGV.length == 0
# Read the password in from STDIN
#
password
=
STDIN
.
gets
.
chomp
elsif
File
.
exist
s
?
(
ARGV
.
first
)
elsif
File
.
exist?
(
ARGV
.
first
)
#
# Read the password from a file
#
...
...
dns/sbin/symbiosis-dns-generate
View file @
30f1555d
...
...
@@ -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
.
exist
s
?
(
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
.
exist
s
?
(
hash_file
)
if
File
.
exist?
(
hash_file
)
old_hash
=
File
.
readlines
(
hash_file
).
first
.
to_s
.
chomp
else
old_hash
=
nil
...
...
email/symbiosis/monit.d/clamav-daemon
View file @
30f1555d
...
...
@@ -43,7 +43,7 @@ class ClamdCheck < Symbiosis::Monitor::Check
#
def
should_ignore?
self
.
class
.
dpkg_running?
or
(
not
File
.
exist
s
?
(
@process
.
initscript
)
and
not
should_be_running
)
(
not
File
.
exist?
(
@process
.
initscript
)
and
not
should_be_running
)
end
end
...
...
email/symbiosis/monit.d/spamassassin
View file @
30f1555d
...
...
@@ -22,7 +22,7 @@ class SpamdCheck < Symbiosis::Monitor::Check
#
def
should_ignore?
self
.
class
.
dpkg_running?
or
(
not
File
.
exist
s
?
(
@process
.
initscript
)
and
not
should_be_running
)
(
not
File
.
exist?
(
@process
.
initscript
)
and
not
should_be_running
)
end
def
do_check
...
...
firewall/action.d/load.sh.erb
View file @
30f1555d
...
...
@@ -68,7 +68,7 @@ done
#
% %w(whitelist blacklist).each do |chain|
% dir = File.join(base_dir, "#{chain}.d")
% disabled = (!File.directory?(dir) or File.exist
s
?(File.join(dir,"disabled.#{chain}")) or File.exist
s
?(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
#
...
...
firewall/action.d/reload-blacklist.sh.erb
View file @
30f1555d
...
...
@@ -24,7 +24,7 @@ set -v
#
% chain = "blacklist"
% dir = File.join(base_dir, "#{chain}.d")
% disabled = (!File.directory?(dir) or File.exist
s
?(File.join(dir,"disabled.#{chain}")) or File.exist
s
?(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
#
...
...
firewall/action.d/reload-whitelist.sh.erb
View file @
30f1555d
...
...
@@ -24,7 +24,7 @@ set -v
#
% chain = "whitelist"
% dir = File.join(base_dir, "#{chain}.d")
% disabled = (!File.directory?(dir) or File.exist
s
?(File.join(dir,"disabled.#{chain}")) or File.exist
s
?(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
#
...
...
firewall/sbin/symbiosis-firewall
View file @
30f1555d
...
...
@@ -247,7 +247,7 @@ end
#
# Exit if we've been disabled, but not if we're flushing the firewall.
#
if
File
.
exist
s
?
(
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
.
exist
s
?
(
script_path
)
break
if
File
.
exist?
(
script_path
)
end
#
# Make sure we can find the script
#
unless
(
File
.
exist
s
?
(
script_path
)
)
unless
(
File
.
exist?
(
script_path
)
)
warn
"symbiosis-firewall: Could not find action script for
#{
action
.
inspect
}
"
exit
1
end
...
...
firewall/sbin/symbiosis-firewall-blacklist
View file @
30f1555d
...
...
@@ -176,7 +176,7 @@ require 'symbiosis/firewall/pattern'
#
# Exit if we've been disabled
#
if
%w(disabled.blacklist blacklist.d/disabled)
.
any?
{
|
fn
|
File
.
exist
s
?
(
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
...
...
firewall/sbin/symbiosis-firewall-whitelist
View file @
30f1555d
...
...
@@ -158,7 +158,7 @@ require 'symbiosis/ipaddr'
#
# Exit if we've been disabled
#
if
%w(disabled.whitelist whitelist.d/disabled)
.
any?
{
|
fn
|
File
.
exist
s
?
(
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
.
exist
s
?
(
stamp_file
)
if
File
.
exist?
(
stamp_file
)
last_run
=
File
.
stat
(
stamp_file
).
mtime
else
last_run
=
nil
...
...
httpd/sbin/symbiosis-httpd-generate-stats
View file @
30f1555d
...
...
@@ -227,7 +227,7 @@ Symbiosis::Domains.each(prefix) do |domain|
#
# Now stat() it -- webalizer updates this file with each run.
#
if
File
.
exist
s
?
(
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
.
exist
s
?
(
cdir
)
break
if
File
.
exist?
(
cdir
)
cdir
,
odir
=
File
.
split
(
cdir
)
end
...
...
httpd/sbin/symbiosis-httpd-rotate-logs
View file @
30f1555d
...
...
@@ -141,7 +141,7 @@ Symbiosis::Domains.each(prefix) do |domain|
#
# Check the log directory exists.
#
unless
(
File
.
exist
s
?
(
domain
.
log_dir
)
)
unless
(
File
.
exist?
(
domain
.
log_dir
)
)
verbose
"
\t
Skipping as
#{
domain
.
log_dir
}
doesn't exist."
next
end
...
...
monit/monit.d/sshd
View file @
30f1555d
...
...
@@ -14,7 +14,7 @@ class SshdCheck < Symbiosis::Monitor::Check
sshd_config
=
"/etc/ssh/sshd_config"
@port
=
@host
=
nil
if
(
File
.
exist
s
?
(
sshd_config
)
)
if
(
File
.
exist?
(
sshd_config
)
)
# Need to parse for:
#
# ListenAddress host|IPv4_addr|IPv6_addr
...
...
monit/sbin/symbiosis-monit
View file @
30f1555d
...
...
@@ -247,7 +247,7 @@ require 'log4r/outputter/syslogoutputter'
#
# Exit if we've been disabled
#
if
File
.
exist
s
?
(
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
.
exist
s
?
(
"/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
...
...
xmpp/sbin/symbiosis-xmpp-configure
View file @
30f1555d
...
...
@@ -131,7 +131,7 @@ end
#
# Disable creation of mass hosting sites.
#
if
File
.
exist
s
?
(
"/etc/symbiosis/xmpp.d/disabled"
)
if
File
.
exist?
(
"/etc/symbiosis/xmpp.d/disabled"
)
verbose
"Symbiosis automatic prosody configuration disabled. Exiting."
exit
0
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment