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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +35 -35
  3. data/lib/chef/knife/spork-bump.rb +100 -100
  4. data/lib/chef/knife/spork-check.rb +165 -161
  5. data/lib/chef/knife/spork-databag-create.rb +54 -54
  6. data/lib/chef/knife/spork-databag-delete.rb +51 -51
  7. data/lib/chef/knife/spork-databag-edit.rb +54 -54
  8. data/lib/chef/knife/spork-databag-fromfile.rb +88 -88
  9. data/lib/chef/knife/spork-delete.rb +132 -132
  10. data/lib/chef/knife/spork-environment-check.rb +90 -90
  11. data/lib/chef/knife/spork-environment-create.rb +63 -63
  12. data/lib/chef/knife/spork-environment-delete.rb +38 -38
  13. data/lib/chef/knife/spork-environment-edit.rb +40 -40
  14. data/lib/chef/knife/spork-environment-fromfile.rb +46 -46
  15. data/lib/chef/knife/spork-info.rb +34 -34
  16. data/lib/chef/knife/spork-node-create.rb +41 -41
  17. data/lib/chef/knife/spork-node-delete.rb +41 -41
  18. data/lib/chef/knife/spork-node-edit.rb +48 -48
  19. data/lib/chef/knife/spork-node-fromfile.rb +46 -46
  20. data/lib/chef/knife/spork-node-runlistadd.rb +51 -51
  21. data/lib/chef/knife/spork-node-runlistremove.rb +44 -44
  22. data/lib/chef/knife/spork-node-runlistset.rb +44 -44
  23. data/lib/chef/knife/spork-omni.rb +112 -112
  24. data/lib/chef/knife/spork-promote.rb +197 -197
  25. data/lib/chef/knife/spork-role-create.rb +46 -46
  26. data/lib/chef/knife/spork-role-delete.rb +50 -50
  27. data/lib/chef/knife/spork-role-edit.rb +40 -40
  28. data/lib/chef/knife/spork-role-fromfile.rb +65 -65
  29. data/lib/chef/knife/spork-upload.rb +151 -151
  30. data/lib/chef/knife/spork-version.rb +12 -12
  31. data/lib/knife-spork.rb +3 -3
  32. data/lib/knife-spork/plugins.rb +27 -27
  33. data/lib/knife-spork/plugins/campfire.rb +219 -219
  34. data/lib/knife-spork/plugins/eventinator.rb +329 -329
  35. data/lib/knife-spork/plugins/foodcritic.rb +46 -46
  36. data/lib/knife-spork/plugins/git.rb +393 -399
  37. data/lib/knife-spork/plugins/graphite.rb +25 -25
  38. data/lib/knife-spork/plugins/grove.rb +167 -167
  39. data/lib/knife-spork/plugins/hipchat.rb +171 -171
  40. data/lib/knife-spork/plugins/influxdb.rb +28 -28
  41. data/lib/knife-spork/plugins/irccat.rb +332 -332
  42. data/lib/knife-spork/plugins/jabber.rb +133 -133
  43. data/lib/knife-spork/plugins/plugin.rb +117 -117
  44. data/lib/knife-spork/plugins/rubocop.rb +56 -56
  45. data/lib/knife-spork/plugins/slack.rb +125 -125
  46. data/lib/knife-spork/plugins/statusnet.rb +122 -122
  47. data/lib/knife-spork/runner.rb +342 -342
  48. data/lib/knife-spork/version.rb +5 -5
  49. metadata +4 -51
  50. data/.gitignore +0 -21
  51. data/.ruby-gemset +0 -1
  52. data/.ruby-version +0 -1
  53. data/.travis.yml +0 -3
  54. data/CHANGELOG.md +0 -445
  55. data/Gemfile +0 -3
  56. data/README.md +0 -544
  57. data/Rakefile +0 -35
  58. data/knife-spork.gemspec +0 -28
  59. data/plugins/Campfire.md +0 -43
  60. data/plugins/Eventinator.md +0 -30
  61. data/plugins/Foodcritic.md +0 -53
  62. data/plugins/Git.md +0 -53
  63. data/plugins/Graphite.md +0 -30
  64. data/plugins/Grove.md +0 -31
  65. data/plugins/HipChat.md +0 -69
  66. data/plugins/Influxdb.md +0 -25
  67. data/plugins/Irccat.md +0 -50
  68. data/plugins/Jabber.md +0 -61
  69. data/plugins/README.md +0 -70
  70. data/plugins/Rubocop.md +0 -110
  71. data/plugins/Slack.md +0 -48
  72. data/plugins/StatusNet.md +0 -41
  73. data/plugins/Template.md +0 -34
  74. data/spec/spec_helper.rb +0 -10
  75. data/spec/test_helpers.rb +0 -46
  76. data/spec/unit/fixtures/config/spork-config.yml +0 -1
  77. data/spec/unit/fixtures/cookbooks/example/metadata.rb +0 -8
  78. data/spec/unit/fixtures/environments/example.json +0 -12
  79. data/spec/unit/fixtures/knife.rb +0 -6
  80. data/spec/unit/fixtures/test_client.pem +0 -27
  81. data/spec/unit/spork_bump_spec.rb +0 -75
  82. data/spec/unit/spork_info_spec.rb +0 -40
  83. data/spec/unit/spork_promote_spec.rb +0 -77
  84. data/spec/unit/spork_upload_spec.rb +0 -46
@@ -1,54 +1,54 @@
1
- require 'chef/knife'
2
-
3
- module KnifeSpork
4
- class SporkDataBagCreate < Chef::Knife
5
-
6
- deps do
7
- require 'knife-spork/runner'
8
- require 'json'
9
- require 'chef/knife/data_bag_create'
10
- end
11
-
12
- banner 'knife spork data bag create BAG [ITEM] (options)'
13
-
14
- option :secret,
15
- :short => "-s SECRET",
16
- :long => "--secret ",
17
- :description => "The secret key to use to encrypt data bag item values"
18
-
19
- option :secret_file,
20
- :long => "--secret-file SECRET_FILE",
21
- :description => "A file containing the secret key to use to encrypt data bag item values"
22
-
23
- def run
24
- self.class.send(:include, KnifeSpork::Runner)
25
- self.config = Chef::Config.merge!(config)
26
-
27
- if @name_args.nil?
28
- ui.error "You must specify a data bag name"
29
- ui.error opt_parser
30
- exit 1
31
- end
32
-
33
- @object_name = @name_args.first
34
- @object_secondary_name = @name_args.last
35
-
36
- run_plugins(:before_databagcreate)
37
- pre_databag = {}
38
- databag_create
39
- post_databag = load_databag_item(@object_name, @object_secondary_name)
40
- @object_difference = json_diff(pre_databag,post_databag).to_s
41
- run_plugins(:after_databagcreate)
42
- end
43
-
44
- private
45
- def databag_create
46
- dbc = Chef::Knife::DataBagCreate.new
47
- dbc.name_args = @name_args
48
- dbc.config[:editor] = config[:editor]
49
- dbc.config[:secret] = config[:secret]
50
- dbc.config[:secret_file] = config[:secret_file]
51
- dbc.run
52
- end
53
- end
54
- end
1
+ require 'chef/knife'
2
+
3
+ module KnifeSpork
4
+ class SporkDataBagCreate < Chef::Knife
5
+
6
+ deps do
7
+ require 'knife-spork/runner'
8
+ require 'json'
9
+ require 'chef/knife/data_bag_create'
10
+ end
11
+
12
+ banner 'knife spork data bag create BAG [ITEM] (options)'
13
+
14
+ option :secret,
15
+ :short => "-s SECRET",
16
+ :long => "--secret ",
17
+ :description => "The secret key to use to encrypt data bag item values"
18
+
19
+ option :secret_file,
20
+ :long => "--secret-file SECRET_FILE",
21
+ :description => "A file containing the secret key to use to encrypt data bag item values"
22
+
23
+ def run
24
+ self.class.send(:include, KnifeSpork::Runner)
25
+ self.config = Chef::Config.merge!(config)
26
+
27
+ if @name_args.nil?
28
+ ui.error "You must specify a data bag name"
29
+ ui.error opt_parser
30
+ exit 1
31
+ end
32
+
33
+ @object_name = @name_args.first
34
+ @object_secondary_name = @name_args.last
35
+
36
+ run_plugins(:before_databagcreate)
37
+ pre_databag = {}
38
+ databag_create
39
+ post_databag = load_databag_item(@object_name, @object_secondary_name)
40
+ @object_difference = json_diff(pre_databag,post_databag).to_s
41
+ run_plugins(:after_databagcreate)
42
+ end
43
+
44
+ private
45
+ def databag_create
46
+ dbc = Chef::Knife::DataBagCreate.new
47
+ dbc.name_args = @name_args
48
+ dbc.config[:editor] = config[:editor]
49
+ dbc.config[:secret] = config[:secret]
50
+ dbc.config[:secret_file] = config[:secret_file]
51
+ dbc.run
52
+ end
53
+ end
54
+ end
@@ -1,51 +1,51 @@
1
- require 'chef/knife'
2
-
3
- module KnifeSpork
4
- class SporkDataBagDelete < Chef::Knife
5
-
6
- deps do
7
- require 'knife-spork/runner'
8
- require 'json'
9
- require 'chef/knife/data_bag_delete'
10
- end
11
-
12
- banner 'knife spork data bag delete BAG [ITEM] (options)'
13
-
14
-
15
- def run
16
- self.class.send(:include, KnifeSpork::Runner)
17
- self.config = Chef::Config.merge!(config)
18
-
19
- if @name_args.length == 2
20
- @object_name = @name_args.first
21
- @object_secondary_name = @name_args.last
22
- run_plugins(:before_databagitemdelete)
23
- pre_databag = load_databag_item(@object_name,@object_secondary_name)
24
- databag_delete
25
- post_databag = {}
26
- @object_difference = json_diff(pre_databag,post_databag).to_s
27
- run_plugins(:after_databagitemdelete)
28
- elsif @name_args.length == 1
29
- @object_name = @name_args.first
30
- run_plugins(:before_databagdelete)
31
- pre_databag = load_databag(@object_name)
32
- databag_delete
33
- post_databag = {}
34
- @object_difference = json_diff(pre_databag,post_databag).to_s
35
- run_plugins(:after_databagdelete)
36
- else
37
- show_usage
38
- ui.fatal("You must specify at least a data bag name")
39
- exit 1
40
- end
41
- end
42
-
43
- private
44
- def databag_delete
45
- dbd = Chef::Knife::DataBagDelete.new
46
- dbd.name_args = @name_args
47
- dbd.config[:editor] = config[:editor]
48
- dbd.run
49
- end
50
- end
51
- end
1
+ require 'chef/knife'
2
+
3
+ module KnifeSpork
4
+ class SporkDataBagDelete < Chef::Knife
5
+
6
+ deps do
7
+ require 'knife-spork/runner'
8
+ require 'json'
9
+ require 'chef/knife/data_bag_delete'
10
+ end
11
+
12
+ banner 'knife spork data bag delete BAG [ITEM] (options)'
13
+
14
+
15
+ def run
16
+ self.class.send(:include, KnifeSpork::Runner)
17
+ self.config = Chef::Config.merge!(config)
18
+
19
+ if @name_args.length == 2
20
+ @object_name = @name_args.first
21
+ @object_secondary_name = @name_args.last
22
+ run_plugins(:before_databagitemdelete)
23
+ pre_databag = load_databag_item(@object_name,@object_secondary_name)
24
+ databag_delete
25
+ post_databag = {}
26
+ @object_difference = json_diff(pre_databag,post_databag).to_s
27
+ run_plugins(:after_databagitemdelete)
28
+ elsif @name_args.length == 1
29
+ @object_name = @name_args.first
30
+ run_plugins(:before_databagdelete)
31
+ pre_databag = load_databag(@object_name)
32
+ databag_delete
33
+ post_databag = {}
34
+ @object_difference = json_diff(pre_databag,post_databag).to_s
35
+ run_plugins(:after_databagdelete)
36
+ else
37
+ show_usage
38
+ ui.fatal("You must specify at least a data bag name")
39
+ exit 1
40
+ end
41
+ end
42
+
43
+ private
44
+ def databag_delete
45
+ dbd = Chef::Knife::DataBagDelete.new
46
+ dbd.name_args = @name_args
47
+ dbd.config[:editor] = config[:editor]
48
+ dbd.run
49
+ end
50
+ end
51
+ end
@@ -1,54 +1,54 @@
1
- require 'chef/knife'
2
-
3
- module KnifeSpork
4
- class SporkDataBagEdit < Chef::Knife
5
-
6
- deps do
7
- require 'knife-spork/runner'
8
- require 'json'
9
- require 'chef/knife/data_bag_edit'
10
- end
11
-
12
- banner 'knife spork data bag edit BAG ITEM (options)'
13
-
14
- option :secret,
15
- :short => "-s SECRET",
16
- :long => "--secret ",
17
- :description => "The secret key to use to encrypt data bag item values"
18
-
19
- option :secret_file,
20
- :long => "--secret-file SECRET_FILE",
21
- :description => "A file containing the secret key to use to encrypt data bag item values"
22
-
23
- def run
24
- self.class.send(:include, KnifeSpork::Runner)
25
- self.config = Chef::Config.merge!(config)
26
-
27
- if @name_args.length != 2
28
- ui.error "You must supply the data bag and an item to edit!"
29
- ui.error opt_parser
30
- exit 1
31
- end
32
-
33
- @object_name = @name_args.first
34
- @object_secondary_name = @name_args.last
35
-
36
- run_plugins(:before_databagedit)
37
- pre_databag = load_databag_item(@object_name, @object_secondary_name)
38
- databag_edit
39
- post_databag = load_databag_item(@object_name, @object_secondary_name)
40
- @object_difference = json_diff(pre_databag,post_databag).to_s
41
- run_plugins(:after_databagedit)
42
- end
43
-
44
- private
45
- def databag_edit
46
- dbe = Chef::Knife::DataBagEdit.new
47
- dbe.name_args = @name_args
48
- dbe.config[:editor] = config[:editor]
49
- dbe.config[:secret] = config[:secret]
50
- dbe.config[:secret_file] = config[:secret_file]
51
- dbe.run
52
- end
53
- end
54
- end
1
+ require 'chef/knife'
2
+
3
+ module KnifeSpork
4
+ class SporkDataBagEdit < Chef::Knife
5
+
6
+ deps do
7
+ require 'knife-spork/runner'
8
+ require 'json'
9
+ require 'chef/knife/data_bag_edit'
10
+ end
11
+
12
+ banner 'knife spork data bag edit BAG ITEM (options)'
13
+
14
+ option :secret,
15
+ :short => "-s SECRET",
16
+ :long => "--secret ",
17
+ :description => "The secret key to use to encrypt data bag item values"
18
+
19
+ option :secret_file,
20
+ :long => "--secret-file SECRET_FILE",
21
+ :description => "A file containing the secret key to use to encrypt data bag item values"
22
+
23
+ def run
24
+ self.class.send(:include, KnifeSpork::Runner)
25
+ self.config = Chef::Config.merge!(config)
26
+
27
+ if @name_args.length != 2
28
+ ui.error "You must supply the data bag and an item to edit!"
29
+ ui.error opt_parser
30
+ exit 1
31
+ end
32
+
33
+ @object_name = @name_args.first
34
+ @object_secondary_name = @name_args.last
35
+
36
+ run_plugins(:before_databagedit)
37
+ pre_databag = load_databag_item(@object_name, @object_secondary_name)
38
+ databag_edit
39
+ post_databag = load_databag_item(@object_name, @object_secondary_name)
40
+ @object_difference = json_diff(pre_databag,post_databag).to_s
41
+ run_plugins(:after_databagedit)
42
+ end
43
+
44
+ private
45
+ def databag_edit
46
+ dbe = Chef::Knife::DataBagEdit.new
47
+ dbe.name_args = @name_args
48
+ dbe.config[:editor] = config[:editor]
49
+ dbe.config[:secret] = config[:secret]
50
+ dbe.config[:secret_file] = config[:secret_file]
51
+ dbe.run
52
+ end
53
+ end
54
+ end
@@ -1,88 +1,88 @@
1
- require 'chef/knife'
2
-
3
- module KnifeSpork
4
- class SporkDataBagFromFile < Chef::Knife
5
-
6
- deps do
7
- require 'knife-spork/runner'
8
- require 'json'
9
- require 'chef/knife/data_bag_from_file'
10
- end
11
-
12
- banner 'knife spork data bag from file BAG FILE|FOLDER [FILE|FOLDER..] (options)'
13
-
14
- option :secret,
15
- :short => "-s SECRET",
16
- :long => "--secret ",
17
- :description => "The secret key to use to encrypt data bag item values"
18
-
19
- option :secret_file,
20
- :long => "--secret-file SECRET_FILE",
21
- :description => "A file containing the secret key to use to encrypt data bag item values"
22
-
23
- option :all,
24
- :short => "-a",
25
- :long => "--all",
26
- :description => "Upload all data bags"
27
-
28
- def run
29
- self.class.send(:include, KnifeSpork::Runner)
30
- self.config = Chef::Config.merge!(config)
31
-
32
- @object_name = @name_args.first
33
- # This should be the data bag name. If it isn't, some poor soul forgot the data bag name.
34
- # Check to see if there are any more arguments, and if not, warn about usage.
35
- if @name_args.drop(1).size == 0
36
- print "USAGE: #{banner}"
37
- exit(1)
38
- end
39
-
40
- if config[:all] == true
41
- test = Chef::Knife::DataBagFromFile.new
42
- test.config[:verbosity] = 3
43
- databags = test.send(:find_all_data_bags)
44
- databags.each do |bag|
45
- test.send(:find_all_data_bag_items,bag).each do |item|
46
- @object_name = bag
47
- @object_secondary_name = item.split("/").last
48
- run_plugins(:before_databagfromfile)
49
- begin
50
- pre_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
51
- rescue
52
- pre_databag = {}
53
- end
54
- databag_from_file([@object_name,@object_secondary_name])
55
- post_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
56
- @object_difference = json_diff(pre_databag,post_databag).to_s
57
- run_plugins(:after_databagfromfile)
58
- end
59
- end
60
-
61
- else
62
- @name_args[1..-1].each do |arg|
63
- @object_secondary_name = arg.split("/").last
64
- run_plugins(:before_databagfromfile)
65
- begin
66
- pre_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
67
- rescue
68
- pre_databag = {}
69
- end
70
- databag_from_file
71
- post_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
72
- @object_difference = json_diff(pre_databag,post_databag).to_s
73
- run_plugins(:after_databagfromfile)
74
- end
75
- end
76
- end
77
-
78
- private
79
- def databag_from_file(data_bag_names=nil)
80
- dbff = Chef::Knife::DataBagFromFile.new
81
- dbff.name_args = data_bag_names || @name_args
82
- dbff.config[:editor] = config[:editor]
83
- dbff.config[:secret] = config[:secret]
84
- dbff.config[:secret_file] = config[:secret_file]
85
- dbff.run
86
- end
87
- end
88
- end
1
+ require 'chef/knife'
2
+
3
+ module KnifeSpork
4
+ class SporkDataBagFromFile < Chef::Knife
5
+
6
+ deps do
7
+ require 'knife-spork/runner'
8
+ require 'json'
9
+ require 'chef/knife/data_bag_from_file'
10
+ end
11
+
12
+ banner 'knife spork data bag from file BAG FILE|FOLDER [FILE|FOLDER..] (options)'
13
+
14
+ option :secret,
15
+ :short => "-s SECRET",
16
+ :long => "--secret ",
17
+ :description => "The secret key to use to encrypt data bag item values"
18
+
19
+ option :secret_file,
20
+ :long => "--secret-file SECRET_FILE",
21
+ :description => "A file containing the secret key to use to encrypt data bag item values"
22
+
23
+ option :all,
24
+ :short => "-a",
25
+ :long => "--all",
26
+ :description => "Upload all data bags"
27
+
28
+ def run
29
+ self.class.send(:include, KnifeSpork::Runner)
30
+ self.config = Chef::Config.merge!(config)
31
+
32
+ @object_name = @name_args.first
33
+ # This should be the data bag name. If it isn't, some poor soul forgot the data bag name.
34
+ # Check to see if there are any more arguments, and if not, warn about usage.
35
+ if @name_args.drop(1).size == 0
36
+ print "USAGE: #{banner}"
37
+ exit(1)
38
+ end
39
+
40
+ if config[:all] == true
41
+ test = Chef::Knife::DataBagFromFile.new
42
+ test.config[:verbosity] = 3
43
+ databags = test.send(:find_all_data_bags)
44
+ databags.each do |bag|
45
+ test.send(:find_all_data_bag_items,bag).each do |item|
46
+ @object_name = bag
47
+ @object_secondary_name = item.split("/").last
48
+ run_plugins(:before_databagfromfile)
49
+ begin
50
+ pre_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
51
+ rescue
52
+ pre_databag = {}
53
+ end
54
+ databag_from_file([@object_name,@object_secondary_name])
55
+ post_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
56
+ @object_difference = json_diff(pre_databag,post_databag).to_s
57
+ run_plugins(:after_databagfromfile)
58
+ end
59
+ end
60
+
61
+ else
62
+ @name_args[1..-1].each do |arg|
63
+ @object_secondary_name = arg.split("/").last
64
+ run_plugins(:before_databagfromfile)
65
+ begin
66
+ pre_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
67
+ rescue
68
+ pre_databag = {}
69
+ end
70
+ databag_from_file
71
+ post_databag = load_databag_item(@object_name, @object_secondary_name.gsub(".json",""))
72
+ @object_difference = json_diff(pre_databag,post_databag).to_s
73
+ run_plugins(:after_databagfromfile)
74
+ end
75
+ end
76
+ end
77
+
78
+ private
79
+ def databag_from_file(data_bag_names=nil)
80
+ dbff = Chef::Knife::DataBagFromFile.new
81
+ dbff.name_args = data_bag_names || @name_args
82
+ dbff.config[:editor] = config[:editor]
83
+ dbff.config[:secret] = config[:secret]
84
+ dbff.config[:secret_file] = config[:secret_file]
85
+ dbff.run
86
+ end
87
+ end
88
+ end