chef-vault 1.0.0 → 1.0.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.
@@ -1,4 +1,4 @@
1
1
  class ChefVault
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  MAJOR, MINOR, TINY = VERSION.split('.')
4
4
  end
@@ -3,9 +3,10 @@ require 'chef/knife'
3
3
  class DecryptCert < Chef::Knife
4
4
  deps do
5
5
  require 'chef/search/query'
6
- require 'chef/shef/ext'
7
6
  require 'json'
7
+ require File.expand_path('../compat', __FILE__)
8
8
  end
9
+ include ChefVault::Compat
9
10
 
10
11
  banner "knife decrypt cert --name NAME"
11
12
 
@@ -19,7 +20,7 @@ class DecryptCert < Chef::Knife
19
20
  puts("You must supply a certificate to decrypt")
20
21
  exit 1
21
22
  end
22
- Shef::Extensions.extend_context_object(self)
23
+ extend_context_object(self)
23
24
 
24
25
  data_bag = "certs"
25
26
  data_bag_path = "./data_bags/#{data_bag}"
@@ -3,9 +3,10 @@ require 'chef/knife'
3
3
  class DecryptPassword < Chef::Knife
4
4
  deps do
5
5
  require 'chef/search/query'
6
- require 'chef/shef/ext'
7
6
  require 'json'
7
+ require File.expand_path('../compat', __FILE__)
8
8
  end
9
+ include ChefVault::Compat
9
10
 
10
11
  banner "knife decrypt password --username USERNAME"
11
12
 
@@ -19,7 +20,7 @@ class DecryptPassword < Chef::Knife
19
20
  puts("You must supply a username to decrypt")
20
21
  exit 1
21
22
  end
22
- Shef::Extensions.extend_context_object(self)
23
+ extend_context_object(self)
23
24
 
24
25
  data_bag_path = "./data_bags/passwords"
25
26
 
@@ -3,8 +3,9 @@ require 'chef/knife'
3
3
  class EncryptCert < Chef::Knife
4
4
  deps do
5
5
  require 'chef/search/query'
6
- require 'chef/shef/ext'
6
+ require File.expand_path('../compat', __FILE__)
7
7
  end
8
+ include ChefVault::Compat
8
9
 
9
10
  banner "knife encrypt cert --search SEARCH --cert CERT --password PASSWORD --name NAME --admins ADMINS"
10
11
 
@@ -46,7 +47,7 @@ class EncryptCert < Chef::Knife
46
47
  puts("You must supply either -A or --admins")
47
48
  exit 1
48
49
  end
49
- Shef::Extensions.extend_context_object(self)
50
+ extend_context_object(self)
50
51
 
51
52
  data_bag = "certs"
52
53
  data_bag_path = "./data_bags/#{data_bag}"
@@ -3,8 +3,9 @@ require 'chef/knife'
3
3
  class EncryptPassword < Chef::Knife
4
4
  deps do
5
5
  require 'chef/search/query'
6
- require 'chef/shef/ext'
6
+ require File.expand_path('../compat', __FILE__)
7
7
  end
8
+ include ChefVault::Compat
8
9
 
9
10
  banner "knife encrypt password --search SEARCH --username USERNAME --password PASSWORD --admins ADMINS"
10
11
 
@@ -45,7 +46,8 @@ class EncryptPassword < Chef::Knife
45
46
  puts("You must supply either -A or --admins")
46
47
  exit 1
47
48
  end
48
- Shef::Extensions.extend_context_object(self)
49
+
50
+ extend_context_object(self)
49
51
 
50
52
  data_bag = "passwords"
51
53
  data_bag_path = "./data_bags/#{data_bag}"
@@ -0,0 +1,16 @@
1
+ # Make a wraper to chef10/11 "shef/shell" changes
2
+
3
+ module ChefVault
4
+ module Compat
5
+ require 'chef/version'
6
+ def extend_context_object(obj)
7
+ if Chef::VERSION.to_i >= 11
8
+ require "chef/shell/ext"
9
+ Shell::Extensions.extend_context_object(obj)
10
+ else
11
+ require 'chef/shef/ext'
12
+ Shef::Extensions.extend_context_object(obj)
13
+ end
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-08 00:00:00.000000000 Z
12
+ date: 2013-04-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -45,6 +45,7 @@ files:
45
45
  - lib/chef/knife/DecryptPassword.rb
46
46
  - lib/chef/knife/EncryptCert.rb
47
47
  - lib/chef/knife/EncryptPassword.rb
48
+ - lib/chef/knife/compat.rb
48
49
  homepage:
49
50
  licenses: []
50
51
  post_install_message: