From 8b2c5a9512c0efb68a0999f14a98f281f447f1ee Mon Sep 17 00:00:00 2001 From: Pierre-Luc Dion Date: Sat, 18 Oct 2014 22:38:00 -0400 Subject: [PATCH 1/4] add http.open_timeout option, to fail faster if can't create socket. --- lib/cloudstack_ruby_client/base_client.rb | 12 +++++++----- lib/cloudstack_ruby_client/version.rb | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/cloudstack_ruby_client/base_client.rb b/lib/cloudstack_ruby_client/base_client.rb index 180f387..cf7cdbb 100644 --- a/lib/cloudstack_ruby_client/base_client.rb +++ b/lib/cloudstack_ruby_client/base_client.rb @@ -1,10 +1,11 @@ class CloudstackRubyClient::BaseClient - def initialize(api_url, api_key, secret_key, use_ssl=nil) - @api_url = api_url - @api_key = api_key - @secret_key = secret_key - @use_ssl = use_ssl + def initialize(api_url, api_key, secret_key, use_ssl=nil, open_timeout=5) + @api_url = api_url + @api_key = api_key + @secret_key = secret_key + @use_ssl = use_ssl + @open_timeout = open_timeout end def request(params) @@ -21,6 +22,7 @@ def request(params) uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = @use_ssl + http.open_timeout = @open_timeout # fail the connection faster if can't open socket http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(uri.request_uri) diff --git a/lib/cloudstack_ruby_client/version.rb b/lib/cloudstack_ruby_client/version.rb index 0dce2db..1c4fa56 100644 --- a/lib/cloudstack_ruby_client/version.rb +++ b/lib/cloudstack_ruby_client/version.rb @@ -1,3 +1,3 @@ module CloudstackRubyClient - VERSION = "1.0.1" + VERSION = "1.0.2" end From c50cbed65ae64b6157b721b647e38d94f8c1b231 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Dion Date: Sat, 15 Nov 2014 16:53:25 -0500 Subject: [PATCH 2/4] add connection timout --- lib/cloudstack_ruby_client/base_client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cloudstack_ruby_client/base_client.rb b/lib/cloudstack_ruby_client/base_client.rb index cf7cdbb..b780875 100644 --- a/lib/cloudstack_ruby_client/base_client.rb +++ b/lib/cloudstack_ruby_client/base_client.rb @@ -1,6 +1,6 @@ class CloudstackRubyClient::BaseClient - def initialize(api_url, api_key, secret_key, use_ssl=nil, open_timeout=5) + def initialize(api_url, api_key, secret_key, use_ssl=nil, open_timeout=20) @api_url = api_url @api_key = api_key @secret_key = secret_key From 8c0a77edb7782965dc8f1bd8c11f2eb6b6c0bd8a Mon Sep 17 00:00:00 2001 From: Pierre-Luc Dion Date: Sat, 15 Nov 2014 16:53:55 -0500 Subject: [PATCH 3/4] add version of cloudstack management server, ex: @client.version --- lib/cloudstack_ruby_client/client.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cloudstack_ruby_client/client.rb b/lib/cloudstack_ruby_client/client.rb index 16bf41d..f8cd53e 100644 --- a/lib/cloudstack_ruby_client/client.rb +++ b/lib/cloudstack_ruby_client/client.rb @@ -26,6 +26,11 @@ def self.API_LIST @@API_LIST end + ## CloudStack management server version + def version + self.list_capabilities["capability"]["cloudstackversion"] + end + ## login api command def login(params = {}) auth_request(params, "login") From 528a649a286b4d7551f2416bfedd2a0229718805 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Dion Date: Sat, 15 Nov 2014 16:54:23 -0500 Subject: [PATCH 4/4] add missing API call, it's ugly, but it work. --- lib/cloudstack_ruby_client/api/network_api.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/cloudstack_ruby_client/api/network_api.rb b/lib/cloudstack_ruby_client/api/network_api.rb index fd337d8..e2977c6 100644 --- a/lib/cloudstack_ruby_client/api/network_api.rb +++ b/lib/cloudstack_ruby_client/api/network_api.rb @@ -44,9 +44,15 @@ module NetworkDevice end module NetworkACL - cmd_processor :create_network_acl, - :delete_network_acl, - :list_network_acls, + cmd_processor :create_network_a_c_l, + :update_network_a_c_l_item, + :delete_network_a_c_l, + :list_network_a_c_ls, + :create_network_a_c_l_list, + :delete_network_a_c_l_list, + :replace_network_a_c_l_list, + :list_network_a_c_l_lists, + :update_network_a_c_l_list, :list_nicira_nvp_device_networks end