Update image_create logic to adapt http proxy
Change-Id: Iae0bdff21477ae90a0976b475c42e44803b3ec3d
This commit is contained in:
parent
afc8b44162
commit
1b63fe3993
@ -64,10 +64,16 @@ def _upload_qcow(name, api, url)
|
||||
glance_cmd = "glance --insecure --os-username #{@user} --os-password #{@pass} --os-tenant-name #{@tenant} --os-image-url #{api} --os-auth-url #{@ks_uri}"
|
||||
c_fmt = '--container-format bare'
|
||||
d_fmt = '--disk-format qcow2'
|
||||
img_file_name = ::File.basename(url)
|
||||
remote_file "#{Chef::Config[:file_cache_path]}/#{img_file_name}" do
|
||||
source "#{url}"
|
||||
action :create_if_missing
|
||||
end
|
||||
|
||||
execute "Uploading QCOW2 image #{name}" do
|
||||
cwd '/tmp'
|
||||
command "#{glance_cmd} image-create --name #{name} --is-public true #{c_fmt} #{d_fmt} --location #{url}"
|
||||
cwd Chef::Config[:file_cache_path]
|
||||
command "#{glance_cmd} image-create --name #{name} \
|
||||
--is-public true #{c_fmt} #{d_fmt} < #{img_file_name}"
|
||||
not_if "#{glance_cmd} image-list | grep #{name.to_s}"
|
||||
end
|
||||
end
|
||||
@ -104,9 +110,12 @@ def _upload_ami(name, api, url) # rubocop:disable MethodLength
|
||||
|
||||
kernel=$(ls *.img | head -n1)
|
||||
|
||||
kid=$(#{glance_cmd} image-create --name "${image_name}-kernel" --is-public true #{aki_fmt} < ${kernel_file} | cut -d: -f2 | sed 's/ //')
|
||||
rid=$(#{glance_cmd} image-create --name "${image_name}-initrd" --is-public true #{ari_fmt} < ${ramdisk} | cut -d: -f2 | sed 's/ //')
|
||||
#{glance_cmd} image-create --name "#{name}" --is-public true #{ami_fmt} --property "kernel_id=$kid" --property "ramdisk_id=$rid" < ${kernel}
|
||||
kid=$(#{glance_cmd} image-create --name "${image_name}-kernel" --is-public true \
|
||||
#{aki_fmt} < ${kernel_file} | cut -d: -f2 | sed 's/ //')
|
||||
rid=$(#{glance_cmd} image-create --name "${image_name}-initrd" --is-public true \
|
||||
#{ari_fmt} < ${ramdisk} | cut -d: -f2 | sed 's/ //')
|
||||
#{glance_cmd} image-create --name "#{name}" --is-public true #{ami_fmt} \
|
||||
--property "kernel_id=$kid" --property "ramdisk_id=$rid" < ${kernel}
|
||||
EOH
|
||||
not_if "#{glance_cmd} image-list | grep #{name.to_s}"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user