conjur-api 4.11.0 → 4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/conjur-api.gemspec +0 -1
- data/lib/conjur-api/version.rb +3 -4
- data/lib/conjur/base.rb +4 -3
- data/lib/conjur/patches/rest-client.rb +32 -0
- data/reqspeed.rb +20 -0
- data/spec/vendor/rest_client_spec.rb +86 -0
- metadata +6 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c77dcb84929bf1b03154a61752fd524697df3e8a
|
4
|
+
data.tar.gz: 6f0b27e201fa2163c2b4a22ec9a049acdf35fca8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfb7d75912573aa7d9d5b5f4e7f99efe12c7e3fb00c5180cda222847452400867a70238d68523204a85aec1a1f3a244c742962d78c3bf70645b435911fd9f36a
|
7
|
+
data.tar.gz: a9fb06b58b10115e307d132c6ebc444bd681ffd67093be5c45c0126851f93d69464b357b1e5e376388343b9763b9af1a19a02b319e264e37f3a3eea175c99dbc
|
data/CHANGELOG.md
CHANGED
data/conjur-api.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |gem|
|
|
21
21
|
|
22
22
|
gem.add_dependency 'rest-client', '= 1.6.7' # with newer versions adding certificates to OpenSSL does not work
|
23
23
|
gem.add_dependency 'activesupport'
|
24
|
-
gem.add_dependency 'wrong'
|
25
24
|
|
26
25
|
gem.add_development_dependency 'rake'
|
27
26
|
gem.add_development_dependency 'spork'
|
data/lib/conjur-api/version.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2013 Conjur Inc
|
1
|
+
# Copyright (C) 2013-2014 Conjur Inc
|
3
2
|
#
|
4
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
4
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -17,9 +16,9 @@
|
|
17
16
|
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
17
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
18
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
-
|
19
|
+
|
21
20
|
module Conjur
|
22
21
|
class API
|
23
|
-
VERSION = "4.11.
|
22
|
+
VERSION = "4.11.1"
|
24
23
|
end
|
25
24
|
end
|
data/lib/conjur/base.rb
CHANGED
@@ -21,7 +21,8 @@
|
|
21
21
|
require 'rest-client'
|
22
22
|
require 'json'
|
23
23
|
require 'base64'
|
24
|
-
|
24
|
+
|
25
|
+
require 'conjur/patches/rest-client'
|
25
26
|
|
26
27
|
require 'conjur/exists'
|
27
28
|
require 'conjur/has_attributes'
|
@@ -39,7 +40,6 @@ module Conjur
|
|
39
40
|
include LogSource
|
40
41
|
include StandardMethods
|
41
42
|
include Cast
|
42
|
-
include Wrong
|
43
43
|
|
44
44
|
class << self
|
45
45
|
# Parse a role id into [ account, 'roles', kind, id ]
|
@@ -115,7 +115,8 @@ module Conjur
|
|
115
115
|
|
116
116
|
@token ||= Conjur::API.authenticate(@username, @api_key)
|
117
117
|
|
118
|
-
|
118
|
+
fail "obtained token is invalid" unless token_valid? # sanity check
|
119
|
+
|
119
120
|
return @token
|
120
121
|
end
|
121
122
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2014 Conjur Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
|
21
|
+
# RestClient monkey patches MIME::Types, breaking it in certain situations.
|
22
|
+
# Let's make check if it did and fix it if so.
|
23
|
+
# Cf. https://github.com/rest-client/rest-client/pull/346
|
24
|
+
|
25
|
+
if MIME::Types.respond_to? :type_for_extension
|
26
|
+
class MIME::Types
|
27
|
+
def self.type_for_extension ext
|
28
|
+
candidates = of ext
|
29
|
+
candidates.empty? ? ext : candidates[0].content_type
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/reqspeed.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# a hackish script to gauge the time it takes to load various components
|
3
|
+
|
4
|
+
$require_level = 0
|
5
|
+
alias :orig_require :require
|
6
|
+
def require(file)
|
7
|
+
rl = $require_level
|
8
|
+
r0 = Time.now
|
9
|
+
$require_level += 1
|
10
|
+
r = orig_require(file)
|
11
|
+
$require_level -=1
|
12
|
+
c = caller[0][/.*?:[^:]+/]
|
13
|
+
c = '' unless c =~ /conjur/
|
14
|
+
printf "%5.02f %s %s %s\n", Time.now - r0, '-' * rl, file, c + (r ? '' : ' (already required)')
|
15
|
+
r
|
16
|
+
end
|
17
|
+
|
18
|
+
#$:.prepend 'lib'
|
19
|
+
|
20
|
+
require ARGV.first
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Copyright (C) 2014 Conjur Inc
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
# this software and associated documentation files (the "Software"), to deal in
|
5
|
+
# the Software without restriction, including without limitation the rights to
|
6
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
# subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
|
+
|
20
|
+
require 'spec_helper'
|
21
|
+
require 'tempfile'
|
22
|
+
|
23
|
+
# RestClient monkey patches MIME::Types, breaking it in certain situations.
|
24
|
+
# Let's make sure we monkey patch the monkey patch if necessary.
|
25
|
+
|
26
|
+
describe RestClient::Request do
|
27
|
+
shared_examples :restclient do
|
28
|
+
it "can be initialized" do
|
29
|
+
expect { RestClient::Request.new method: 'GET', url: 'http://example.com' }.to_not raise_error
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def reinit_mime_types!
|
34
|
+
# pretend to initialize MIME::Types from scratch
|
35
|
+
MIME::Types.instance_variable_set :@__types__, nil
|
36
|
+
MIME::Types.send :remove_const, :VERSION # to suppress a warning
|
37
|
+
load 'mime/types.rb'
|
38
|
+
end
|
39
|
+
|
40
|
+
def with_env vals, &block
|
41
|
+
olds = Hash[vals.keys.zip ENV.values_at *vals.keys]
|
42
|
+
ENV.update vals
|
43
|
+
yield if block_given?
|
44
|
+
ENV.update olds
|
45
|
+
end
|
46
|
+
|
47
|
+
around do |ex|
|
48
|
+
with_env 'RUBY_MIME_TYPES_CACHE' => cache,
|
49
|
+
'RUBY_MIME_TYPES_LAZY_LOAD' => lazy.to_s do
|
50
|
+
reinit_mime_types!
|
51
|
+
ex.run
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "with plain MIME::Types config" do
|
56
|
+
let(:cache) { nil }
|
57
|
+
let(:lazy) { false }
|
58
|
+
include_examples :restclient
|
59
|
+
end
|
60
|
+
|
61
|
+
context "with lazy MIME::Types loading" do
|
62
|
+
let(:cache) { nil }
|
63
|
+
let(:lazy) { true }
|
64
|
+
include_examples :restclient
|
65
|
+
end
|
66
|
+
|
67
|
+
context "using MIME::Types cache" do
|
68
|
+
let(:cache) do
|
69
|
+
tf = Tempfile.new('mimecache')
|
70
|
+
path = tf.path
|
71
|
+
|
72
|
+
tf.unlink # delete so mimetypes doesn't try to read it
|
73
|
+
# create the cache
|
74
|
+
with_env 'RUBY_MIME_TYPES_CACHE' => path,
|
75
|
+
'RUBY_MIME_TYPES_LAZY_LOAD' => 'false' do
|
76
|
+
reinit_mime_types!
|
77
|
+
end
|
78
|
+
|
79
|
+
return path
|
80
|
+
end
|
81
|
+
|
82
|
+
after { File.unlink cache }
|
83
|
+
let(:lazy) { false }
|
84
|
+
include_examples :restclient
|
85
|
+
end
|
86
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conjur-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.11.
|
4
|
+
version: 4.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafal Rzepecki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -39,20 +39,6 @@ dependencies:
|
|
39
39
|
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: wrong
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - '>='
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :runtime
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - '>='
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
43
|
name: rake
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,6 +242,7 @@ files:
|
|
256
242
|
- lib/conjur/layer.rb
|
257
243
|
- lib/conjur/log.rb
|
258
244
|
- lib/conjur/log_source.rb
|
245
|
+
- lib/conjur/patches/rest-client.rb
|
259
246
|
- lib/conjur/path_based.rb
|
260
247
|
- lib/conjur/pubkeys-api.rb
|
261
248
|
- lib/conjur/resource.rb
|
@@ -265,6 +252,7 @@ files:
|
|
265
252
|
- lib/conjur/standard_methods.rb
|
266
253
|
- lib/conjur/user.rb
|
267
254
|
- lib/conjur/variable.rb
|
255
|
+
- reqspeed.rb
|
268
256
|
- spec/api/authn_spec.rb
|
269
257
|
- spec/api/groups_spec.rb
|
270
258
|
- spec/api/hosts_spec.rb
|
@@ -298,6 +286,7 @@ files:
|
|
298
286
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_path-like_identifier.yml
|
299
287
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_un-encoded_path-like_identifier.yml
|
300
288
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_uuid_identifier.yml
|
289
|
+
- spec/vendor/rest_client_spec.rb
|
301
290
|
homepage: https://github.com/conjurinc/api-ruby/
|
302
291
|
licenses:
|
303
292
|
- MIT
|
@@ -360,4 +349,5 @@ test_files:
|
|
360
349
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_path-like_identifier.yml
|
361
350
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_un-encoded_path-like_identifier.yml
|
362
351
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_uuid_identifier.yml
|
352
|
+
- spec/vendor/rest_client_spec.rb
|
363
353
|
has_rdoc:
|