Class: Fog::XenServer::Connection
- Inherits:
-
Object
- Object
- Fog::XenServer::Connection
- Defined in:
- lib/chef/provisioning/fog_driver/providers/xenserver.rb
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
Instance Method Summary collapse
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
171 172 173 |
# File 'lib/chef/provisioning/fog_driver/providers/xenserver.rb', line 171 def credentials @credentials end |
Instance Method Details
#request(options, *params) ⇒ Object
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/chef/provisioning/fog_driver/providers/xenserver.rb', line 173 def request(, *params) begin parser = .delete(:parser) method = .delete(:method) if params.empty? response = @factory.call_async(method, @credentials) else if params.length.eql?(1) and params.first.is_a?(Hash) response = @factory.call_async(method, @credentials, params.first) elsif params.length.eql?(2) and params.last.is_a?(Array) response = @factory.call_async(method, @credentials, params.first, params.last) else response = eval("@factory.call_async('#{method}', '#{@credentials}', #{params.map { |p| p.is_a?(String) ? "'#{p}'" : p }.join(',')})") end end raise RequestFailed.new("#{method}: " + response["ErrorDescription"].to_s) unless response["Status"].eql? "Success" if parser parser.parse(response["Value"]) response = parser.response end response end end |