conjur-cli 4.28.0 → 4.28.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e6ae515f092a2c41963452c0a2fcc0aa8ec0f2c
4
- data.tar.gz: 0ecbfa2d23e3dcc763afa1be03e978b709c515c0
3
+ metadata.gz: 1fa1d02d354078c3b74ddc346be49d07e84681c6
4
+ data.tar.gz: 1e65f0dddc2fb55dcae4afcf0cce470a89671dda
5
5
  SHA512:
6
- metadata.gz: f587e417fdcb8a9f0832ce3682706e4363cf8a3b69c3e14eb965ffdff84f157c7578387dd9f5e8c860eb5fcd912d6e263ee28b71d6961c1015f45a64a70a4c0b
7
- data.tar.gz: 558101ef2d363276511d821b217563ffaec1595b0c1799a4f785e3eec7663aec40a95d5fec8f20fc8d12ca19e21a680c5a96ffae194c4849b1433ab53fc3d10d
6
+ metadata.gz: 9a30df7c0d8e0a9bd82002f9e00a43c96cb9adf054a417b4b2b1c190bede3e50799930f645cb0f34e75ac34bb1111ec4d02afdd8b0ab4088b77fcbe8bd7740dc
7
+ data.tar.gz: d9bea26c97e7d92700e0082df19f04e43a2e9d1353537c5d9bf3e9172ff0b1d4877b7512f033cc0b92d3772d0fde3e86fdd521d343aa92bf4db43f3452be5ab4
@@ -1,3 +1,6 @@
1
+ # 4.28.1
2
+ * Add `--collection` option for `conjur script execute`. Scripts are now portable across environments, like policies.
3
+
1
4
  # 4.28.0
2
5
  * Add `conjur policy retire` to allow retiring a policy.
3
6
  * Fix `--as-group` and `--as-role` options for `conjur policy load`. Either can now be used to specify ownership of the policy.
@@ -18,8 +18,27 @@
18
18
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
19
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  #
21
+ require 'conjur/command/dsl_command'
22
+
23
+ require 'etc'
24
+ require 'socket'
21
25
 
22
26
  class Conjur::Command::Script < Conjur::DSLCommand
27
+ class << self
28
+ def default_collection_user
29
+ # More accurate than Etc.getlogin
30
+ Etc.getpwuid(Process.uid).name
31
+ end
32
+
33
+ def default_collection_hostname
34
+ Socket.gethostname
35
+ end
36
+
37
+ def default_collection_name
38
+ [ default_collection_user, default_collection_hostname ].join('@')
39
+ end
40
+ end
41
+
23
42
  desc "Execute Conjur DSL scripts"
24
43
  command :script do |script|
25
44
  script.desc "Run a Conjur DSL script"
@@ -27,12 +46,24 @@ class Conjur::Command::Script < Conjur::DSLCommand
27
46
  script.command :execute do |c|
28
47
  acting_as_option(c)
29
48
 
49
+ c.desc "Script collection (target environment)"
50
+ c.arg_name "collection"
51
+ c.default_value default_collection_name
52
+ c.flag [:collection]
53
+
54
+
30
55
  c.desc "Load context from this config file, and save it when finished. The file permissions will be 0600 by default."
31
56
  c.arg_name "FILE"
32
57
  c.flag [:c, :context]
33
58
 
34
59
  c.action do |global_options,options,args|
35
- run_script args, options
60
+ collection = options[:collection] || default_collection_name
61
+
62
+ run_script args, options do |runner, &block|
63
+ runner.scope collection do
64
+ block.call
65
+ end
66
+ end
36
67
  end
37
68
  end
38
69
  end
@@ -19,6 +19,6 @@
19
19
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  #
21
21
  module Conjur
22
- VERSION = "4.28.0"
22
+ VERSION = "4.28.1"
23
23
  ::Version=VERSION
24
24
  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: 4.28.0
4
+ version: 4.28.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: 2015-10-20 00:00:00.000000000 Z
12
+ date: 2015-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport