azure-armrest 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea7b40c1bcbf87f8a1a90bd6de8b3a8b91009319
4
- data.tar.gz: 7c01a3f8b1e329c8897b7079bf776e2fa7f09633
3
+ metadata.gz: a89bf6828ff100bbcff625f099a48ac04c9937b8
4
+ data.tar.gz: 1cc4335de5c38155990f7c7d170752a092c5bd96
5
5
  SHA512:
6
- metadata.gz: f64da1aa17e62f474c429bca7ec0fa0923e0f80511f54209a6847402f3fb37aaa4ff1d22d5f8892d7d7525f422d89b7efebd44bde8e1fc86b95f6c224aec9956
7
- data.tar.gz: ea7848938983ce162de715df0d8982b09dab459443861fa1aee3344c6aa127b53cff0133f23d38b104f3e99b437f7a036193419b84875539802112ccc9dbb486
6
+ metadata.gz: 4ddc35af1397dc283a18a44b0abbcfff389e135caa77b9d1540524708e1c760e7d97b15107c5779d6c7c13d0dd44142ee55940a08b584fbc68eb063305c790a0
7
+ data.tar.gz: 31d18ab596d27b4da75555721e86d1ebf4fc798c543a775c0e380ff06ed64d5f100fbfe8f40d290f4ac157aa151a91de5785de7a68dbf3dc3d2498e4e41905d1
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ = 0.3.3 - 1-Aug-2016
2
+ * Added the :max_threads configuration option. This is used internally wherever
3
+ the Parallel gem is used.
4
+ * The default number of threads when used with VCR is reduced to 1.
5
+
1
6
  = 0.3.2 - 21-Jul-2016
2
7
  * The subscription ID is now automatically validated in the
3
8
  Azure::Armrest::Configuration constructor.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## Description
2
2
 
3
+ [![Join the chat at https://gitter.im/ManageIQ/azure-armrest](https://badges.gitter.im/ManageIQ/azure-armrest.svg)](https://gitter.im/ManageIQ/azure-armrest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+
3
5
  A Ruby interface for Azure using the new REST API.
4
6
 
5
7
  [![Gem Version](https://badge.fury.io/rb/azure-armrest.svg)](http://badge.fury.io/rb/azure-armrest)
@@ -60,6 +60,9 @@ module Azure
60
60
  # Namespace providers, their resource types, locations and supported api-version strings.
61
61
  attr_reader :providers
62
62
 
63
+ # Maximum number of threads to use within methods that use Parallel for thread pooling.
64
+ attr_accessor :max_threads
65
+
63
66
  # Yields a new Azure::Armrest::Configuration objects. Note that you must
64
67
  # specify a client_id, client_key, tenant_id and subscription_id. All other
65
68
  # parameters are optional.
@@ -93,8 +96,12 @@ module Azure
93
96
  :grant_type => 'client_credentials',
94
97
  :proxy => ENV['http_proxy'],
95
98
  :ssl_version => 'TLSv1',
99
+ :max_threads => 10
96
100
  }.merge(args.symbolize_keys)
97
101
 
102
+ # Avoid thread safety issues for VCR testing.
103
+ options[:max_threads] = 1 if defined?(VCR)
104
+
98
105
  user_token = options.delete(:token)
99
106
  user_token_expiration = options.delete(:token_expiration)
100
107
 
@@ -212,12 +212,12 @@ module Azure
212
212
 
213
213
  # Returns an array of all blobs for all containers.
214
214
  #
215
- def all_blobs(key = nil)
215
+ def all_blobs(key = nil, max_threads = 10)
216
216
  key ||= properties.key1
217
217
  array = []
218
218
  mutex = Mutex.new
219
219
 
220
- Parallel.each(containers(key), :in_threads => 10) do |container|
220
+ Parallel.each(containers(key), :in_threads => max_threads) do |container|
221
221
  mutex.synchronize { array << blobs(container.name, key) }
222
222
  end
223
223
 
@@ -93,7 +93,7 @@ module Azure
93
93
  array = []
94
94
  mutex = Mutex.new
95
95
 
96
- Parallel.each(list_resource_groups, :in_threads => 10) do |rg|
96
+ Parallel.each(list_resource_groups, :in_threads => configuration.max_threads) do |rg|
97
97
  response = rest_get(build_url(rg.name))
98
98
  results = JSON.parse(response)['value'].map { |hash| model_class.new(hash) }
99
99
  mutex.synchronize { array << results } unless results.blank?
@@ -248,10 +248,10 @@ module Azure
248
248
  results = []
249
249
  mutex = Mutex.new
250
250
 
251
- Parallel.each(storage_accounts, :in_threads => 10) do |storage_account|
251
+ Parallel.each(storage_accounts, :in_threads => configuration.max_threads) do |storage_account|
252
252
  key = get_account_key(storage_account)
253
253
 
254
- storage_account.all_blobs(key).each do |blob|
254
+ storage_account.all_blobs(key, configuration.max_threads).each do |blob|
255
255
  next unless File.extname(blob.name).casecmp('.vhd') == 0
256
256
  next unless blob.properties.lease_state.casecmp('available') == 0
257
257
 
@@ -1,5 +1,5 @@
1
1
  module Azure
2
2
  module Armrest
3
- VERSION = '0.3.2'.freeze
3
+ VERSION = '0.3.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure-armrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-07-21 00:00:00.000000000 Z
14
+ date: 2016-08-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json