Commit 57b3988e authored by Patrick J Cherry's avatar Patrick J Cherry
Browse files

httpd/common: Moved check for domain-find-failure bug into lib code

This generalises a fix for the problem described in
https://projects.bytemark.co.uk/issues/12783
parent cfdbb13c
......@@ -85,6 +85,7 @@ module Symbiosis
#
def self.all(prefix = "/srv")
results = Array.new
possibles = Array.new
#
# For each domain.
......@@ -102,6 +103,8 @@ module Symbiosis
#
next unless domain =~ Symbiosis::Domain::NAME_REGEXP
possibles << domain
begin
results << Domain.new(domain, this_prefix)
rescue ArgumentError => err
......@@ -109,8 +112,19 @@ module Symbiosis
end
end
#
# Sometimes, significant memory pressure can cause Etc.getpwuid(@uid).name
# to fail. This can cause problems, e.g. symbiosis-httpd-configure is
# then led to believe there aren't any domains and will delete all sites
# from sites-enabled.
#
if possibles.length > 0 and results.length == 0
raise RuntimeError "No domains detected, but there are entries in /srv. This detection failure could be due to memory pressure."
end
results
end
end
end
......@@ -240,16 +240,6 @@ Symbiosis::Domains.each(prefix) do |domain|
configurations << this_config
end
#
# Sometimes, significant memory pressure can cause Etc.getpwuid(@uid).name
# to fail. symbiosis-httpd-configure is then led to believe there aren't any
# domains and will delete all sites from sites-enabled. Exit instead.
#
if configurations.empty?
verbose "\tNo domains detected. This could be due to memory pressure. Exiting."
exit 1
end
#
# Now see to the mass hosting stuff.
#
......
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