mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-14 01:57:24 +03:00
parent
b9f4066e4f
commit
a23950434e
@ -118,17 +118,6 @@ class OpenNebulaVMRC
|
||||
@logger = logger
|
||||
end
|
||||
|
||||
def sanitize(ticket)
|
||||
# Bad as defined by wikipedia: https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
|
||||
# Also have to escape the backslash
|
||||
bad_chars = ['/', '\\', '?', '%', '*', ':',
|
||||
'|', '"', '<', '>', '.', ' ']
|
||||
bad_chars.each do |bad_char|
|
||||
ticket.gsub!(bad_char, '_')
|
||||
end
|
||||
ticket
|
||||
end
|
||||
|
||||
def proxy(vm_resource, client = nil)
|
||||
# Check configurations and VM attributes
|
||||
unless VMRC_STATES.include?(vm_resource['LCM_STATE'])
|
||||
@ -169,7 +158,7 @@ class OpenNebulaVMRC
|
||||
:ticket => parameters[:ticket]
|
||||
}
|
||||
|
||||
file = File.open(VMRC_TICKETS + sanitize(data[:ticket]), 'w')
|
||||
file = File.open(VMRC_TICKETS + VCenterDriver::FileHelper.sanitize(data[:ticket]), 'w')
|
||||
file.write('https://' + data[:host] + ':' + data[:port].to_s)
|
||||
file.close
|
||||
|
||||
|
@ -554,7 +554,9 @@ module VCenterDriver
|
||||
full_process = !args[:short]
|
||||
|
||||
vc_network_ref = vc_network._ref
|
||||
vc_network_name = vc_network.name
|
||||
vc_network_name = VCenterDriver::FileHelper.sanitize(
|
||||
vc_network.name
|
||||
)
|
||||
vc_network_host = vc_network['host']
|
||||
vc_network_tag = vc_network['tag']
|
||||
|
||||
|
@ -27,6 +27,19 @@ module VCenterDriver
|
||||
##########################################################################
|
||||
class FileHelper
|
||||
|
||||
def self.sanitize(text)
|
||||
# Bad as defined by wikipedia:
|
||||
# https://en.wikipedia.org/wiki/Filename in
|
||||
# Reserved_characters_and_words
|
||||
# Also have to escape the backslash
|
||||
bad_chars = ['/', '\\', '?', '%', '*', ':',
|
||||
'|', '"', '<', '>', '.', ' ']
|
||||
bad_chars.each do |bad_char|
|
||||
text.gsub!(bad_char, '_')
|
||||
end
|
||||
text
|
||||
end
|
||||
|
||||
def self.get_img_name(
|
||||
disk,
|
||||
vm_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user