Blocked in curl 404

This commit is contained in:
Tino Vazquez committed 2018-04-13 10:05:17 +02:00
1 parent df857298e4
commit dffa2c023e
3 files changed
+16 -12

No files matched your search

@@ -16,7 +16,7 @@
# limitations under the License. #
# ---------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
@@ -89,7 +89,6 @@ begin
ds.download_to_stdout(img_src)
end
end
rescue Exception => e
STDERR.puts "Cannot download image #{u.path} from datastore #{ds_id} "\
"Reason: \"#{e.message}\"\n#{e.backtrace}"
@@ -60,6 +60,8 @@ class Storage
include Memoize
CURLBIN = "curl"
def self.new_from_ref(ref, vi_client)
if ref.start_with?('group-')
return VCenterDriver::StoragePod.new_from_ref(ref, vi_client)
@@ -478,14 +480,14 @@ class Datastore < Storage
end
def generate_file_url(path)
protocol = self[_connection.http.use_ssl?] ? 'https://' : 'http://'
hostname = self[_connection.http.address]
port = self[_connection.http.port]
protocol = self["_connection.http.use_ssl?"] ? 'https://' : 'http://'
hostname = self["_connection.http.address"]
port = self["_connection.http.port"]
dcpath = get_dc_path
# This creates the vcenter file URL for uploading or downloading files
# e.g:
url = "#{protocol}#{hostname}:#{port}/folder/#{path}?dcPath=#{dcpath}&dsName=#{self[name]}"
url = "#{protocol}#{hostname}:#{port}/folder/#{path}?dcPath=#{dcpath}&dsName=#{self['name']}"
return url
end
@@ -493,7 +495,7 @@ class Datastore < Storage
url = generate_file_url(remote_path)
pid = spawn(CURLBIN,
"-k", '--noproxy', '*', '-f',
"-b", self[_connection.cookie],
"-b", self["_connection.cookie"],
url)
Process.waitpid(pid, 0)
@@ -506,7 +508,7 @@ class Datastore < Storage
rout, wout = IO.pipe
pid = spawn(CURLBIN,
"-I", "-k", '--noproxy', '*', '-f',
"-b", _connection.cookie,
"-b", self["_connection.cookie"],
url,
:out => wout,
:err => '/dev/null')
@@ -527,7 +529,7 @@ class Datastore < Storage
rout, wout = IO.pipe
pid = spawn CURLBIN, "-k", '--noproxy', '*', '-f',
"-b", _connection.cookie,
"-b", self["_connection.cookie"],
url,
:out => wout,
:err => '/dev/null'
@@ -1147,11 +1147,14 @@ class VirtualMachine < Template
# @param one_item OpenNebula::VirtualMachine
# @param vi_client VCenterDriver::VIClient
# @return String vmware ref
def clone_vm(drv_action)
def clone_vm(drv_action, vi_client)
@vi_client = vi_client
vcenter_name = get_vcenter_name
vc_template_ref = drv_action['USER_TEMPLATE/VCENTER_TEMPLATE_REF']
vc_template = RbVmomi::VIM::VirtualMachine(@vi_client.vim, vc_template_ref)
vc_template = RbVmomi::VIM::VirtualMachine(vi_client.vim, vc_template_ref)
ds = get_ds
@@ -1160,7 +1163,7 @@ class VirtualMachine < Template
if ds.instance_of? RbVmomi::VIM::Datastore
use_linked_clones = drv_action['USER_TEMPLATE/VCENTER_LINKED_CLONES']
if use_linked_clones && use_linked_clones.downcase == "yes"
if use_linked_clones && use_linked_clones.downcase == 'yes'
# Check if all disks in template has delta disks
disks = vc_template.config
.hardware.device.grep(RbVmomi::VIM::VirtualDisk)