conjur-asset-dsl2 0.6.0 → 0.6.1

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: 57aa36f4305e541f313b8a833623d6100929ae50
4
- data.tar.gz: dcabd391389d702f971b3a12aee54afadf53c914
3
+ metadata.gz: 6a097eda9faf788b6594bc01a62527a3e5abbdd0
4
+ data.tar.gz: 5eeb8404b7aa9c0608c4696640075dc93e8169ea
5
5
  SHA512:
6
- metadata.gz: 62e2362f4202eaa0d48b0db4c597515531c592b63abcc8118bd88c1b8ce5ee9e4354e895ca1cf43dbea79e4a823d1d8c250c1fa5b724fca284a501fdbad695fb
7
- data.tar.gz: 08a1ec598a5d4f23e1bb27dd939f5eaddeff097bcf0d9aebaf1ca8fabf6949134827daaf656d5a27c3d384b07dc7f5bf6b9e6a579a65f264109744f0e9dddb70
6
+ metadata.gz: fd0f36d920a9483b9e5ec4652a3361f1a424260243c4bc01a14995eb0897227eaacb5953e12a8ff2b8b8da885fbd1bb7c2f366481e2f01feed30bb7f0ba85f4e
7
+ data.tar.gz: 2afea097e8e27bd16801a654f59eb02b5997b185e5e933503f04af98153ceae54010bc39a461b8dfd32b2cb2492b1a48c098b9f860f98942cd35172977dd9683
@@ -1,3 +1,9 @@
1
+ # 0.6.1
2
+
3
+ * Properly format the Host Factory layers as they are submitted to the server.
4
+ * Properly report role or resource missing errors.
5
+ * Host Factory role defaults to its owner.
6
+
1
7
  # 0.6.0
2
8
 
3
9
  * Implement the !deny statement.
@@ -1,7 +1,7 @@
1
1
  module Conjur
2
2
  module Asset
3
3
  module DSL2
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
6
6
  end
7
7
  end
@@ -66,7 +66,7 @@ module Conjur
66
66
 
67
67
  def create path, parameters
68
68
  request = Net::HTTP::Post.new [ @base_path, path ].join('/')
69
- request.set_form_data parameters
69
+ request.set_form_data to_params(parameters)
70
70
  send_request request
71
71
  end
72
72
 
@@ -74,7 +74,7 @@ module Conjur
74
74
 
75
75
  def update path, parameters
76
76
  request = Net::HTTP::Put.new [ @base_path, path ].join('/')
77
- request.set_form_data parameters
77
+ request.set_form_data to_params(parameters)
78
78
  send_request request
79
79
  end
80
80
 
@@ -82,7 +82,7 @@ module Conjur
82
82
 
83
83
  def delete path, parameters
84
84
  uri = URI.parse([ @base_path, path ].join('/'))
85
- uri.query = [uri.query, parameters.map{|k,v| [ k, URI.escape(v) ].join('=')}.join("&")].compact.join('&')
85
+ uri.query = [uri.query, parameters.to_query].compact.join('&')
86
86
  request = Net::HTTP::Delete.new [ uri.path, '?', uri.query ].join
87
87
 
88
88
  send_request request
@@ -113,6 +113,18 @@ module Conjur
113
113
  rescue JSON::ParserError
114
114
  # empty
115
115
  end
116
+
117
+ # Convert parameter keys to rails []-style keys
118
+ def to_params params
119
+ params.inject({}) do |memo,entry|
120
+ key, value = entry
121
+ if value.is_a?(Array)
122
+ key = "#{key}[]"
123
+ end
124
+ memo[key] = value
125
+ memo
126
+ end
127
+ end
116
128
  end
117
129
  end
118
130
  end
@@ -45,11 +45,11 @@ module Conjur
45
45
  end
46
46
 
47
47
  def validate_role_exists! role
48
- error("Role not found: #{role}") unless planner.role_exists?(role)
48
+ planner.error("Role not found: #{role}") unless planner.role_exists?(role)
49
49
  end
50
50
 
51
51
  def validate_resource_exists! resource
52
- error("Resource not found: #{resource}") unless planner.resource_exists?(resource)
52
+ planner.error("Resource not found: #{resource}") unless planner.resource_exists?(resource)
53
53
  end
54
54
 
55
55
  protected
@@ -195,6 +195,16 @@ module Conjur
195
195
 
196
196
  attribute :role, kind: :role, dsl_accessor: true, singular: true
197
197
  attribute :layer, kind: :layer, dsl_accessor: true
198
+
199
+ alias role_accessor role
200
+
201
+ def role *args
202
+ if args.empty?
203
+ role_accessor || self.owner
204
+ else
205
+ role_accessor(*args)
206
+ end
207
+ end
198
208
  end
199
209
 
200
210
  class ManagedRole < Base
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-asset-dsl2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml