1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

oZones server refuses to start if htaccess is not writable

This commit is contained in:
Tino Vazquez 2011-09-23 13:04:32 +02:00
parent 8f5c175880
commit 6ba6619c93
4 changed files with 20 additions and 3 deletions

View File

@ -24,7 +24,7 @@
:databasetype: sqlite
#:htaccess: /var/www/.htaccess
:dbdebug: yes
:dbdebug: no
#####################
# Server Configuration

View File

@ -19,6 +19,11 @@ module OZones
class ApacheWritter
def initialize(file_path)
@file_path = file_path
File.open(@file_path, 'w') {|f|
f.flock(File::LOCK_EX)
f.write(htaccess)
}
end
def update

View File

@ -23,11 +23,16 @@ module OZones
@file_path = file_path
else
if !ENV["ONE_LOCATION"]
@file_path="/usr/lib/one/ozones/htaccess"
@file_path="/var/lib/one/.htaccess"
else
@file_path=ENV["ONE_LOCATION"]+"/lib/ozones/htaccess"
@file_path=ENV["ONE_LOCATION"]+"/var/.htaccess"
end
end
# Let's check for file permissions
if !File.writable?(File.dirname(@file_path))
raise "#{@file_path} is not writable"
end
end
def update

View File

@ -97,6 +97,13 @@ end
ADMIN_NAME = @auth.name
ADMIN_PASS = @auth.password
begin
OZones::ProxyRules.new("apache",config[:htaccess])
rescue Exception => e
warn e.message
exit -1
end
##############################################################################
# Sinatra Configuration