mcollective-client 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,7 +59,7 @@ module MCollective
59
59
 
60
60
  MCollective::Vendor.load_vendored
61
61
 
62
- VERSION="2.11.0"
62
+ VERSION="2.11.1"
63
63
 
64
64
  def self.version
65
65
  VERSION
@@ -23,7 +23,8 @@ module MCollective
23
23
  end
24
24
 
25
25
  def []=(key, val)
26
- raise "Can only store String, Integer, Float or Boolean data but got #{val.class} for key #{key}" unless [String, Fixnum, Bignum, Float, TrueClass, FalseClass].include?(val.class)
26
+ # checks using the string representation of the class name to avoid deprecations on Bignum and Fixnum
27
+ raise "Can only store String, Integer, Float or Boolean data but got #{val.class} for key #{key}" unless ["String", "Integer", "Bignum", "Fixnum", "Float", "TrueClass", "FalseClass"].include?(val.class.to_s)
27
28
 
28
29
  @data[key.to_sym] = val
29
30
  end
@@ -125,7 +125,7 @@ module MCollective
125
125
  end
126
126
 
127
127
  def discover(filter, timeout, limit)
128
- raise "Limit has to be an integer" unless limit.is_a?(Fixnum)
128
+ raise "Limit has to be an integer" unless limit.is_a?(Integer)
129
129
 
130
130
  force_discovery_method_by_filter(filter)
131
131
 
@@ -8,6 +8,7 @@ module MCollective
8
8
  # "bar" => "baz"}
9
9
  class Base
10
10
  def initialize
11
+ @mutex = Mutex.new
11
12
  @facts = {}
12
13
  @last_good_facts = {}
13
14
  @last_facts_load = 0
@@ -24,7 +25,7 @@ module MCollective
24
25
 
25
26
  cache_time = config.fact_cache_time || 300
26
27
 
27
- Thread.exclusive do
28
+ @mutex.synchronize do
28
29
  begin
29
30
  if (Time.now.to_i - @last_facts_load > cache_time.to_i ) || force_reload?
30
31
  Log.debug("Resetting facter cache, now: #{Time.now.to_i} last-known-good: #{@last_facts_load}")
@@ -566,7 +566,7 @@ module MCollective
566
566
  # limit method then pass in the limit thus minimizing the amount
567
567
  # of work we do in the discover phase and speeding it up significantly
568
568
  filter = @filter.merge({'collective' => @collective})
569
- if @limit_method == :first and @limit_targets.is_a?(Fixnum)
569
+ if @limit_method == :first and @limit_targets.is_a?(Integer)
570
570
  @discovered_agents = @client.discover(filter, discovery_timeout, @limit_targets)
571
571
  else
572
572
  @discovered_agents = @client.discover(filter, discovery_timeout)
@@ -61,7 +61,7 @@ module MCollective
61
61
  end
62
62
 
63
63
  when "timeout"
64
- raise "timeout should be a positive integer or the symbol :on_thread_exit symbol" unless val.eql?(:on_thread_exit) || ( val.is_a?(Fixnum) && val>0 )
64
+ raise "timeout should be a positive integer or the symbol :on_thread_exit symbol" unless val.eql?(:on_thread_exit) || ( val.is_a?(Integer) && val>0 )
65
65
  @timeout = val
66
66
  end
67
67
  end
@@ -85,7 +85,7 @@ module MCollective
85
85
  # guard thread reaping the pid on completion.
86
86
  @status = systemu(@command, opts) do |cid|
87
87
  begin
88
- if timeout.is_a?(Fixnum)
88
+ if timeout.is_a?(Integer)
89
89
  # wait for the specified timeout
90
90
  sleep timeout
91
91
  else
@@ -142,7 +142,7 @@ module MCollective
142
142
 
143
143
  # encrypts a string, returns a hash of key, iv and data
144
144
  def aes_encrypt(plain_string)
145
- cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)
145
+ cipher = OpenSSL::Cipher.new(ssl_cipher)
146
146
  cipher.encrypt
147
147
 
148
148
  key = cipher.random_key
@@ -156,7 +156,7 @@ module MCollective
156
156
 
157
157
  # decrypts a string given key, iv and data
158
158
  def aes_decrypt(key, crypt_string)
159
- cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)
159
+ cipher = OpenSSL::Cipher.new(ssl_cipher)
160
160
 
161
161
  cipher.decrypt
162
162
  cipher.key = key
@@ -10,7 +10,7 @@ module MCollective
10
10
  when Class
11
11
  validator.is_a?(validation_type)
12
12
  when :integer
13
- validator.is_a?(Fixnum)
13
+ validator.is_a?(Integer)
14
14
  when :float
15
15
  validator.is_a?(Float)
16
16
  when :number
@@ -49,7 +49,7 @@ module MCollective
49
49
  describe "#string_to_number" do
50
50
  it "should turn valid strings into numbers" do
51
51
  ["1", "0", "9999"].each do |i|
52
- DDL.string_to_number(i).class.should == Fixnum
52
+ expect(DDL.string_to_number(i)).to be_a(Integer)
53
53
  end
54
54
 
55
55
  ["1.1", "0.0", "9999.99"].each do |i|
@@ -168,9 +168,11 @@ module MCollective
168
168
  data = @ssl.base64_decode("FkH6qLvKTn7a+uNPe8ciHA==")
169
169
 
170
170
  # the default aes-256-cbc should fail here, the key above is 128 bit
171
- # the exception classes changed mid-1.9.2 :(
171
+ # the exception classes changed mid-1.9.2 and again later in 2.4 :(
172
172
  if OpenSSL.constants.include?("CipherError")
173
173
  expect { @ssl.aes_decrypt(key, data) }.to raise_error(OpenSSL::CipherError)
174
+ elsif RUBY_VERSION =~ /^2\.4/
175
+ expect { @ssl.aes_decrypt(key, data) }.to raise_error(ArgumentError)
174
176
  else
175
177
  expect { @ssl.aes_decrypt(key, data) }.to raise_error(OpenSSL::Cipher::CipherError)
176
178
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcollective-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0
4
+ version: 2.11.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-06-27 00:00:00.000000000 Z
12
+ date: 2017-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: systemu