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

M #~: clean sunstone_guac (#774)

Signed-off-by: Frederick Borges <fborges@opennebula.io>
This commit is contained in:
Frederick Borges 2021-02-09 11:34:07 +01:00 committed by GitHub
parent 05728fd8bc
commit 08f202395d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 30 deletions

View File

@ -241,7 +241,6 @@ AllCops:
- src/sunstone/test/spec/user_spec.rb
- src/sunstone/OpenNebulaAddons.rb
- src/sunstone/models/sunstone_vnc.rb
- src/sunstone/models/sunstone_guac.rb
- src/sunstone/models/sunstone_vmrc.rb
- src/sunstone/models/sunstone_vm_helper.rb
- src/sunstone/models/OpenNebulaJSON.rb

View File

@ -25,12 +25,8 @@ require 'base64'
require 'openssl'
if !ONE_LOCATION
GUAC_LOCK_FILE = '/var/lock/one/.guac.lock'
GUACD_PID_FILE = '/var/run/one/guacd.pid'
VAR_LOCATION = '/var/lib/one/'
else
GUAC_LOCK_FILE= ONE_LOCATION + '/var/.guac.lock'
GUACD_PID_FILE= ONE_LOCATION + '/var/guacd.pid'
VAR_LOCATION = ONE_LOCATION + '/var/'
end
@ -116,9 +112,6 @@ class SunstoneGuac
def initialize(logger, options = {})
opts={ :json_errors => true }.merge(options)
@lock_file = GUAC_LOCK_FILE
@guacd_pid_file = GUACD_PID_FILE
@options = opts
@logger = logger
end
@ -170,7 +163,7 @@ class SunstoneGuac
'security' => 'any',
'ignore-cert' => 'true',
'enable-drive' => 'true',
#'enable-audio' => 'true',
# 'enable-audio' => 'true',
'create-drive-path' => 'true'
}.merge!(settings)
}
@ -183,31 +176,12 @@ class SunstoneGuac
private
def error(code, msg)
unless @options[:json_error]
return [code, msg]
end
@logger.error(msg)
return [code, msg] unless @options[:json_error]
[code, OpenNebula::Error.new(msg).to_json]
end
if RUBY_VERSION<'1.9'
def spawn(*args)
fork do
command=args[0..-2]
# Close stdin and point out and err to log file
$stdout.reopen(GUACAMOLE_LOG, 'a')
$stderr.reopen(GUACAMOLE_LOG, 'a')
$stdin.close
# Detach process from the parent
Process.setsid
exec(*command)
end
end
end
def get_config_vnc(vm_resource)
# If it is a vCenter VM
if vm_resource['USER_TEMPLATE/HYPERVISOR'] == 'vcenter'