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/plugins/Jabber.md
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
Jabber
|
2
|
-
=======
|
3
|
-
Jabber posts messages to a designated Jabber group chat room.
|
4
|
-
|
5
|
-
Gem Requirements
|
6
|
-
----------------
|
7
|
-
This plugin requires the following gems:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'xmpp4r'
|
11
|
-
```
|
12
|
-
|
13
|
-
Hooks
|
14
|
-
-----
|
15
|
-
- `after_upload`
|
16
|
-
- `after_promote`
|
17
|
-
|
18
|
-
Configuration
|
19
|
-
-------------
|
20
|
-
```yaml
|
21
|
-
plugins:
|
22
|
-
jabber:
|
23
|
-
username: YOURUSER
|
24
|
-
password: YOURPASSWORD
|
25
|
-
nickname: Chef Bot
|
26
|
-
server_name: your.jabberserver.com
|
27
|
-
server_port: 5222
|
28
|
-
rooms:
|
29
|
-
- engineering@your.conference.com/spork
|
30
|
-
- systems@your.conference.com/spork
|
31
|
-
```
|
32
|
-
|
33
|
-
#### username
|
34
|
-
Your Jabber username.
|
35
|
-
|
36
|
-
- Type: `String`
|
37
|
-
|
38
|
-
#### password
|
39
|
-
Your Jabber password.
|
40
|
-
|
41
|
-
- Type: `String`
|
42
|
-
|
43
|
-
#### nickname
|
44
|
-
A nickname to use in the conference room when making announcements.
|
45
|
-
|
46
|
-
- Type: `String`
|
47
|
-
|
48
|
-
#### server_name
|
49
|
-
Your Jabber server name.
|
50
|
-
|
51
|
-
- Type: `String`
|
52
|
-
|
53
|
-
#### server_port
|
54
|
-
Your Jabber server port number. Default: 5222
|
55
|
-
|
56
|
-
- Type: `String`
|
57
|
-
|
58
|
-
#### rooms
|
59
|
-
The list of rooms to post to.
|
60
|
-
|
61
|
-
- Type: `Array`
|
data/plugins/README.md
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
Plugins Directory
|
2
|
-
=================
|
3
|
-
This folder contains relevant documentation for each KnifeSpork plugin. For more information, usage, and options for an particular plugin, click on the assoicated markdown file in the tree above.
|
4
|
-
|
5
|
-
Creating a Plugin
|
6
|
-
-----------------
|
7
|
-
To create a plugin, start with the following basic boiler template:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
require 'knife-spork/plugins/plugin'
|
11
|
-
|
12
|
-
module KnifeSpork
|
13
|
-
module Plugins
|
14
|
-
class MyPlugin < Plugin
|
15
|
-
name :my_plugin
|
16
|
-
|
17
|
-
def perform
|
18
|
-
# your plugin code here
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
```
|
24
|
-
|
25
|
-
**Don't forget to update the class name and the `name` at the very top of the class!**
|
26
|
-
|
27
|
-
Helpers
|
28
|
-
-------
|
29
|
-
The following "helpers" or "methods" are exposed:
|
30
|
-
|
31
|
-
#### safe_require
|
32
|
-
This method allows you to safely require a gem. This is helpful when your plugin requires an external plugin. It will output a nice error message if the gem cannot be loaded and stop executing.
|
33
|
-
|
34
|
-
#### current_user
|
35
|
-
This method tries to get the current user's name in the following manner:
|
36
|
-
|
37
|
-
1. From the git configuration
|
38
|
-
2. From the `ENV`
|
39
|
-
|
40
|
-
#### config
|
41
|
-
This method returns the config associated with the current plugin. For example, if a `spork-config.yml` file looked like this:
|
42
|
-
|
43
|
-
```yaml
|
44
|
-
plugins:
|
45
|
-
my_plugin:
|
46
|
-
option_1: my_value
|
47
|
-
option_2: other_value
|
48
|
-
```
|
49
|
-
|
50
|
-
then
|
51
|
-
|
52
|
-
```text
|
53
|
-
config.option_1 #=> 'my_value'
|
54
|
-
config.option_2 #=> 'other_value'
|
55
|
-
```
|
56
|
-
|
57
|
-
This uses `app_conf`, so you access the keys are methods, not `[]`.
|
58
|
-
|
59
|
-
#### cookbooks
|
60
|
-
This returns an array of `Chef::CookbookVersion` objects corresponding to the cookbooks that are being changed/altered in the hook. For more information on the methods avaliable, see the [file in the Chef repo](https://github.com/opscode/chef/blob/master/chef/lib/chef/cookbook_version.rb).
|
61
|
-
|
62
|
-
#### environments
|
63
|
-
This returns an array of `Chef::Environment` objects corresponding to the environments that are being changed/altered in the hook. For more information on the methods avaliable, see the [file in the Chef repo](https://github.com/opscode/chef/blob/master/chef/lib/chef/environment.rb).
|
64
|
-
|
65
|
-
#### environment_diffs
|
66
|
-
This returns a Hash of Hash objects containing a diff between local and remote environment for each environment changed/altered in the hook. Currently, this will only be populated during the promotea action.
|
67
|
-
|
68
|
-
|
69
|
-
#### ui
|
70
|
-
This returns a `Chef::Knife::UI` element for outputting to the console. For more information on the methods avaliable, see the [file in the Chef repo](https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/core/ui.rb).
|
data/plugins/Rubocop.md
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
Rubocop
|
2
|
-
==========
|
3
|
-
Automatically runs rubocop (or [cookstyle](https://github.com/chef/cookstyle) - its chef-focused brother) against your cookbooks on check and upload.
|
4
|
-
This is entirely based off of the Foodcritic plugin.
|
5
|
-
|
6
|
-
Gem Requirements
|
7
|
-
----------------
|
8
|
-
This plugin requires the following gems:
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
gem 'rubocop'
|
12
|
-
gem 'cookstyle' # if you wish to use cookstyle behaviour
|
13
|
-
```
|
14
|
-
|
15
|
-
Hooks
|
16
|
-
-----
|
17
|
-
- `after_check`
|
18
|
-
- `before_upload`
|
19
|
-
|
20
|
-
Configuration
|
21
|
-
-------------
|
22
|
-
```yaml
|
23
|
-
plugins:
|
24
|
-
rubocop:
|
25
|
-
epic_fail: true
|
26
|
-
show_name: false
|
27
|
-
autocorrect: false
|
28
|
-
out_file: <file>
|
29
|
-
sev_level: <C|W|E>
|
30
|
-
lint: false
|
31
|
-
use_cookstyle: true
|
32
|
-
```
|
33
|
-
|
34
|
-
#### epic_fail:
|
35
|
-
If set to true, `epic_fail` will prevent you from uploading a cookbook or further checks from running until rubocop passes.
|
36
|
-
- Type: `Boolean`
|
37
|
-
- Default: `true`
|
38
|
-
|
39
|
-
#### The following options are passing command line options to rubocop. See rubocop --help for more details
|
40
|
-
#### show_name:
|
41
|
-
- Type: `Boolean`
|
42
|
-
- Default: `false`
|
43
|
-
- Rubocop command line equivilant: "-D"
|
44
|
-
Shows the name of the offending rule as well as the decription and line reference.
|
45
|
-
|
46
|
-
#### autocorrect:
|
47
|
-
- Type: `Boolean`
|
48
|
-
- Default: `false`
|
49
|
-
- Rubocop command line equivilant: "--auto-correct"
|
50
|
-
Automatically correct some offenses.
|
51
|
-
|
52
|
-
#### out_file:
|
53
|
-
- Type: `String` - file name
|
54
|
-
- Default: nil
|
55
|
-
- Rubocop command line equivilant: "--out <file>"
|
56
|
-
Redirects the rubocop output to a file instead of STDOUT.
|
57
|
-
|
58
|
-
#### sev_level:
|
59
|
-
- Type: `String`
|
60
|
-
- Default: nil
|
61
|
-
- Rubocop command line equivilant: "--fail-level [C|W|E]"
|
62
|
-
Set the severity level at which Rubocop will fail (see rubocop --help for more).
|
63
|
-
|
64
|
-
#### lint:
|
65
|
-
- Type: `Boolean`
|
66
|
-
- Default: `false`
|
67
|
-
- Rubocop command line equivilant: "--lint"
|
68
|
-
Only run linting rules.
|
69
|
-
|
70
|
-
#### use_cookstyle:
|
71
|
-
- Type: `Boolean`
|
72
|
-
- Default: `false`
|
73
|
-
- Rubocop command line equivilant: none, use `cookstyle` command instead of `rubocop` command
|
74
|
-
Cookstyle is a set of rubocop configurations that are specific to cookbooks.
|
75
|
-
|
76
|
-
#### Example
|
77
|
-
``` ruby
|
78
|
-
chef_workstation01$ knife spork check chef-client
|
79
|
-
Checking versions for cookbook chef-client...
|
80
|
-
|
81
|
-
Local Version:
|
82
|
-
3.3.3
|
83
|
-
|
84
|
-
Remote Versions: (* indicates frozen)
|
85
|
-
3.3.3
|
86
|
-
3.2.0
|
87
|
-
|
88
|
-
ERROR: The version 3.3.3 exists on the server and is not frozen. Uploading will overwrite!
|
89
|
-
Running rubocop against chef-client@3.3.3...
|
90
|
-
/home/chef-repo/cookbooks/chef-client
|
91
|
-
Inspecting 25 files
|
92
|
-
....CCCCC.CWCCCCCWCCCWCCC
|
93
|
-
|
94
|
-
Offenses:
|
95
|
-
|
96
|
-
chef-client/files/default/tests/minitest/config_test.rb:22:53: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
97
|
-
file(File.join(node['chef_client']['conf_dir'], "client.rb")).must_exist
|
98
|
-
^^^^^^^^^^^
|
99
|
-
chef-client/libraries/helpers.rb:35:72: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
100
|
-
Chef::Log.debug("Node has Chef Server Recipe? #{node.recipe?("chef-server")}")
|
101
|
-
^^^^^^^^^^^^^
|
102
|
-
chef-client/libraries/helpers.rb:36:70: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
103
|
-
Chef::Log.debug("Node has Chef Server Executable? #{system("which chef-server > /dev/null 2>&1")}")
|
104
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
105
|
-
chef-client/libraries/helpers.rb:37:74: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
106
|
-
Chef::Log.debug("Node has Chef Server Ctl Executable? #{system("which chef-server-ctl > /dev/null 2>&1")}")
|
107
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
108
|
-
...
|
109
|
-
|
110
|
-
```
|
data/plugins/Slack.md
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
Slack
|
2
|
-
=======
|
3
|
-
Slack posts messages to your Slack client.
|
4
|
-
|
5
|
-
Gem Requirements
|
6
|
-
----------------
|
7
|
-
This plugin requires the following gems:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'slack-notifier'
|
11
|
-
```
|
12
|
-
|
13
|
-
Hooks
|
14
|
-
-----
|
15
|
-
- `after_upload`
|
16
|
-
- `after_promote`
|
17
|
-
|
18
|
-
Configuration
|
19
|
-
-------------
|
20
|
-
```yaml
|
21
|
-
plugins:
|
22
|
-
slack:
|
23
|
-
webhook_url: https://hooks.slack.com/services/AABBCC
|
24
|
-
channel: "#operations"
|
25
|
-
teamname: myteam
|
26
|
-
username: knife
|
27
|
-
```
|
28
|
-
|
29
|
-
#### api_token
|
30
|
-
Your Slack Webhook URL.
|
31
|
-
|
32
|
-
- Type: `String`
|
33
|
-
|
34
|
-
#### channel
|
35
|
-
The channel to post to.
|
36
|
-
|
37
|
-
- Type: `String`
|
38
|
-
|
39
|
-
|
40
|
-
#### username
|
41
|
-
The username to post as.
|
42
|
-
|
43
|
-
- Type: `String`
|
44
|
-
|
45
|
-
#### icon_url
|
46
|
-
The url for icon. ex. https://example.com/image.jpg, default: nil
|
47
|
-
|
48
|
-
- Type: `String`
|
data/plugins/StatusNet.md
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
StatusNet
|
2
|
-
=======
|
3
|
-
StatusNet posts messages to a your StatusNet instance
|
4
|
-
|
5
|
-
Gem Requirements
|
6
|
-
----------------
|
7
|
-
This plugin requires the following gems:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'curb'
|
11
|
-
```
|
12
|
-
|
13
|
-
Hooks
|
14
|
-
-----
|
15
|
-
- `after_upload`
|
16
|
-
- `after_promote`
|
17
|
-
|
18
|
-
Configuration
|
19
|
-
-------------
|
20
|
-
```yaml
|
21
|
-
plugins:
|
22
|
-
statusnet:
|
23
|
-
url: YOUR INSTANCE API URL
|
24
|
-
username: YOURUSER
|
25
|
-
password: YOURPASSWORD
|
26
|
-
```
|
27
|
-
|
28
|
-
#### url
|
29
|
-
Your StatusNet instance API url, usually server url + /api/statuses/update.xml
|
30
|
-
|
31
|
-
- Type: `Srtring`
|
32
|
-
|
33
|
-
#### username
|
34
|
-
Your StatusNet username.
|
35
|
-
|
36
|
-
- Type: `String`
|
37
|
-
|
38
|
-
#### password
|
39
|
-
Your StatusNet password.
|
40
|
-
|
41
|
-
- Type: `String`
|
data/plugins/Template.md
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
Plugin Name
|
2
|
-
===========
|
3
|
-
Here is an optional, short description about your plugin.
|
4
|
-
|
5
|
-
Gem Requirements
|
6
|
-
----------------
|
7
|
-
This plugin requires the following gems:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'my_gem', '~> 1.4.5'
|
11
|
-
gem 'other_gem', '>= 5.0.1'
|
12
|
-
```
|
13
|
-
|
14
|
-
Hooks
|
15
|
-
-----
|
16
|
-
- `after_promote`
|
17
|
-
|
18
|
-
Configuration
|
19
|
-
-------------
|
20
|
-
```yaml
|
21
|
-
plugins:
|
22
|
-
plugin_name:
|
23
|
-
option_1: true
|
24
|
-
option_2:
|
25
|
-
- a
|
26
|
-
- b
|
27
|
-
- c
|
28
|
-
```
|
29
|
-
|
30
|
-
#### option_1
|
31
|
-
This is a description of the option.
|
32
|
-
|
33
|
-
- Type: `String`
|
34
|
-
- Default: `ABC`
|
data/spec/spec_helper.rb
DELETED
data/spec/test_helpers.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'tmpdir'
|
3
|
-
|
4
|
-
module TestHelpers
|
5
|
-
def tempdir
|
6
|
-
@tmpdir ||= Dir.mktmpdir("knife-spork")
|
7
|
-
File.realpath(@tmpdir)
|
8
|
-
end
|
9
|
-
|
10
|
-
def fixtures_path
|
11
|
-
File.expand_path(File.dirname(__FILE__) + "/unit/fixtures/")
|
12
|
-
end
|
13
|
-
|
14
|
-
def cookbook_path
|
15
|
-
File.expand_path('cookbooks', tempdir)
|
16
|
-
end
|
17
|
-
|
18
|
-
def environment_path
|
19
|
-
File.expand_path('environments', tempdir)
|
20
|
-
end
|
21
|
-
|
22
|
-
def stdout
|
23
|
-
stdout_io.string
|
24
|
-
end
|
25
|
-
|
26
|
-
def set_chef_config
|
27
|
-
knife.config[:chef_repo_path] = tempdir
|
28
|
-
knife.config[:cookbook_path] = File.join(tempdir, 'cookbooks')
|
29
|
-
knife.config[:environment_path] = File.join(tempdir, 'environments')
|
30
|
-
knife.config[:chef_server_url] = "http://localhost:4000"
|
31
|
-
knife.config[:client_key] = File.join(tempdir, 'test_client.pem')
|
32
|
-
knife.config[:client_name] = "test-client"
|
33
|
-
knife.config[:node_name] = "test-node"
|
34
|
-
knife.config[:cache_type] = 'BasicFile'
|
35
|
-
knife.config[:cache_options] = {:path => File.join(tempdir, 'checksums')}
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
def copy_test_data
|
40
|
-
FileUtils.cp_r "#{fixtures_path}/.", tempdir
|
41
|
-
end
|
42
|
-
|
43
|
-
def cleanup_test_data
|
44
|
-
FileUtils.rm_r Dir.glob("#{tempdir}/*")
|
45
|
-
end
|
46
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
plugins:
|