knife-spork 1.7.2 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +35 -35
- data/lib/chef/knife/spork-bump.rb +100 -100
- data/lib/chef/knife/spork-check.rb +165 -161
- data/lib/chef/knife/spork-databag-create.rb +54 -54
- data/lib/chef/knife/spork-databag-delete.rb +51 -51
- data/lib/chef/knife/spork-databag-edit.rb +54 -54
- data/lib/chef/knife/spork-databag-fromfile.rb +88 -88
- data/lib/chef/knife/spork-delete.rb +132 -132
- data/lib/chef/knife/spork-environment-check.rb +90 -90
- data/lib/chef/knife/spork-environment-create.rb +63 -63
- data/lib/chef/knife/spork-environment-delete.rb +38 -38
- data/lib/chef/knife/spork-environment-edit.rb +40 -40
- data/lib/chef/knife/spork-environment-fromfile.rb +46 -46
- data/lib/chef/knife/spork-info.rb +34 -34
- data/lib/chef/knife/spork-node-create.rb +41 -41
- data/lib/chef/knife/spork-node-delete.rb +41 -41
- data/lib/chef/knife/spork-node-edit.rb +48 -48
- data/lib/chef/knife/spork-node-fromfile.rb +46 -46
- data/lib/chef/knife/spork-node-runlistadd.rb +51 -51
- data/lib/chef/knife/spork-node-runlistremove.rb +44 -44
- data/lib/chef/knife/spork-node-runlistset.rb +44 -44
- data/lib/chef/knife/spork-omni.rb +112 -112
- data/lib/chef/knife/spork-promote.rb +197 -197
- data/lib/chef/knife/spork-role-create.rb +46 -46
- data/lib/chef/knife/spork-role-delete.rb +50 -50
- data/lib/chef/knife/spork-role-edit.rb +40 -40
- data/lib/chef/knife/spork-role-fromfile.rb +65 -65
- data/lib/chef/knife/spork-upload.rb +151 -151
- data/lib/chef/knife/spork-version.rb +12 -12
- data/lib/knife-spork.rb +3 -3
- data/lib/knife-spork/plugins.rb +27 -27
- data/lib/knife-spork/plugins/campfire.rb +219 -219
- data/lib/knife-spork/plugins/eventinator.rb +329 -329
- data/lib/knife-spork/plugins/foodcritic.rb +46 -46
- data/lib/knife-spork/plugins/git.rb +393 -399
- data/lib/knife-spork/plugins/graphite.rb +25 -25
- data/lib/knife-spork/plugins/grove.rb +167 -167
- data/lib/knife-spork/plugins/hipchat.rb +171 -171
- data/lib/knife-spork/plugins/influxdb.rb +28 -28
- data/lib/knife-spork/plugins/irccat.rb +332 -332
- data/lib/knife-spork/plugins/jabber.rb +133 -133
- data/lib/knife-spork/plugins/plugin.rb +117 -117
- data/lib/knife-spork/plugins/rubocop.rb +56 -56
- data/lib/knife-spork/plugins/slack.rb +125 -125
- data/lib/knife-spork/plugins/statusnet.rb +122 -122
- data/lib/knife-spork/runner.rb +342 -342
- data/lib/knife-spork/version.rb +5 -5
- metadata +4 -51
- data/.gitignore +0 -21
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -3
- data/CHANGELOG.md +0 -445
- data/Gemfile +0 -3
- data/README.md +0 -544
- data/Rakefile +0 -35
- data/knife-spork.gemspec +0 -28
- data/plugins/Campfire.md +0 -43
- data/plugins/Eventinator.md +0 -30
- data/plugins/Foodcritic.md +0 -53
- data/plugins/Git.md +0 -53
- data/plugins/Graphite.md +0 -30
- data/plugins/Grove.md +0 -31
- data/plugins/HipChat.md +0 -69
- data/plugins/Influxdb.md +0 -25
- data/plugins/Irccat.md +0 -50
- data/plugins/Jabber.md +0 -61
- data/plugins/README.md +0 -70
- data/plugins/Rubocop.md +0 -110
- data/plugins/Slack.md +0 -48
- data/plugins/StatusNet.md +0 -41
- data/plugins/Template.md +0 -34
- data/spec/spec_helper.rb +0 -10
- data/spec/test_helpers.rb +0 -46
- data/spec/unit/fixtures/config/spork-config.yml +0 -1
- data/spec/unit/fixtures/cookbooks/example/metadata.rb +0 -8
- data/spec/unit/fixtures/environments/example.json +0 -12
- data/spec/unit/fixtures/knife.rb +0 -6
- data/spec/unit/fixtures/test_client.pem +0 -27
- data/spec/unit/spork_bump_spec.rb +0 -75
- data/spec/unit/spork_info_spec.rb +0 -40
- data/spec/unit/spork_promote_spec.rb +0 -77
- data/spec/unit/spork_upload_spec.rb +0 -46
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,544 +0,0 @@
|
|
1
|
-
KnifeSpork
|
2
|
-
===========
|
3
|
-
KnifeSpork is a workflow plugin for `Chef::Knife` which helps multiple developers work on the same Chef Server and repository without treading on each other's toes. This plugin was designed around the workflow we have here at Etsy, where several people are working on the Chef repository and Chef Server simultaneously. It contains several functions, documented below:
|
4
|
-
|
5
|
-
[![Build Status](https://travis-ci.org/jonlives/knife-spork.svg)](https://travis-ci.org/jonlives/knife-spork)
|
6
|
-
[![Gem Version](https://badge.fury.io/rb/knife-spork.png)](http://badge.fury.io/rb/knife-spork)
|
7
|
-
|
8
|
-
Installation
|
9
|
-
------------
|
10
|
-
|
11
|
-
### Gem Install
|
12
|
-
`knife-spork` is available on rubygems. Add the following to your `Gemfile`:
|
13
|
-
|
14
|
-
```ruby
|
15
|
-
gem 'knife-spork'
|
16
|
-
```
|
17
|
-
|
18
|
-
or install the gem manually:
|
19
|
-
|
20
|
-
```bash
|
21
|
-
gem install knife-spork
|
22
|
-
```
|
23
|
-
|
24
|
-
knife-spork is also included in the [Chef Devlopment Kit](https://downloads.chef.io/chef-dk/).
|
25
|
-
|
26
|
-
**Please note**: As of version 1.6.0, knife-spork requires Ruby 2.1.1 or greater and Chef version 11.0.0 or greater. If you're still using < Ruby 2.0 or Chef 11, please continue to use knife-spork 1.5.x
|
27
|
-
Spork Configuration
|
28
|
-
-------------------
|
29
|
-
Out of the box, knife spork will work with no configuration. However, you can optionally enable several features to enhance its functionality.
|
30
|
-
|
31
|
-
KnifeSpork will look for a configuration file in the following locations, in ascending order of precedence:
|
32
|
-
|
33
|
-
- `config/spork-config.yml`
|
34
|
-
- `/etc/spork-config.yml`
|
35
|
-
- `~/.chef/spork-config.yml`
|
36
|
-
- `.chef/spork-config.yml`
|
37
|
-
|
38
|
-
Anything set in the configuration file in your home directory for example, will override options set in your Chef repository or `/etc`.
|
39
|
-
|
40
|
-
Below is a sample config file with all supported options and all shipped plugins enabled below, followed by an explanation of each section.
|
41
|
-
|
42
|
-
```yaml
|
43
|
-
default_environments:
|
44
|
-
- development
|
45
|
-
- production
|
46
|
-
environment_groups:
|
47
|
-
qa_group:
|
48
|
-
- quality_assurance
|
49
|
-
- staging
|
50
|
-
test_group:
|
51
|
-
- user_testing
|
52
|
-
- acceptance_testing
|
53
|
-
version_change_threshold: 2
|
54
|
-
preserve_constraint_operators: true
|
55
|
-
environment_path: "/home/me/environments"
|
56
|
-
save_environment_locally_on_create: false
|
57
|
-
role_path: "/home/me/roles"
|
58
|
-
custom_plugin_path: "/home/me/spork-plugins"
|
59
|
-
always_promote_remote: true
|
60
|
-
skip_berkshelf: false
|
61
|
-
role_match_file_name: true
|
62
|
-
role_safe_delete: true
|
63
|
-
stdout_diffs
|
64
|
-
json_options:
|
65
|
-
indent: " "
|
66
|
-
plugins:
|
67
|
-
campfire:
|
68
|
-
account: myaccount
|
69
|
-
token: a1b2c3d4...
|
70
|
-
foodcritic:
|
71
|
-
tags: ['any']
|
72
|
-
hipchat:
|
73
|
-
api_token: ABC123
|
74
|
-
rooms:
|
75
|
-
- General
|
76
|
-
- Web Operations
|
77
|
-
notify: true
|
78
|
-
color: yellow
|
79
|
-
jabber:
|
80
|
-
username: YOURUSER
|
81
|
-
password: YOURPASSWORD
|
82
|
-
nickname: Chef Bot
|
83
|
-
server_name: your.jabberserver.com
|
84
|
-
server_port: 5222
|
85
|
-
rooms:
|
86
|
-
- engineering@your.conference.com/spork
|
87
|
-
- systems@your.conference.com/spork
|
88
|
-
git:
|
89
|
-
enabled: true
|
90
|
-
auto_push: true
|
91
|
-
branch: some_branch
|
92
|
-
irccat:
|
93
|
-
server: irccat.mydomain.com
|
94
|
-
port: 12345
|
95
|
-
gist: "/usr/bin/gist"
|
96
|
-
channel: ["chef-annoucements"]
|
97
|
-
graphite:
|
98
|
-
server: graphite.mydomain.com
|
99
|
-
port: 2003
|
100
|
-
influxdb:
|
101
|
-
database: deployments
|
102
|
-
username: deploy
|
103
|
-
password: deploy
|
104
|
-
series: deployments
|
105
|
-
host: influx.example.com
|
106
|
-
port: 8086
|
107
|
-
eventinator:
|
108
|
-
url: http://eventinator.mydomain.com/events/oneshot
|
109
|
-
slack:
|
110
|
-
webhook_url: https://hooks.slack.com/services/ABCD/efgh
|
111
|
-
channel: "#sysops"
|
112
|
-
username: knife
|
113
|
-
icon_url: http://example.com/image.jpg
|
114
|
-
rubocop:
|
115
|
-
epic_fail: true
|
116
|
-
show_name: false
|
117
|
-
autocorrect: false
|
118
|
-
out_file: <file>
|
119
|
-
sev_level: <C|W|E>
|
120
|
-
lint: false
|
121
|
-
use_cookstyle: true
|
122
|
-
```
|
123
|
-
|
124
|
-
#### Default Environments
|
125
|
-
The `default_environments` directive allows you to specify a default list of environments you want to promote changes to. If this option is configured and you *omit* the environment parameter when promoting KnifeSpork will promote to all environments in this list.
|
126
|
-
|
127
|
-
#### Environment Groups
|
128
|
-
The `environment_groups` directive allows you to specify a list of environments referenced by group names that you want to promote changes to.
|
129
|
-
|
130
|
-
#### Version Change Threshold
|
131
|
-
The `version_change_threshold` directive allows you to customise the threshold used by a safety check in spork promote which will prompt for confirmation if you're promoting a cookbook by more than version_change_threshold versions. This defaults to 2 if not set, ie promoting a cookbook from v1.0.1 to v 1.0.2 will not trip this check, wheras promoting from v1.0.1 to v1.0.3 will.
|
132
|
-
|
133
|
-
#### Preserve Constraint Operators
|
134
|
-
The `preserve_constraint_operators` directive causes spork promote to preserve existing version constraint operators in your environment files, only updating the version number. This directive is disabled by default, which causes spork to always use the `=` constraint.
|
135
|
-
|
136
|
-
#### Always Promote Remote
|
137
|
-
The `always_promote_remote` directive allows you to tell spork promote to always act as if the --remote option had been specified. This will also have the same effect on spork omni. This option should only be used if you're sure you want all changes to be uploaded to the server as soon as you run promote.
|
138
|
-
|
139
|
-
#### Skip Berkshelf
|
140
|
-
The `skip_berkshelf` directive is a temporary flag added in [#138](https://github.com/jonlives/knife-spork/issues/138) to allow Berkshelf functionality to be optionally bypassed until Berkshelf 3 support has been added to knife-spork per [#85](https://github.com/jonlives/knife-spork/issues/85). It simply removed the :Berkshelf constant from the namespace used by knife-spork.
|
141
|
-
|
142
|
-
#### JSON Options
|
143
|
-
The `json_options` directive allows you to tell spork to pass options to [pretty_generate](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/JSON.html#method-i-pretty_generate) to control the format of the resulting json
|
144
|
-
|
145
|
-
#### Environment Path
|
146
|
-
The `environment_path` directive allows you to specify the path to where you store your chef environment json files. If this parameter is not specified, spork will default to using the first element of your cookbook_path, replacing the word "cookbooks" with "environments"
|
147
|
-
|
148
|
-
#### Save Environment on Create
|
149
|
-
The `save_environment_on_create` directive allows you to have the ```knife spork environment create``` command save a copy of the new environment to your Chef repository. This will default to saving environment files in the location specified by the ```environment_path``` directive. If this parameter is not specified, spork will default to using the first element of your cookbook_path, replacing the word "cookbooks" with "environments"
|
150
|
-
|
151
|
-
|
152
|
-
#### Role Path
|
153
|
-
The `role_path` allows you to specify the path to where you store your chef role json files. If this parameter is not specified, spork will default to using the first element of your cookbook_path, replacing the word "cookbooks" with "roles"
|
154
|
-
|
155
|
-
#### Role Safe Delete
|
156
|
-
The `role_safe_delete` flag will, when you use the spork ```knife spork role delete``` command, check to see if any nodes currently have that role in their runlist and exit with an error message if any are found.
|
157
|
-
|
158
|
-
#### Role Match File Name
|
159
|
-
The `role_match_file_name` flag allows you to check whether the file name that is used to upload a role matches the role name as well. If the parameter is specified, or flag `--match-filename` is set, spork will not let you upload a role from a file unless the name matches the rolename.
|
160
|
-
|
161
|
-
#### Stdout Diffs
|
162
|
-
The `stdout_diffs` flag will cause any diffs generated by knife-spork (for example on events such as data bag uploads, role edits etc) to be displayed on stdout in addition to any notifications generated by plugins.
|
163
|
-
|
164
|
-
|
165
|
-
#### Custom Plugin Path
|
166
|
-
The `custom_plugin_path` allows you to specify an additional directory from which to load knife-spork plugins. If this parameter is not specified or the path set does not exist, only the default plugins shipped with knife-spork will be loaded (if enabled in config)
|
167
|
-
|
168
|
-
|
169
|
-
#### Plugins
|
170
|
-
Knife spork supports plugins to allow users to hook it into existing systems such as source control, monitoring and chat systems. Plugins are enabled / disabled by adding / removing their config block from the plugin section of the config file. Any of the default plugins shown above can be disabled by removing their section.
|
171
|
-
|
172
|
-
For more information on how to develop plugins for spork, please read the [plugins/README.md](plugins/README.md) file.
|
173
|
-
|
174
|
-
Spork Info
|
175
|
-
-----------
|
176
|
-
This function is designed to help you see which plugins you currently have loaded, and the current config Hash which knife spork is using.
|
177
|
-
|
178
|
-
#### Usage
|
179
|
-
```bash
|
180
|
-
knife spork info
|
181
|
-
```
|
182
|
-
|
183
|
-
#### Example
|
184
|
-
|
185
|
-
```text
|
186
|
-
$ knife spork info
|
187
|
-
Config Hash:
|
188
|
-
{"plugins"=>{"git"=>{"enabled"=>true}, "irccat"=>{"server"=>"irccat.mydomain.com", "port"=>12345, "gist"=>"usr/bin/gist", "channel"=>["#chef-announce"]}, "graphite"=>{"server"=>"graphite.mydomain.com", "port"=>2003}, "slack"=>{"api_token"=>"abc123", "channel"=>"random", "teamname"=>"myteam", "icon_url"=>"http://example.com/image.jpg"}, "eventinator"=>{"url"=>"http://eventinator.mydomain.com/events/oneshot"}}, "default_environments"=>["development", "production"], "version_change_threshold"=>2, "pplugins"=>{"foodcritic"=>{"fail_tags"=>["style,correctness,test"], "tags"=>["~portability"], "include_rules"=>["config/rules.rb"]}}}
|
189
|
-
|
190
|
-
Plugins:
|
191
|
-
KnifeSpork::Plugins::Campfire: disabled
|
192
|
-
KnifeSpork::Plugins::Eventinator: enabled
|
193
|
-
KnifeSpork::Plugins::Foodcritic: disabled
|
194
|
-
KnifeSpork::Plugins::Git: enabled
|
195
|
-
KnifeSpork::Plugins::Graphite: enabled
|
196
|
-
KnifeSpork::Plugins::HipChat: disabled
|
197
|
-
KnifeSpork::Plugins::Slack: enabled
|
198
|
-
KnifeSpork::Plugins::Irccat: enabled
|
199
|
-
```
|
200
|
-
|
201
|
-
Spork Check
|
202
|
-
-----------
|
203
|
-
This function is designed to help you avoid trampling on other people's cookbook versions, and to make sure that when you come to version your own work it's easy to see what version numbers have already been used and if the one you're using will overwrite anything.
|
204
|
-
|
205
|
-
#### Usage
|
206
|
-
```bash
|
207
|
-
knife spork check COOKBOOK [--all]
|
208
|
-
```
|
209
|
-
|
210
|
-
By default, spork check only shows the 5 most recent remote cookbook versions. Add the --all option if you want to see everything.
|
211
|
-
|
212
|
-
#### Example (Checking an Unfrozen Cookbook with version clash)
|
213
|
-
|
214
|
-
```text
|
215
|
-
$ knife spork check apache2
|
216
|
-
Checking versions for cookbook apache2...
|
217
|
-
|
218
|
-
Local Version:
|
219
|
-
1.1.49
|
220
|
-
|
221
|
-
Remote Versions: (* indicates frozen)
|
222
|
-
*2.0.2
|
223
|
-
*2.0.1
|
224
|
-
1.1.49
|
225
|
-
*1.1.14
|
226
|
-
*1.1.13
|
227
|
-
|
228
|
-
ERROR: The version 1.1.49 exists on the server and is not frozen. Uploading will overwrite!
|
229
|
-
```
|
230
|
-
|
231
|
-
#### Example (Checking a Frozen Cookbook with version clash)
|
232
|
-
|
233
|
-
```text
|
234
|
-
$ knife spork check apache2
|
235
|
-
Checking versions for cookbook apache2...
|
236
|
-
|
237
|
-
Local Version:
|
238
|
-
2.0.2
|
239
|
-
|
240
|
-
Remote Versions: (* indicates frozen)
|
241
|
-
*2.0.2
|
242
|
-
*2.0.1
|
243
|
-
1.1.49
|
244
|
-
*1.1.14
|
245
|
-
*1.1.13
|
246
|
-
|
247
|
-
WARNING: Your local version (2.0.2) is frozen on the remote server. You'll need to bump before you can upload.
|
248
|
-
````
|
249
|
-
|
250
|
-
#### Example (No version clashes)
|
251
|
-
|
252
|
-
```text
|
253
|
-
$ knife spork check apache2
|
254
|
-
Checking versions for cookbook apache2...
|
255
|
-
|
256
|
-
Local Version:
|
257
|
-
2.0.3
|
258
|
-
|
259
|
-
Remote Versions: (* indicates frozen)
|
260
|
-
*2.0.2
|
261
|
-
*2.0.1
|
262
|
-
1.1.49
|
263
|
-
*1.1.14
|
264
|
-
*1.1.13
|
265
|
-
|
266
|
-
Everything looks good!
|
267
|
-
```
|
268
|
-
|
269
|
-
Spork Bump
|
270
|
-
----------
|
271
|
-
This function lets you easily version your cookbooks without having to manually edit the cookbook's `metadata.rb` file. You can either specify the version level you'd like to bump (`major`, `minor`, or `patch`), or you can manually specify a version number. This might be used if, for example, you want to jump several version numbers in one go and don't want to have to run knife bump once for each number. If no bump level is specified, a patch level bump will be performed.
|
272
|
-
|
273
|
-
#### Usage
|
274
|
-
```bash
|
275
|
-
knife spork bump COOKBOOK [major | minor | patch | manual x.x.x]
|
276
|
-
````
|
277
|
-
|
278
|
-
#### Example (No patch level specified - defaulting to patch)
|
279
|
-
```text
|
280
|
-
$ knife spork bump apache2
|
281
|
-
Successfully bumped apache2 to v2.0.4!
|
282
|
-
```
|
283
|
-
|
284
|
-
#### Example (Bumping patch level)
|
285
|
-
```text
|
286
|
-
$ knife spork bump apache2 patch
|
287
|
-
Successfully bumped apache2 to v2.0.4!
|
288
|
-
```
|
289
|
-
|
290
|
-
#### Example (Manually setting version)
|
291
|
-
```text
|
292
|
-
$ knife spork bump apache2 manual 1.0.13
|
293
|
-
Successfully bumped apache2 to v1.0.13!
|
294
|
-
```
|
295
|
-
|
296
|
-
Spork Upload
|
297
|
-
------------
|
298
|
-
This function works mostly the same as normal `knife cookbook upload COOKBOOK` except that this automatically freezes cookbooks when you upload them.
|
299
|
-
|
300
|
-
#### Usage
|
301
|
-
```bash
|
302
|
-
knife spork upload COOKBOOK
|
303
|
-
```
|
304
|
-
#### Example
|
305
|
-
```text
|
306
|
-
$ knife spork upload apache2
|
307
|
-
Freezing apache2 at 1.0.13...
|
308
|
-
Successfully uploaded apache2@1.0.13!
|
309
|
-
```
|
310
|
-
|
311
|
-
Spork Promote
|
312
|
-
-------------
|
313
|
-
This function lets you easily set a version constraint in an environment or group of environments for a particular cookbook. By default it will set the version constraint to whatever the local version of the specified cookbook is. Optionally, you can include a `--version` option which will set the version constraint for the specified cookbook to whatever version number you provide. You might want to use this if, for example, you pushed a version constraint for a cookbook version you don't want your nodes to use anymore, so you want to "roll back" the environment to a previous version. You can also specify the `--remote` option if you'd like to automatically upload your changed local environment file to the server. To promote to multiple environments, simply pass a list of them delimited with a comma.
|
314
|
-
|
315
|
-
If you don't specify an environment or environment group, the default_environments config directive will be used if set.
|
316
|
-
|
317
|
-
#### Usage
|
318
|
-
|
319
|
-
```bash
|
320
|
-
knife spork promote [ENVIRONMENT OR ENVIRONMENT GROUP NAME] COOKBOOK [--version, --remote]
|
321
|
-
```
|
322
|
-
|
323
|
-
#### Example (Using local cookbook version number)
|
324
|
-
|
325
|
-
```text
|
326
|
-
$ knife spork promote my_environment apache2 --remote
|
327
|
-
Adding version constraint apache2 = 1.0.13
|
328
|
-
Saving changes to my_environment.json
|
329
|
-
Uploading my_environment to Chef Server
|
330
|
-
Promotion complete!
|
331
|
-
```
|
332
|
-
|
333
|
-
#### Example (Using manual version)
|
334
|
-
```text
|
335
|
-
$ knife spork promote my_environment apache2 -v 2.0.2
|
336
|
-
Adding version constraint apache2 = 2.0.2
|
337
|
-
Saving changes to my_environment.json
|
338
|
-
Promotion complete. Don't forget to upload your changed my_environment to Chef Server
|
339
|
-
```
|
340
|
-
|
341
|
-
Spork Delete
|
342
|
-
------------
|
343
|
-
This function works mostly the same as normal `knife cookbook delete COOKBOOK` including options to delete all versions and delete without interactive confirmation.
|
344
|
-
|
345
|
-
#### Usage
|
346
|
-
```bash
|
347
|
-
knife spork delete COOKBOOK
|
348
|
-
```
|
349
|
-
#### Example
|
350
|
-
```text
|
351
|
-
$ knife spork delete apache2 -a
|
352
|
-
WARNING: Deleting cookbook apache2...
|
353
|
-
Do you really want to delete all versions of apache2? (Y/N) Y
|
354
|
-
Deleted cookbook[apache2][2.0.2]
|
355
|
-
Successfully deleted cookbook apache2 ALL versions from the Chef server
|
356
|
-
Cookbooks deleted from Chef server: apache2: ALL versions
|
357
|
-
```
|
358
|
-
|
359
|
-
Spork Omni
|
360
|
-
-------------
|
361
|
-
Omni lets you combine one of the most common combinations of spork commands (bump, upload & promote or promote --remote) - into one handy shortcut.
|
362
|
-
|
363
|
-
As omni is designed for use only in those cases where you want to perform all three of bump, upload and promote at the same time it supports a limited subset of the command line options supported by the individual bump, upload and promote commands.
|
364
|
-
|
365
|
-
If you run omni with no extra options, it will default to performing a ```patch``` level bump, and promote locally to the environments listed in the ```default_environments``` variable in your spork configuration file.
|
366
|
-
|
367
|
-
Alternatively, you can specify any of the following options:
|
368
|
-
|
369
|
-
```--cookbook-path PATH:PATH```: A colon-separated path to look for cookbooks in
|
370
|
-
|
371
|
-
```--include-dependencies```: Also upload cookbook dependencies during the upload step
|
372
|
-
|
373
|
-
```--bump-level [major|minor|patch]```: Version level to bump the cookbook (defaults to patch)
|
374
|
-
|
375
|
-
```--environment ENVIRONMENT```: Environment to promote the cookbook to',
|
376
|
-
|
377
|
-
```--remote```: Make omni perform a promote --remote instead of a local promote',
|
378
|
-
|
379
|
-
#### Usage
|
380
|
-
|
381
|
-
```bash
|
382
|
-
knife spork omni COOKBOOK [--bump-level, --cookbook-path, --include-dependencies, --environment, --remote]
|
383
|
-
```
|
384
|
-
|
385
|
-
#### Example (default options, default_environments set to development and production)
|
386
|
-
|
387
|
-
```text
|
388
|
-
$ knife spork omni apache2
|
389
|
-
OMNI: Bumping apache2
|
390
|
-
Successfully bumped apache2 to v0.3.99!
|
391
|
-
|
392
|
-
OMNI: Uploading apache2
|
393
|
-
Freezing apache2 at 0.3.99...
|
394
|
-
Successfully uploaded apache2@0.3.99!
|
395
|
-
|
396
|
-
OMNI: Promoting apache2
|
397
|
-
Adding version constraint apache2 = 0.3.99
|
398
|
-
Saving changes to development.json
|
399
|
-
Promotion complete. Don't forget to upload your changed development.json to Chef Server
|
400
|
-
Adding version constraint apache2 = 0.3.99
|
401
|
-
Saving changes to production.json
|
402
|
-
Promotion complete. Don't forget to upload your changed production.json to Chef Server
|
403
|
-
```
|
404
|
-
|
405
|
-
#### Example (default options, default_environments set to development and production, promote --remote)
|
406
|
-
|
407
|
-
```text
|
408
|
-
$ knife spork omni apache2 --remote
|
409
|
-
OMNI: Bumping apache2
|
410
|
-
Successfully bumped apache2 to v0.3.99!
|
411
|
-
|
412
|
-
OMNI: Uploading apache2
|
413
|
-
Freezing apache2 at 0.3.99...
|
414
|
-
Successfully uploaded apache2@0.3.99!
|
415
|
-
|
416
|
-
OMNI: Promoting apache2
|
417
|
-
Adding version constraint apache2 = 0.3.99
|
418
|
-
Saving changes to development.json
|
419
|
-
Uploading development.json to Chef Server
|
420
|
-
Promotion complete at 2013-08-08 11:43:12 +0100!
|
421
|
-
Adding version constraint apache2 = 0.3.99
|
422
|
-
Saving changes to production.json
|
423
|
-
Uploading production.json to Chef Server
|
424
|
-
Promotion complete at 2013-08-08 11:43:12 +0100!
|
425
|
-
```
|
426
|
-
|
427
|
-
#### Example (Specifying patch level and environment)
|
428
|
-
```text
|
429
|
-
$ knife spork omni apache2 -l minor -e development
|
430
|
-
OMNI: Bumping apache2
|
431
|
-
Successfully bumped apache2 to v0.4.0!
|
432
|
-
|
433
|
-
OMNI: Uploading apache2
|
434
|
-
Freezing apache2 at 0.4.0...
|
435
|
-
Successfully uploaded apache2@0.4.0!
|
436
|
-
|
437
|
-
OMNI: Promoting apache2
|
438
|
-
Adding version constraint apache2 = 0.4.0
|
439
|
-
Saving changes to development.json
|
440
|
-
Promotion complete. Don't forget to upload your changed development.json to Chef Server
|
441
|
-
```
|
442
|
-
|
443
|
-
Spork Environment Check
|
444
|
-
-------------
|
445
|
-
Environment check provides the ability to validate a local chef environment file is locked to versions that actually exist on the chef server. Running this check prior to uploading your environment files is recommended as it can prevent your chef server from becoming unresponsive due to a version constraint that will never be valid.
|
446
|
-
|
447
|
-
If you run environment check with no options it will collect all invalid cookbook versions before reporting a failure.
|
448
|
-
|
449
|
-
Alternatively, you can specify any of the following options:
|
450
|
-
|
451
|
-
```-f, --fatal```: Quit on first invalid constraint located
|
452
|
-
|
453
|
-
#### Usage
|
454
|
-
|
455
|
-
```bash
|
456
|
-
knife spork environment check ENVIRONMENT (options)
|
457
|
-
```
|
458
|
-
|
459
|
-
#### Example of a passing chef environment check with no options
|
460
|
-
|
461
|
-
```text
|
462
|
-
$ knife spork environment check production
|
463
|
-
|
464
|
-
Checking constraints for environment: production
|
465
|
-
Environment production looks good
|
466
|
-
```
|
467
|
-
|
468
|
-
#### Example of multiple invalid cookbooks with no options
|
469
|
-
|
470
|
-
```text
|
471
|
-
$ knife spork environment check production
|
472
|
-
|
473
|
-
Checking constraints for environment: production
|
474
|
-
ERROR: mysql@10.2.0 does not exist on Chef Server! Upload the cookbook first by running:
|
475
|
-
|
476
|
-
knife spork upload mysql
|
477
|
-
|
478
|
-
ERROR: rbenv@10.7.1 does not exist on Chef Server! Upload the cookbook first by running:
|
479
|
-
|
480
|
-
knife spork upload rbenv
|
481
|
-
|
482
|
-
FATAL: Environment production has constraints that point to non existent cookbook versions.
|
483
|
-
```
|
484
|
-
|
485
|
-
#### Example of running with the --fatal flag with the same invalid cookbooks from previous example
|
486
|
-
|
487
|
-
```text
|
488
|
-
$ knife spork environment check production
|
489
|
-
|
490
|
-
Checking constraints for environment: production
|
491
|
-
FATAL: mysql@10.2.0 does not exist on Chef Server! Upload the cookbook first by running:
|
492
|
-
|
493
|
-
knife spork upload mysql
|
494
|
-
```
|
495
|
-
|
496
|
-
Spork Node / Role / Databag Commands
|
497
|
-
-------------
|
498
|
-
|
499
|
-
Knife spork contains "wrappers" around several stock knife commands for changing nodes, roles, environments and databags. These commands work exactly as in the original knife, with the addition of being wrapped in Spork's plugin API. This means that for example, when you upload a role using spork you will see an IRC message containing details, and a gist of the role change.
|
500
|
-
|
501
|
-
The following ```data bag``` commands are provided in knife-spork:
|
502
|
-
```
|
503
|
-
knife spork data bag create
|
504
|
-
knife spork data bag delete
|
505
|
-
knife spork data bag edit
|
506
|
-
knife spork data bag from file
|
507
|
-
```
|
508
|
-
|
509
|
-
The following ```node``` commands are provided in knife-spork:
|
510
|
-
```
|
511
|
-
knife spork node create
|
512
|
-
knife spork node delete
|
513
|
-
knife spork node edit
|
514
|
-
knife spork node from file
|
515
|
-
knife spork node run_list add
|
516
|
-
knife spork node run_list remove
|
517
|
-
knife spork node run_list set
|
518
|
-
```
|
519
|
-
|
520
|
-
The following ```role``` commands are provided in knife-spork:
|
521
|
-
```
|
522
|
-
knife spork role create
|
523
|
-
knife spork role delete
|
524
|
-
knife spork role edit
|
525
|
-
knife spork role from file
|
526
|
-
```
|
527
|
-
|
528
|
-
The following ```environment``` commands are provided in knife-spork:
|
529
|
-
```
|
530
|
-
knife spork environment create
|
531
|
-
knife spork environment delete
|
532
|
-
knife spork environment edit
|
533
|
-
knife spork environment from file
|
534
|
-
```
|
535
|
-
|
536
|
-
Troubleshooting
|
537
|
-
---------------
|
538
|
-
If you get an error when running `knife spork <command>` and the message shown when running with the `-VV` flag contains:
|
539
|
-
```ruby
|
540
|
-
undefined method `gsub' for #<Pathname:0x00000002d3a6b0> (NoMethodError)
|
541
|
-
```
|
542
|
-
...then you are probably using `Librarian::Chef.install_path()` in your `knife.rb` file.
|
543
|
-
|
544
|
-
To fix this you need to call `.to_s` on the install path, i.e. ``Librarian::Chef.install_path().to_s`.
|