pe_rbac 0.5.0 → 1.0.0

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: 56e58098a25e422d8137e4efadf5b370379528ae
4
- data.tar.gz: ae014b2b5aaab17146877eeac905852a8459d81e
3
+ metadata.gz: 503aa91d25ea3f71e9e459d699ba276b157ed71a
4
+ data.tar.gz: ad6d237d94f56cea3db6a25d899e724a442326f2
5
5
  SHA512:
6
- metadata.gz: e3f574eac122619ffb1d0ee39c4a041762af5c7b9ee14c625051658f5c06fdaa54f73b6f76205bb8c644931e26d46cf704d4ebc70b771fb3c1de9627fcaf2318
7
- data.tar.gz: b5c016384239f66d858660140d31d46f5d64b8aeab8d3225dbc419c0383314a9a6d5ee190b45593452504854b21050a506295f7c3d6d26da220e1e79b3a9cfc6
6
+ metadata.gz: cf191ff1d1b9cc99a622d6092cd740f4c96393a226e23e6cbeee44feafd6627746d185b3b69eedcbbb0e9673e316c3deaacc731fb5c088a00e196f1bdba0ba43
7
+ data.tar.gz: 8a20606fb82623317e05c1529da42d6cca1055ca515a94e768e3b6ea96c22ddf8e3355d92df91411608a4bd721c1b156d540a60bb75274cc0a3055bb7d9545d3
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /pkg/
9
9
  /spec/reports/
10
10
  /tmp/
