Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Added new actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shogun committed Mar 10, 2014
1 parent f5b8207 commit 18d3ac2
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/devdnsd/application.rb
Expand Up @@ -241,8 +241,7 @@ def create_resolver(_, resolver_path)
logger.info(replace_markers(i18n.resolver_creating(resolver_path)))

script = Tempfile.new("devdnsd-install-script")
script.write("mkdir -p '#{File.dirname(resolver_path)}'\n")
script.write("rm -rf '#{resolver_path}'\n")
script.write("mkdir -p '#{File.dirname(resolver_path)}'\nrm -rf '#{resolver_path}'\n")
script.write("echo 'nameserver 127.0.0.1\\nport #{@config.port}' >> '#{resolver_path}'")
script.close

Expand Down Expand Up @@ -780,9 +779,7 @@ def read_configuration(options)
@logger = nil
@logger = get_logger
rescue Bovem::Errors::InvalidConfiguration => e
logger = Bovem::Logger.create($stderr)
logger.fatal(e.message)
logger.warn(replace_markers(i18n.application_create_config(path)))
log_failed_configuration(path, e)
raise ::SystemExit
end
end
Expand All @@ -798,5 +795,15 @@ def ensure_directory_for(path)
raise ::SystemExit
end
end

# Logs a failed configuration
#
# @param path [String] The path of the invalid file.
# @param exception [Exception] The occurred exception.
def log_failed_configuration(path, exception)
logger = Bovem::Logger.create($stderr)
logger.fatal(exception.message)
logger.warn(replace_markers(i18n.application_create_config(path)))
end
end
end

0 comments on commit 18d3ac2

Please sign in to comment.