conjur-cli 2.1.8 → 2.1.9

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.
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'slosilo', git: 'https://github.com/inscitiv/slosilo.git', branch: 'master'
7
- gem 'conjur-api', '~> 2.2.2', git: 'https://github.com/inscitiv/api-ruby.git', branch: 'master'
7
+ gem 'conjur-api', '~> 2.2', git: 'https://github.com/inscitiv/api-ruby.git', branch: 'master'
8
8
  gem 'conjur-asset-cmi-study', git: 'https://inscitiv-ops-dev:Me5aswes@github.com/inscitiv/conjur-asset-cmi-study', branch: 'master'
9
9
  gem 'conjur-asset-environment', git: 'https://inscitiv-ops-dev:Me5aswes@github.com/inscitiv/conjur-asset-environment', branch: 'master'
10
10
  gem 'conjur-asset-deployment', git: 'https://inscitiv-ops-dev:Me5aswes@github.com/inscitiv/conjur-asset-deployment', branch: 'master'
@@ -1,5 +1,7 @@
1
1
  module Conjur
2
2
  class Command
3
+ @@api = nil
4
+
3
5
  class << self
4
6
  attr_accessor :prefix
5
7
 
@@ -16,7 +18,11 @@ module Conjur
16
18
  end
17
19
 
18
20
  def api
19
- Conjur::Authn.connect
21
+ @@api ||= Conjur::Authn.connect
22
+ end
23
+
24
+ def conjur_account
25
+ Conjur::Core::API.conjur_account
20
26
  end
21
27
 
22
28
  def acting_as_option(command)
@@ -0,0 +1,13 @@
1
+ require 'conjur/command'
2
+
3
+ class Conjur::Command::Id < Conjur::Command
4
+ self.prefix = :id
5
+
6
+ desc "Creates a new unique id"
7
+ command :create do |c|
8
+ c.action do |global_options,options,args|
9
+ var = api.create_variable("text/plain", "unique-id", {})
10
+ puts var.id
11
+ end
12
+ end
13
+ end
@@ -13,7 +13,7 @@ class Conjur::Command::Resources < Conjur::Command
13
13
  c.action do |global_options,options,args|
14
14
  kind = require_arg(args, "kind")
15
15
  id = require_arg(args, "resource-id")
16
- resource = api.resource([ Conjur.account, kind, id ].join(':'))
16
+ resource = api.resource([ conjur_account, kind, id ].join(':'))
17
17
  resource.create(options)
18
18
  end
19
19
  end
@@ -24,7 +24,7 @@ class Conjur::Command::Resources < Conjur::Command
24
24
  c.action do |global_options,options,args|
25
25
  kind = require_arg(args, "kind")
26
26
  id = require_arg(args, "resource-id")
27
- display api.resource([ Conjur.account, kind, id ].join(':')).attributes
27
+ display api.resource([ conjur_account, kind, id ].join(':')).attributes
28
28
  end
29
29
  end
30
30
 
@@ -34,7 +34,7 @@ class Conjur::Command::Resources < Conjur::Command
34
34
  c.action do |global_options,options,args|
35
35
  kind = require_arg(args, "kind")
36
36
  id = require_arg(args, "resource-id")
37
- resource = api.resource([ Conjur.account, kind, id ].join(':'))
37
+ resource = api.resource([ conjur_account, kind, id ].join(':'))
38
38
  puts resource.exists?
39
39
  end
40
40
  end
@@ -47,7 +47,7 @@ class Conjur::Command::Resources < Conjur::Command
47
47
  id = require_arg(args, "resource-id")
48
48
  role = require_arg(args, "role")
49
49
  privilege = require_arg(args, "privilege")
50
- api.resource([ Conjur.account, kind, id ].join(':')).permit privilege, role
50
+ api.resource([ conjur_account, kind, id ].join(':')).permit privilege, role
51
51
  end
52
52
  end
53
53
 
@@ -59,7 +59,7 @@ class Conjur::Command::Resources < Conjur::Command
59
59
  id = require_arg(args, "resource-id")
60
60
  role = require_arg(args, "role")
61
61
  privilege = require_arg(args, "privilege")
62
- api.resource([ Conjur.account, kind, id ].join(':')).deny privilege, role
62
+ api.resource([ conjur_account, kind, id ].join(':')).deny privilege, role
63
63
  end
64
64
  end
65
65
 
@@ -83,7 +83,7 @@ class Conjur::Command::Resources < Conjur::Command
83
83
  kind = require_arg(args, "kind")
84
84
  id = require_arg(args, "resource-id")
85
85
  owner = require_arg(args, "owner")
86
- api.resource([ Conjur.account, kind, id ].join(':')).give_to owner
86
+ api.resource([ conjur_account, kind, id ].join(':')).give_to owner
87
87
  end
88
88
  end
89
89
 
@@ -94,7 +94,7 @@ class Conjur::Command::Resources < Conjur::Command
94
94
  kind = require_arg(args, "kind")
95
95
  id = require_arg(args, "resource-id")
96
96
  permission = require_arg(args, "permission")
97
- display api.resource([ Conjur.account, kind, id ].join(':')).permitted_roles(permission)
97
+ display api.resource([ conjur_account, kind, id ].join(':')).permitted_roles(permission)
98
98
  end
99
99
  end
100
100
  end
@@ -35,12 +35,19 @@ class Conjur::Command::Roles < Conjur::Command
35
35
  end
36
36
  end
37
37
 
38
- desc "Lists all members of the role"
38
+ desc "Lists members of the role"
39
39
  arg_name "role"
40
40
  command :members do |c|
41
+ c.desc "List all members recursively"
42
+ c.switch :a
43
+
41
44
  c.action do |global_options,options,args|
42
45
  role = args.shift || api.user(api.username).roleid
43
- display api.role(role).members.map(&:member).map(&:roleid)
46
+ if options[:a]
47
+ display api.role(role).all.map(&:roleid)
48
+ else
49
+ display api.role(role).members.map(&:member).map(&:roleid)
50
+ end
44
51
  end
45
52
  end
46
53
 
@@ -1,3 +1,3 @@
1
1
  module Conjur
2
- VERSION = "2.1.8"
2
+ VERSION = "2.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-30 00:00:00.000000000 Z
13
+ date: 2013-06-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: conjur-api
@@ -152,6 +152,7 @@ files:
152
152
  - lib/conjur/command/field.rb
153
153
  - lib/conjur/command/groups.rb
154
154
  - lib/conjur/command/hosts.rb
155
+ - lib/conjur/command/ids.rb
155
156
  - lib/conjur/command/resources.rb
156
157
  - lib/conjur/command/roles.rb
157
158
  - lib/conjur/command/secrets.rb