knife-solo_data_bag 1.0.0 → 1.0.1.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +2 -0
- data/lib/chef/knife/solo_data_bag_create.rb +0 -1
- data/lib/chef/knife/solo_data_bag_edit.rb +1 -5
- data/lib/chef/knife/solo_data_bag_list.rb +1 -4
- data/lib/chef/knife/solo_data_bag_show.rb +1 -4
- data/lib/knife-solo_data_bag/version.rb +1 -1
- metadata +5 -6
- data/lib/chef/knife/helpers.rb +0 -79
data/CHANGELOG.md
CHANGED
@@ -5,11 +5,7 @@ class Chef
|
|
5
5
|
|
6
6
|
class SoloDataBagEdit < Knife
|
7
7
|
|
8
|
-
|
9
|
-
require 'chef/knife/helpers'
|
10
|
-
require 'chef/knife/solo_data_bag_helpers'
|
11
|
-
end
|
12
|
-
|
8
|
+
require 'chef/knife/solo_data_bag_helpers'
|
13
9
|
include Chef::Knife::SoloDataBagHelpers
|
14
10
|
|
15
11
|
banner 'knife solo data bag edit BAG ITEM (options)'
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-solo_data_bag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1.beta.1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tommy Bishop
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -84,7 +84,6 @@ files:
|
|
84
84
|
- gemfiles/Gemfile.chef.11.8.0
|
85
85
|
- gemfiles/Gemfile.chef.11.8.2
|
86
86
|
- knife-solo_data_bag.gemspec
|
87
|
-
- lib/chef/knife/helpers.rb
|
88
87
|
- lib/chef/knife/solo_data_bag_create.rb
|
89
88
|
- lib/chef/knife/solo_data_bag_edit.rb
|
90
89
|
- lib/chef/knife/solo_data_bag_helpers.rb
|
@@ -119,9 +118,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
119
|
none: false
|
121
120
|
requirements:
|
122
|
-
- - ! '
|
121
|
+
- - ! '>'
|
123
122
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
123
|
+
version: 1.3.1
|
125
124
|
requirements: []
|
126
125
|
rubyforge_project:
|
127
126
|
rubygems_version: 1.8.23
|
data/lib/chef/knife/helpers.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
module KnifeSoloDataBag
|
2
|
-
module Helpers
|
3
|
-
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
def bag_item_path
|
7
|
-
File.expand_path File.join(bag_path, "#{item_name}.json")
|
8
|
-
end
|
9
|
-
|
10
|
-
def bag_path
|
11
|
-
File.expand_path File.join(bags_path, bag_name)
|
12
|
-
end
|
13
|
-
|
14
|
-
def bags_path
|
15
|
-
if config[:data_bag_path]
|
16
|
-
Chef::Config[:data_bag_path] = config[:data_bag_path]
|
17
|
-
end
|
18
|
-
|
19
|
-
Chef::Config[:data_bag_path]
|
20
|
-
end
|
21
|
-
|
22
|
-
def persist_bag_item(item)
|
23
|
-
File.open bag_item_path, 'w' do |f|
|
24
|
-
f.write JSON.pretty_generate(item.raw_data)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def secret_path
|
29
|
-
Chef::Config[:encrypted_data_bag_secret]
|
30
|
-
end
|
31
|
-
|
32
|
-
def secret_key
|
33
|
-
return config[:secret] if config[:secret]
|
34
|
-
Chef::EncryptedDataBagItem.load_secret(config[:secret_file] || secret_path)
|
35
|
-
end
|
36
|
-
|
37
|
-
def should_be_encrypted?
|
38
|
-
config[:secret] || config[:secret_file] || secret_path
|
39
|
-
end
|
40
|
-
|
41
|
-
def convert_json_string
|
42
|
-
JSON.parse config[:json_string]
|
43
|
-
end
|
44
|
-
|
45
|
-
def validate_bag_name_provided
|
46
|
-
unless bag_name
|
47
|
-
show_usage
|
48
|
-
ui.fatal 'You must supply a name for the data bag'
|
49
|
-
exit 1
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def validate_bags_path_exists
|
54
|
-
unless File.directory? bags_path
|
55
|
-
raise Chef::Exceptions::InvalidDataBagPath,
|
56
|
-
"Configured data bag path '#{bags_path}' is invalid"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def validate_json_string
|
61
|
-
begin
|
62
|
-
JSON.parse config[:json_string], :create_additions => false
|
63
|
-
rescue => error
|
64
|
-
raise "Syntax error in #{config[:json_string]}: #{error.message}"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def validate_multiple_secrets_were_not_provided
|
69
|
-
if config[:secret] && config[:secret_file]
|
70
|
-
show_usage
|
71
|
-
ui.fatal 'Please specify either --secret or --secret-file only'
|
72
|
-
exit 1
|
73
|
-
elsif (config[:secret] && secret_path) || (config[:secret_file] && secret_path)
|
74
|
-
ui.warn 'The encrypted_data_bag_secret option defined in knife.rb was overriden by the command line.'
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|