conjur-api 4.21.0 → 4.22.0

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: d71200c2e70d47ac438ff0c37aefb9eb3336291a
4
- data.tar.gz: 81b7029927b6227918d9449e5e279280194a56a1
3
+ metadata.gz: 959c37a66821bda1666f469337a9a20e361a284f
4
+ data.tar.gz: 5e577965d78ad5de62857e0e111eefe7e5a22e4f
5
5
  SHA512:
6
- metadata.gz: 6f2dc2ffd7e4a1fe1b183e25c907dbb3e442e68e324993405913256ad2b1a6d44465485d30a686aa94db161ea302d0e15da84500c669b1824ad6623a04f7225b
7
- data.tar.gz: c991fdd8ff7d36c2dbc3d74e03f469d9d235ced8b30735b3454991aa9ea53c3f56140b0981022823f2c092c72b2ec1336140956f2745ec5237ee9de0ac996dee
6
+ metadata.gz: d4ff60ab26a55265fff5644641beb2823a540e7ce9fec41beaf34f77a97d58921479818ae5f6c40c6988eb8827578adef20c6988b6c09b1d1ea7e8e2268a2b74
7
+ data.tar.gz: ece7ea1af8e3e6be329fcb7a368610def126ed34fb386999357b3e10154cf59029b9407cd85fb5e7a73dec5ba39390bae2d927acbdd125b97a4b39f79ce961a8
@@ -1,3 +1,9 @@
1
+ # v4.22.0
2
+
3
+ * Add `show_expired` argument to `Conjur::Variable#value` to allow
4
+ retrieval of values of expired variables.
5
+ * Properly assign ownership of bootstrap-created webservice resources to the `security_admin` group.
6
+
1
7
  # v4.21.0
2
8
 
3
9
  * Add extensible Bootstrap commands as API methods.
@@ -9,6 +9,7 @@ Feature: conjur bootstrap
9
9
  Then expressions "$conjur.group('pubkeys-1.0/key-managers').exists?" and "true" are equal
10
10
  Then expressions "$conjur.resource('webservice:conjur/authn-tv').exists?" and "true" are equal
11
11
  Then expressions "$conjur.resource('webservice:conjur/policy-loader').exists?" and "true" are equal
12
+ Then expressions "$conjur.resource('webservice:conjur/policy-loader').ownerid" and "'cucumber:group:security_admin'" are equal
12
13
  Then expressions "$conjur.host('conjur/policy-loader').exists?" and "true" are equal
13
14
  Then expressions "$conjur.host('conjur/secrets-rotator').exists?" and "true" are equal
14
15
  Then expressions "$conjur.host('conjur/ldap-sync').exists?" and "true" are equal
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Conjur
21
21
  class API
22
- VERSION = "4.21.0"
22
+ VERSION = "4.22.0"
23
23
  end
24
24
  end
@@ -35,10 +35,15 @@ module Conjur
35
35
  def find_or_create_resource resource, owner = nil
36
36
  if resource.exists?
37
37
  echo "#{resource.resource_kind.capitalize} '#{resource.identifier}' already exists"
38
+ # v4.21.0 incorrectly assigned these resources to the admin user
39
+ if resource.ownerid == "#{Conjur.configuration.account}:user:admin"
40
+ echo "Giving '#{resource.identifier}' to the security_admin group"
41
+ resource.give_to 'group:security_admin'
42
+ end
38
43
  else
39
44
  echo "Creating #{resource.resource_kind} '#{resource.identifier}'"
40
45
  options = {}
41
- options[:ownerid] = owner.roleid if owner
46
+ options[:acting_as] = owner.roleid if owner
42
47
  api.create_resource resource.resourceid, options
43
48
  end
44
49
  end
@@ -198,11 +198,17 @@ module Conjur
198
198
  # var.value 0
199
199
  # var.value var.version_count
200
200
  #
201
+ # @example Get the value of an expired variable
202
+ # var.value nil, show_expired: true
203
+ #
201
204
  # @param [Integer] version the **1 based** version.
205
+ # @param options [Hash]
206
+ # @option options [Boolean, false] :show_expired show value even if variable has expired
202
207
  # @return [String] the value of the variable
203
- def value(version = nil)
208
+ def value(version = nil, options = {})
204
209
  url = 'value'
205
- url << "?version=#{version}" if version
210
+ options['version'] = version if version
211
+ url << '?' + options.to_query unless options.empty?
206
212
  self[url].get.body
207
213
  end
208
214
 
@@ -36,7 +36,7 @@ describe Conjur::Variable do
36
36
  expect(subject.value).to eq("the-value")
37
37
  end
38
38
 
39
- it "parametrizes the request with a version" do
39
+ it "parameterizes the request with a version" do
40
40
  allow_request(
41
41
  method: :get,
42
42
  url: "#{url}/value?version=42",
@@ -44,6 +44,27 @@ describe Conjur::Variable do
44
44
  ).and_return(double "response", body: "the-value")
45
45
  expect(subject.value(42)).to eq("the-value")
46
46
  end
47
+
48
+ it 'will show the latest expired version' do
49
+ allow_request(
50
+ :method => :get,
51
+ :url => "#{url}/value?show_expired=true",
52
+ :headers => {}
53
+ ).and_return(double('response', :body => 'the-value'))
54
+ expect(subject.value(nil, :show_expired => true)).to eq('the-value')
55
+ end
56
+
57
+ it 'will show some other version, even if expired' do
58
+ allow_request(
59
+ :method => :get,
60
+ # Hash.to_query (used to build the query string for this
61
+ # request) sorts the params into lexicographic order
62
+ :url => "#{url}/value?show_expired=true&version=42",
63
+ :headers => {}
64
+ ).and_return(double('response', :body => 'the-value'))
65
+ expect(subject.value(42, :show_expired => true)).to eq('the-value')
66
+ end
67
+
47
68
  end
48
69
 
49
70
  describe '#expire' do
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.21.0
4
+ version: 4.22.0
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: 2016-03-02 00:00:00.000000000 Z
12
+ date: 2016-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client