Class: VCloudCloud::Steps::UploadTemplateFiles
- Inherits:
-
VCloudCloud::Step
- Object
- VCloudCloud::Step
- VCloudCloud::Steps::UploadTemplateFiles
- Defined in:
- lib/cloud/vcloud/steps/upload_template_files.rb
Instance Attribute Summary
Attributes inherited from VCloudCloud::Step
Instance Method Summary collapse
Methods inherited from VCloudCloud::Step
#cleanup, #initialize, #rollback
Constructor Details
This class inherits a constructor from VCloudCloud::Step
Instance Method Details
#perform(&block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cloud/vcloud/steps/upload_template_files.rb', line 4 def perform(&block) template = client.reload state[:vapp_template] # After uploading a file, we should reload the template object for incomplete_files list # until all files are uploaded. while template.files && !template.files.empty? template.incomplete_files.each do |file| if file.name.end_with?('.ovf') content = File.new(File.join(state[:stemcell_dir], state[:stemcell_ovf])).read client.invoke :put, file.upload_link.href, :payload => content, :headers => { :content_type => VCloudSdk::Xml::MEDIA_TYPE[:OVF] }, :no_wrap => true else f = File.new File.join(state[:stemcell_dir], file.name) @logger.debug "UPLOAD #{f.path}: #{f.size}" client.upload_stream file.upload_link.href, f.size, f end end template = client.reload template end state[:vapp_template] = client.wait_entity template end |