1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-09 09:57:23 +03:00

B #-: Drop the /etc/one/onegate-proxy.conf file (onecfg fix) (#2407)

This commit is contained in:
Michal Opala 2022-12-07 09:25:48 +01:00 committed by GitHub
parent 3355250205
commit 777b5fd6f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 19 deletions

View File

@ -158,7 +158,7 @@ if [ -z "$ROOT" ] ; then
CHOWN_DIRS=""
elif [ "$ONEGATE_PROXY" = "yes" ]; then
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \
$ONEGATE_PROXY_LOCATION $ETC_LOCATION"
$ONEGATE_PROXY_LOCATION"
DELETE_DIRS="$MAKE_DIRS"
@ -225,7 +225,7 @@ else
DELETE_DIRS="$MAKE_DIRS"
elif [ "$ONEGATE_PROXY" = "yes" ]; then
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \
$ONEGATE_PROXY_LOCATION $ETC_LOCATION"
$ONEGATE_PROXY_LOCATION"
DELETE_DIRS="$MAKE_DIRS"
elif [ "$SUNSTONE" = "yes" ]; then
@ -944,7 +944,6 @@ INSTALL_ONEGATE_PROXY_FILES=(
)
INSTALL_ONEGATE_PROXY_ETC_FILES=(
ONEGATE_PROXY_ETC_FILES:$ETC_LOCATION
ONEGATE_PROXY_REMOTES_ETC_FILES:$VAR_LOCATION/remotes/etc
)
@ -2972,9 +2971,7 @@ ONEGATE_PROXY_FILES="src/onegate-proxy/onegate-proxy.rb"
ONEGATE_PROXY_BIN_FILES="src/onegate-proxy/bin/onegate-proxy"
ONEGATE_PROXY_ETC_FILES="src/onegate-proxy/etc/onegate-proxy.conf"
ONEGATE_PROXY_REMOTES_ETC_FILES="$ONEGATE_PROXY_ETC_FILES"
ONEGATE_PROXY_REMOTES_ETC_FILES="src/onegate-proxy/etc/onegate-proxy.conf"
#-----------------------------------------------------------------------------
# OneFlow files

View File

@ -22,14 +22,12 @@ if [ -z "$ONE_LOCATION" ]; then
ONEGATE_PROXY_LOCK_FILE=/var/lock/one/.onegate-proxy.lock
ONEGATE_PROXY_LOG=/var/log/one/onegate-proxy.log
ONEGATE_PROXY_LOG_ERROR=/var/log/one/onegate-proxy.error
ONEGATE_PROXY_CONF=/etc/one/onegate-proxy.conf
else
ONEGATE_PROXY_PID=$ONE_LOCATION/var/onegate-proxy.pid
ONEGATE_PROXY_SERVER=$ONE_LOCATION/lib/onegate-proxy/onegate-proxy.rb
ONEGATE_PROXY_LOCK_FILE=$ONE_LOCATION/var/.onegate-proxy.lock
ONEGATE_PROXY_LOG=$ONE_LOCATION/var/onegate-proxy.log
ONEGATE_PROXY_LOG_ERROR=$ONE_LOCATION/var/onegate-proxy.error
ONEGATE_PROXY_CONF=$ONE_LOCATION/etc/onegate-proxy.conf
fi
setup()

View File

@ -40,8 +40,7 @@ else
REMOTES_LOCATION = ONE_LOCATION + '/var/remotes'
end
CONFIGURATION_FILE = ETC_LOCATION + '/onegate-proxy.conf'
DYNAMIC_CONFIGURATION_FILE = REMOTES_LOCATION + '/etc/onegate-proxy.conf'
CONFIGURATION_FILE = REMOTES_LOCATION + '/etc/onegate-proxy.conf'
# %%RUBYGEMS_SETUP_BEGIN%%
if File.directory?(GEMS_LOCATION)
@ -178,9 +177,9 @@ class OneGateProxy
def setup_inotify
inotify = INotify::Notifier.new
inotify.watch(DYNAMIC_CONFIGURATION_FILE, :modify) do
inotify.watch(CONFIGURATION_FILE, :modify) do
@logger.info(self) do
"#{DYNAMIC_CONFIGURATION_FILE} has been just updated, exiting.."
"#{CONFIGURATION_FILE} has been just updated, exiting.."
end
# We assume here that the service will be restarted by
# the service manager.
@ -285,15 +284,13 @@ class OneGateProxy
end
if caller.empty?
# NOTE: The "DYNAMIC_CONFIGURATION_FILE" is copied during the host
# sync procedure and should just contain OneGate's address and port.
# Contacting OpenNebula's API in this simple service looks like
# an overkill..
options = DEFAULT_OPTIONS.dup
[CONFIGURATION_FILE, DYNAMIC_CONFIGURATION_FILE].each do |path|
options.merge!(YAML.load_file(path) || {}) if File.exist?(path)
# NOTE: The "CONFIGURATION_FILE" is updated during the host sync procedure.
begin
options.merge! YAML.load_file(CONFIGURATION_FILE)
rescue StandardError => e
warn "Error parsing config file #{path}: #{e.message}"
warn "Error parsing config file #{CONFIGURATION_FILE}: #{e.message}"
exit 1
end