Comments (1)
Hello,
CF 3.2 no longer ships with the xmlimple ruby gem. I have been slowly migrating those methods to convert them to use JSON instead. So you can do 1 of the following:
-
install the xmlsimple ruby gem - I do not recommend this approach.
-
change your REST call to use JSON formatting instead. I sent you an email with the updated methods.
Here is a snippet:
def call_rhev(action, ref=nil, body_type=:json, body=nil)
require 'rest_client'
require 'json'
servername = @vm.ext_management_system.hostname
username = @vm.ext_management_system.authentication_userid
password = @vm.ext_management_system.authentication_password
unless ref.nil?
url = ref if ref.include?('http')
end
url ||= "https://#{servername}"+"#{ref}"
params = {
:method=>action, :url=>url,:user=>username, :password=>password,
:verify_ssl=>false, :headers=>{ :content_type=>body_type, :accept=>:json }
}
body_type == :json ? (params[:payload] = JSON.generate(body) if body) : (params[:payload] = body if body)
log_and_update_message(:info, "Calling url: #{url} action: #{action} payload: #{params[:payload]}")
response = RestClient::Request.new(params).execute
log_and_update_message(:info, "response headers: #{response.headers.inspect}")
log_and_update_message(:info, "response code: #{response.code}")
log_and_update_message(:info, "response: #{response.inspect}")
return JSON.parse(response) rescue (return response)
end
body_hash = {
"type"=>volume_option[:type],
"size"=>volume_option[:size_in_bytes],
"interface"=>volume_option[:interface],
"format"=>volume_option[:format],
"bootable"=>volume_option[:bootable],
"storage_domain"=>{"id"=>volume_option[:storage_domain_id]}
}
log_and_update_message(:info, "Creating disk#: #{volume_option[:vol_index]} volume_options: #{volume_option}")
create_disk_response_hash = call_rhev(:post, "#{@vm.ems_ref}/disks", :json, body_hash)
from cloudformspoc.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudformspoc.