moped 1.5.2 → 1.5.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc688693985dc94ceb168180d2c840e606d72102
4
- data.tar.gz: 7c076cf97ec2653b64928ded1f305bf22fdbba17
3
+ metadata.gz: 76d85fae38ea0ef7558bf6961c620082e3792f8c
4
+ data.tar.gz: c166d20629d965e0db7dfba2a91b758eaba55083
5
5
  SHA512:
6
- metadata.gz: 451fe5b6686da5a8090be3b36417ad24e59aea46ed7e8654eb944b4adbdf0be163486e77e8038b8a85fa9894dbf49b8921bb3f253b385f7502c80e3bf2ab1e89
7
- data.tar.gz: a05c67bd14d1979984977e0fd28a677120b9e4c2ef65c1accb4f5d0d27b9c36932d86a7b4a366c1c5e41da0d1da888a651c39b4f2c012f6bde61f38ab6904695
6
+ metadata.gz: 7027124e3caefcc77952ae0f8af98690f877b67ae759a175fdd79b65c4e4b063106a15b3fdda1163ab3e506e4778e22833eae70abed95b7e88286ee4abee6508
7
+ data.tar.gz: 0a0eb20add7205c06e78be13f82861dc999a37376bf7f7de3d68f10853152c11853a217b25b43f7bbeb9247dfef6d292014feb416c8481691a3d7b6fcb4d96f1
@@ -244,7 +244,7 @@ module Moped
244
244
  #
245
245
  # @since 1.0.0
246
246
  def legal?(string)
247
- /\A\h{24}\Z/ === string.to_s
247
+ string.to_s =~ /\A\h{24}\z/ ? true : false
248
248
  end
249
249
 
250
250
  # Create a new object id from some raw data.
@@ -253,6 +253,9 @@ module Moped
253
253
  warning(" MOPED: Connection failed to secondary node #{node.inspect}, trying next node.")
254
254
  # That node's no good, so let's try the next one.
255
255
  next
256
+ rescue Errors::ReplicaSetReconfigured
257
+ # That node's no good, so let's try the next one.
258
+ next
256
259
  end
257
260
  end
258
261
 
@@ -103,7 +103,7 @@ module Moped
103
103
  NOT_MASTER = [ 13435, 13436, 10009]
104
104
 
105
105
  # Error codes received around reconfiguration
106
- CONNECTION_ERRORS_RECONFIGURATION = [ 15988, 10276, 11600, 9001 ]
106
+ CONNECTION_ERRORS_RECONFIGURATION = [ 15988, 10276, 11600, 9001, 13639, 10009, 11002 ]
107
107
 
108
108
  # Replica set reconfigurations can be either in the form of an operation
109
109
  # error with code 13435, or with an error message stating the server is
@@ -502,7 +502,18 @@ module Moped
502
502
  authenticate = Protocol::Commands::Authenticate.new(database, username, password, result["nonce"])
503
503
  connection.write [authenticate]
504
504
  result = connection.read.documents.first
505
- raise Errors::AuthenticationFailure.new(authenticate, result) unless result["ok"] == 1
505
+
506
+ unless result["ok"] == 1
507
+ # See if we had connectivity issues so we can retry
508
+ e = Errors::PotentialReconfiguration.new(authenticate, result)
509
+ if e.reconfiguring_replica_set?
510
+ raise Errors::ReplicaSetReconfigured.new(e.command, e.details)
511
+ elsif e.connection_failure?
512
+ raise Errors::ConnectionFailure.new(e.inspect)
513
+ end
514
+
515
+ raise Errors::AuthenticationFailure.new(authenticate, result)
516
+ end
506
517
  auth[database] = [username, password]
507
518
  end
508
519
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Moped
3
- VERSION = "1.5.2"
3
+ VERSION = "1.5.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moped
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernerd Schaefer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-28 00:00:00.000000000 Z
11
+ date: 2015-06-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A MongoDB driver for Ruby.
14
14
  email:
@@ -83,17 +83,17 @@ require_paths:
83
83
  - lib
84
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.2.1
96
+ rubygems_version: 2.2.2
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: A MongoDB driver for Ruby.