11
+ /.idea
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/GeoffWilliams/pe_rbac.svg?branch=master)](https://travis-ci.org/GeoffWilliams/pe_rbac)
1
+ [![Build Status](https://travis-ci.org/declarativesystems/pe_rbac.svg?branch=master)](https://travis-ci.org/declarativesystems/pe_rbac)
2
2
  # PeRbac
3
3
 
4
4
  This gem lets you drive the Puppet Enterprise RBAC API from the command line or ruby. While you can of-course do the same thing using the [pltraining/rbac](https://forge.puppet.com/pltraining/rbac) forge module, this requires that you have:
@@ -16,11 +16,6 @@ Since this is often not the case, this gem provides a command line to do things
16
16
 
17
17
  ## Installation
18
18
 
19
- Gem dependencies need G++ amongst other things. Easiest way to proceed:
20
- ```
21
- yum groupinstall 'Development Tools'
22
- ```
23
-
24
19
  Add this line to your application's Gemfile:
25
20
 
26
21
  ```ruby
@@ -80,10 +75,4 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
80
75
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
81
76
 
82
77
  ## Contributing
83
-
84
- Bug reports and pull requests are welcome on GitHub at https://github.com/GeoffWilliams/pe_rbac.
85
-
86
-
87
- ## License
88
-
89
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
78
+ Bug reports and pull requests are welcome on GitHub at https://github.com/declarativesystems/pe_rbac.
@@ -1,5 +1,6 @@
1
1
  #
2
- # Copyright 2016 Geoff Williams for Puppet Inc.
2
+ # Copyright 2017 Declarative Systems PTY LTD
3
+ # Copyright 2016 Puppet Inc.
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
data/lib/pe_rbac/core.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #
2
- # Copyright 2016 Geoff Williams for Puppet Inc.
2
+ # Copyright 2017 Declarative Systems PTY LTD
3
+ # Copyright 2016 Puppet Inc.
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
@@ -14,6 +15,8 @@
14
15
  # limitations under the License.
15
16
 
16
17
  require 'escort'
18
+ require 'excon'
19
+
17
20
  module PeRbac
18
21
  module Core
19
22
  @@ssldir = '/etc/puppetlabs/puppet/ssl'
@@ -74,23 +77,24 @@ module PeRbac
74
77
  _payload=nil
75
78
  end
76
79
  begin
77
- result = RestClient::Request.execute(
78
- method: method,
79
- url: url,
80
- ssl_ca_file: conf[:cacert],
81
- ssl_client_cert: OpenSSL::X509::Certificate.new(File.read(conf[:cert])),
82
- ssl_client_key: OpenSSL::PKey::RSA.new(File.read(conf[:key])),
83
- ssl_version: :TLSv1_2,
84
- headers: {:content_type => :json, :accept => :json},
85
- payload: _payload,
86
- )
87
- rescue RestClient::ExceptionWithResponse => e
88
- Escort::Logger.error.error url
89
- Escort::Logger.error.error _payload
90
- Escort::Logger.error.error e.response
80
+ connection = Excon.new(url,
81
+ client_cert: conf[:cert],
82
+ client_key: conf[:key],
83
+ ssl_ca_file: conf[:cacert],
84
+ ssl_version: :TLSv1_2)
85
+ result = connection.request(method: method,
86
+ headers: {content_type: "application/json", accept: "application/json"},
87
+ body: _payload)
88
+ if result.status >= 300
89
+ # There doesn't seem to be a built-in way to check for error codes
90
+ # without individually specifying each allowable 'good' status (:expect..)
91
+ # so lets just check for anything that smells bad
92
+ result = false
93
+ end
94
+ rescue Excon::Error => e
95
+ Escort::Logger.error.error "Error (#{e.message}) for: #{url}, #{_payload}"
91
96
  result = false
92
97
  end
93
-
94
98
  result
95
99
  end
96
100
 
@@ -1,5 +1,6 @@
1
1
  #
2
- # Copyright 2016 Geoff Williams for Puppet Inc.
2
+ # Copyright 2017 Declarative Systems PTY LTD
3
+ # Copyright 2016 Puppet Inc.
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
data/lib/pe_rbac/role.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #
2
- # Copyright 2016 Geoff Williams for Puppet Inc.
2
+ # Copyright 2017 Declarative Systems PTY LTD
3
+ # Copyright 2016 Puppet Inc.
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
data/lib/pe_rbac/user.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #
2
- # Copyright 2016 Geoff Williams for Puppet Inc.
2
+ # Copyright 2017 Declarative Systems PTY LTD
3
+ # Copyright 2016 Puppet Inc.
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
@@ -12,7 +13,7 @@
12
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
14
  # See the License for the specific language governing permissions and
14
15
  # limitations under the License.
15
-
16
+ require 'json'
16
17
  require 'pe_rbac/core'
17
18
  require 'pe_rbac/action'
18
19
 
@@ -1,5 +1,6 @@
1
1
  #
2
- # Copyright 2016 Geoff Williams for Puppet Inc.
2
+ # Copyright 2017 Declarative Systems PTY LTD
3
+ # Copyright 2016 Puppet Inc.
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
@@ -14,5 +15,5 @@
14
15
  # limitations under the License.
15
16
 
16
17
  module PeRbac
17
- VERSION = "0.5.0"
18
+ VERSION = "1.0.0"
18
19
  end
data/lib/pe_rbac.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #
2
- # Copyright 2016 Geoff Williams for Puppet Inc.
2
+ # Copyright 2017 Declarative Systems PTY LTD
3
+ # Copyright 2016 Puppet Inc.
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
@@ -13,11 +14,6 @@
13
14
  # See the License for the specific language governing permissions and
14
15
  # limitations under the License.
15
16
 
16
- require "pe_rbac/version"
17
- require 'restclient'
18
- require 'socket'
19
- require 'json'
20
-
21
17
  module PeRbac
22
18
  BASE_URI = '/rbac-api/v1'
23
19
 
data/pe_rbac.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q{Ruby API for Puppet Enterprise RBAC}
13
13
  spec.description = %q{Programatically do stuff with Puppet Enterprise RBAC}
14
14
  spec.homepage = "https://github.com/geoffwilliams/pe_rbac"
15
- spec.license = "Apache 2.0"
15
+ spec.license = "Apache-2.0"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.bindir = "exe"
@@ -32,8 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "facter", "2.4.6"
33
33
 
34
34
 
35
- spec.add_runtime_dependency "rest-client", "2.0.0"
35
+ spec.add_runtime_dependency "excon", "0.59.0"
36
36
  spec.add_runtime_dependency "escort", "0.4.0"
37
- spec.add_runtime_dependency "json", "2.0.3"
38
-
37
+ spec.add_runtime_dependency "json_pure", "2.1.0"
39
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pe_rbac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-25 00:00:00.000000000 Z
11
+ date: 2017-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,19 +137,19 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: 2.4.6
139
139
  - !ruby/object:Gem::Dependency
140
- name: rest-client
140
+ name: excon
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 2.0.0
145
+ version: 0.59.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 2.0.0
152
+ version: 0.59.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: escort
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -165,19 +165,19 @@ dependencies:
165
165
  - !ruby/object:Gem::Version
166
166
  version: 0.4.0
167
167
  - !ruby/object:Gem::Dependency
168
- name: json
168
+ name: json_pure
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 2.0.3
173
+ version: 2.1.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 2.0.3
180
+ version: 2.1.0
181
181
  description: Programatically do stuff with Puppet Enterprise RBAC
182
182
  email:
183
183
  - geoff@geoffwilliams.me.uk
@@ -207,7 +207,7 @@ files:
207
207
  - pe_rbac.gemspec
208
208
  homepage: https://github.com/geoffwilliams/pe_rbac
209
209
  licenses:
210
- - Apache 2.0
210
+ - Apache-2.0
211
211
  metadata: {}
212
212
  post_install_message:
213
213
  rdoc_options: []