knife-solo_data_bag 2.0.0 → 2.1.0

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: cf49bac07e42c95338783f5538307c3041fb42c3
4
- data.tar.gz: 93ad9e80f4d7b1f42a59a7f130a04beb022cc8dd
3
+ metadata.gz: 3870c3b498f4efbc193907f8c1a42bfa223bea9c
4
+ data.tar.gz: 39daf037a5840c12ac93c2858ef374cc6e2f1fc2
5
5
  SHA512:
6
- metadata.gz: 58029e99bc35b17c56d4b9d5e323f4a33108aaff0d39b085e9b6cc024402950bb8e27cfeccd476ebd6c2af9fa8278327999646d987a368604a4aba59aa40a997
7
- data.tar.gz: 2c1f8b1273fb493d825b986ac5e658f2b18fc7eebe3310ce8f5070099aa7fab71b9e1174e66b0bfdf4e0dd44b85ea0c98a0548168f52ee45b372706c873f86d8
6
+ metadata.gz: 7b4dfd5afb7692e1378aa18b3657aed91405d6085ea5b8e43cde826fe7bacd247eb6eb42810b851bc25be2cee9f6d262fe23318aca18fc8684e564679ed0160e
7
+ data.tar.gz: 1826ad39e5277833fa90006db7ab8f119540b7241b1b6cd5939cfe4facfbd3ee7386e83c1eb84017e8286232f98527132d7181f5282fbe26052b33a870534f56
data/README.md CHANGED
@@ -1,9 +1,25 @@
1
1
  # Knife Solo Data Bag
2
+
2
3
  A knife plugin to make working with data bags easier in a chef solo environment.
3
4
 
4
5
  If you are looking for a full featured chef solo management solution, you may
5
6
  want to check out [knife solo](https://github.com/matschaffer/knife-solo).
6
7
 
8
+ ## Alternatives
9
+
10
+ ### `knife data bag`
11
+
12
+ The standard `chef` gem includes the knife command and
13
+ [commands to manipulate data bags][knife-data-bag-docs].
14
+
15
+ `knife-solo_data_bag` has the following advantages over the `knife data bag`
16
+ command:
17
+
18
+ * allows recovery from errors when creating/editing JSON files,
19
+ * allows import and export of the the contents in JSON format.
20
+
21
+ [knife-data-bag-docs]: https://docs.chef.io/knife_data_bag.html "Knife data bag docs"
22
+
7
23
  ## Deprecation Notices
8
24
 
9
25
  * Versions >= 2 only support Ruby versions 2.2 and above.
@@ -12,15 +28,31 @@ want to check out [knife solo](https://github.com/matschaffer/knife-solo).
12
28
  If you need support for an earlier version of chef, use a knife solo data bag version < 1.0.0.
13
29
 
14
30
  ## Build Status
31
+
15
32
  ![Build Status](https://secure.travis-ci.org/thbishop/knife-solo_data_bag.png)
16
33
 
17
34
  ## Installation
35
+ ```sh
36
+ gem install knife-solo_data_bag
18
37
 
19
- gem install knife-solo_data_bag
20
-
38
+ # or if using ChefDK
39
+ chef gem install knife-solo_data_bag
40
+ ```
21
41
  ## Usage
22
42
 
43
+ ### Setup
44
+
45
+ With Chef >= 12.x, you need to indicate that you're running in local mode,
46
+ otherwise Chef will try to connect to a server.
47
+
48
+ In `.chef/knife.rb`, add:
49
+
50
+ ```ruby
51
+ local_mode true
52
+ ```
53
+
23
54
  ### Create
55
+
24
56
  Create a plain text data bag
25
57
 
26
58
  $ knife solo data bag create apps app_1
@@ -42,6 +74,7 @@ Create a data bag item from a json file
42
74
  $ knife solo data bag create apps app_1 --json-file foo.json
43
75
 
44
76
  ### Edit
77
+
45
78
  Edit a plain text data bag
46
79
 
47
80
  $ knife solo data bag edit apps app_1
@@ -55,11 +88,13 @@ Edit an encrypted data bag with the provided file content as the secret
55
88
  $ knife solo data bag edit apps app_1 --secret-file 'SECRET_FILE'
56
89
 
57
90
  ### List
58
- List all of the data bag
91
+
92
+ List data bags
59
93
 
60
94
  $ knife solo data bag list
61
95
 
62
96
  ### Show
97
+
63
98
  Show the plain text content of a data bag (if this is an encrypted data bag, it will return the encrypted data)
64
99
 
65
100
  $ knife solo data bag show apps app_1
@@ -76,19 +111,31 @@ You can also display any of the above variations in JSON format with `-F json`
76
111
 
77
112
  $ knife solo data bag show apps app_1 -s secret_key -F json
78
113
 
114
+ ### Using Data Bags in Recipes
115
+
116
+ You can load your data bags inside you recipes as follows:
117
+
118
+ ```ruby
119
+ app_1 = Chef::EncryptedDataBagItem.load("apps", "app_1").to_hash
120
+ ```
121
+
79
122
  ## Notes
123
+
80
124
  ### Data Bag Path
125
+
81
126
  By default, this plugin will use the configured data_bag_path. This is
82
127
  defaulted to `/var/chef/data_bags` by Chef. It is possible to override this
83
128
  path in your Chef client config if desired. When using this plugin, it is also
84
129
  possible to override the path using the `--data-bag-path` argument.
85
130
 
86
131
  ### Encrypted Data Bag Secret
132
+
87
133
  This plugin respects the "encrypted_data_bag_secret" configuration option in
88
134
  knife.rb. Command line secret arguments (-s or --secret-file) will override the
89
135
  setting in knife.rb.
90
136
 
91
137
  ## Version Support
138
+
92
139
  This plugin has been tested on the following:
93
140
 
94
141
  Chef:
@@ -104,11 +151,23 @@ OS:
104
151
  * OSX
105
152
  * Linux
106
153
 
154
+ # Development
155
+
156
+ Running tests requires an indication of the Gemfile to use:
157
+
158
+ ```shell
159
+ export BUNDLE_GEMFILE=$PWD/gemfiles/Gemfile.chef.11.18.12
160
+ bundle
161
+ bundle exec rspec
162
+ ```
163
+
107
164
  ## Contribute
165
+
108
166
  * Fork the project
109
167
  * Make your feature addition or bug fix (with tests and docs) in a topic branch
110
168
  * Bonus points for not mucking with the gemspec or version
111
169
  * Send a pull request
112
170
 
113
171
  ## License
172
+
114
173
  See LICENSE for details
@@ -29,6 +29,7 @@ class Chef
29
29
 
30
30
  def run
31
31
  Chef::Config[:solo] = true
32
+ Chef::Config[:solo_legacy_mode] = true if Gem.loaded_specs['chef'].version > Gem::Version.new('12.11.0')
32
33
  @bag_name, @item_name = @name_args
33
34
  ensure_valid_arguments
34
35
  edit_content
@@ -28,6 +28,7 @@ class Chef
28
28
 
29
29
  def run
30
30
  Chef::Config[:solo] = true
31
+ Chef::Config[:solo_legacy_mode] = true if Gem.loaded_specs['chef'].version > Gem::Version.new('12.11.0')
31
32
  @bag_name, @item_name = @name_args
32
33
  ensure_valid_arguments
33
34
  display_content
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module SoloDataBag
3
- VERSION = '2.0.0'
3
+ VERSION = '2.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-solo_data_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Bishop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-10 00:00:00.000000000 Z
11
+ date: 2017-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.5.1
113
+ rubygems_version: 2.5.2
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: A knife plugin for working with data bags and chef solo