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

B #4392: Detect VNC proxy under Apache Passenger (#4432)

This commit is contained in:
Sergio Betanzos 2020-03-26 19:20:46 +01:00 committed by GitHub
parent 6a209118da
commit 374b9f6845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,6 +190,10 @@ class OpenNebulaVNC
def proxy(vm_resource)
# Check configurations and VM attributes
unless is_lockfile?
return error(400, "VNC Proxy is not running")
end
if !is_running?
return error(400, "VNC Proxy is not running")
end
@ -344,6 +348,20 @@ class OpenNebulaVNC
end
alias_method :get_pid, :is_running?
def is_lockfile?
dn = File.dirname(@lock_file)
bn = File.basename(@lock_file)
# Due to restrictions which doesn't allow to stat the lock file
# when Sunstone is running under Apache with SELinux enabled,
# as a workaround we read content of the whole lock directory.
begin
Dir.entries(dn).include?(bn)
rescue StandardError
false
end
end
if RUBY_VERSION<'1.9'
def spawn(*args)
fork {