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,56 +1,56 @@
1
- require 'knife-spork/plugins/plugin'
2
-
3
- module KnifeSpork
4
- module Plugins
5
- class Rubocop < Plugin
6
- name :rubocop
7
- hooks :after_check, :before_upload
8
-
9
- def perform
10
- if config.use_cookstyle
11
- safe_require 'cookstyle'
12
- else
13
- safe_require 'rubocop'
14
- end
15
- safe_require 'rubocop/cli'
16
- safe_require 'rubocop/config_store'
17
-
18
- if Gem::Specification.find_all_by_name("rubocop").empty?
19
- ui.fatal "The knife-spork rubocop plugin requires rubocop."
20
- exit 1
21
- end
22
-
23
- base_options = []
24
- base_options = base_options.concat([ "-D" ]) if config.show_name # Lists the name of the offense along with the description
25
- base_options = base_options.concat([ "--auto-correct" ]) if config.autocorrect
26
- base_options = base_options.concat([ "--out", config.out_file ]) if config.out_file # Specify a file output rather than STDOUT for the specific errors
27
- base_options = base_options.concat([ "--fail-level", config.sev_level ]) if config.sev_level # Specify a severity level for when rubocop should fail
28
- base_options = base_options.concat([ "--lint"]) if config.lint # Only run lint checks
29
-
30
- cookbooks.each do |cookbook|
31
- ui.info "Running rubocop against #{cookbook.name}@#{cookbook.version}..."
32
-
33
- cookbook_path = cookbook.root_dir
34
-
35
- ui.info cookbook_path
36
-
37
- options = [ cookbook_path ]
38
-
39
- cli = defined?(RuboCop) ? ::RuboCop::CLI.new : ::Rubocop::CLI.new
40
- result = cli.run(options)
41
-
42
- unless result == 0
43
- ui.error "Rubocop failed!"
44
- exit(1) if config.epic_fail
45
- else
46
- ui.info "Passed!"
47
- end
48
- end
49
- end
50
-
51
- def epic_fail?
52
- config.epic_fail.nil? ? 'true' : config.epic_fail
53
- end
54
- end
55
- end
56
- end
1
+ require 'knife-spork/plugins/plugin'
2
+
3
+ module KnifeSpork
4
+ module Plugins
5
+ class Rubocop < Plugin
6
+ name :rubocop
7
+ hooks :after_check, :before_upload
8
+
9
+ def perform
10
+ if config.use_cookstyle
11
+ safe_require 'cookstyle'
12
+ else
13
+ safe_require 'rubocop'
14
+ end
15
+ safe_require 'rubocop/cli'
16
+ safe_require 'rubocop/config_store'
17
+
18
+ if Gem::Specification.find_all_by_name("rubocop").empty?
19
+ ui.fatal "The knife-spork rubocop plugin requires rubocop."
20
+ exit 1
21
+ end
22
+
23
+ base_options = []
24
+ base_options = base_options.concat([ "-D" ]) if config.show_name # Lists the name of the offense along with the description
25
+ base_options = base_options.concat([ "--auto-correct" ]) if config.autocorrect
26
+ base_options = base_options.concat([ "--out", config.out_file ]) if config.out_file # Specify a file output rather than STDOUT for the specific errors
27
+ base_options = base_options.concat([ "--fail-level", config.sev_level ]) if config.sev_level # Specify a severity level for when rubocop should fail
28
+ base_options = base_options.concat([ "--lint"]) if config.lint # Only run lint checks
29
+
30
+ cookbooks.each do |cookbook|
31
+ ui.info "Running rubocop against #{cookbook.name}@#{cookbook.version}..."
32
+
33
+ cookbook_path = cookbook.root_dir
34
+
35
+ ui.info cookbook_path
36
+
37
+ options = [ cookbook_path ]
38
+
39
+ cli = defined?(RuboCop) ? ::RuboCop::CLI.new : ::Rubocop::CLI.new
40
+ result = cli.run(options)
41
+
42
+ unless result == 0
43
+ ui.error "Rubocop failed!"
44
+ exit(1) if config.epic_fail
45
+ else
46
+ ui.info "Passed!"
47
+ end
48
+ end
49
+ end
50
+
51
+ def epic_fail?
52
+ config.epic_fail.nil? ? 'true' : config.epic_fail
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,125 +1,125 @@
1
- require 'knife-spork/plugins/plugin'
2
-
3
- module KnifeSpork
4
- module Plugins
5
- class Slack < Plugin
6
- name :slack
7
-
8
- def perform; end
9
-
10
- def after_upload
11
- slack "#{organization}#{current_user} uploaded the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")}"
12
- end
13
-
14
- def after_delete
15
- slack "#{organization}#{current_user} deleted the following cookbooks: #{misc_output}"
16
- end
17
-
18
- def after_promote_remote
19
- slack "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
20
- end
21
-
22
- def after_environmentfromfile
23
- slack "#{organization}#{current_user} uploaded environment #{object_name}"
24
- end
25
-
26
- def after_environmentedit
27
- slack "#{organization}#{current_user} edited environment #{object_name}"
28
- end
29
-
30
- def after_environmentcreate
31
- slack "#{organization}#{current_user} created environment #{object_name}"
32
- end
33
-
34
- def after_environmentdelete
35
- slack "#{organization}#{current_user} deleted environment #{object_name}"
36
- end
37
-
38
- def after_rolefromfile
39
- slack "#{organization}#{current_user} uploaded role #{object_name}"
40
- end
41
-
42
- def after_roleedit
43
- slack "#{organization}#{current_user} edited role #{object_name}"
44
- end
45
-
46
- def after_rolecreate
47
- slack "#{organization}#{current_user} created role #{object_name}"
48
- end
49
-
50
- def after_roledelete
51
- slack "#{organization}#{current_user} deleted role #{object_name}"
52
- end
53
-
54
- def after_databagedit
55
- slack "#{organization}#{current_user} edited data bag item #{object_name}:#{object_secondary_name}"
56
- end
57
-
58
- def after_databagcreate
59
- slack "#{organization}#{current_user} created data bag #{object_name}"
60
- end
61
-
62
- def after_databagdelete
63
- slack "#{organization}#{current_user} deleted data bag item #{object_name}"
64
- end
65
-
66
- def after_databagitemdelete
67
- slack "#{organization}#{current_user} deleted data bag item #{object_name}:#{object_secondary_name}"
68
- end
69
-
70
- def after_databagfromfile
71
- slack "#{organization}#{current_user} uploaded data bag item #{object_name}:#{object_secondary_name}"
72
- end
73
-
74
- def after_nodeedit
75
- slack "#{organization}#{current_user} edited node #{object_name}"
76
- end
77
-
78
- def after_nodedelete
79
- slack "#{organization}#{current_user} deleted node #{object_name}"
80
- end
81
-
82
- def after_nodecreate
83
- slack "#{organization}#{current_user} created node #{object_name}"
84
- end
85
-
86
- def after_nodefromfile
87
- slack "#{organization}#{current_user} uploaded node #{object_name}"
88
- end
89
-
90
- def after_noderunlistadd
91
- slack "#{organization}#{current_user} added run_list items to #{object_name}: #{object_secondary_name}"
92
- end
93
-
94
- def after_noderunlistremove
95
- slack "#{organization}#{current_user} removed run_list items from #{object_name}: #{object_secondary_name}"
96
- end
97
-
98
- def after_noderunlistset
99
- slack "#{organization}#{current_user} set the run_list for #{object_name} to #{object_secondary_name}"
100
- end
101
-
102
-
103
- private
104
- def slack(message)
105
- safe_require 'slack-notifier'
106
- begin
107
- notifier = ::Slack::Notifier.new( config.webhook_url, channel: channel, username: username, icon_url: config.icon_url)
108
- notifier.ping message
109
- rescue Exception => e
110
- ui.error 'Something went wrong sending to Slack.'
111
- ui.error e.to_s
112
- end
113
- end
114
-
115
- def channel
116
- config.channel || '#random'
117
- end
118
-
119
- def username
120
- config.username || 'KnifeSpork'
121
- end
122
-
123
- end
124
- end
125
- end
1
+ require 'knife-spork/plugins/plugin'
2
+
3
+ module KnifeSpork
4
+ module Plugins
5
+ class Slack < Plugin
6
+ name :slack
7
+
8
+ def perform; end
9
+
10
+ def after_upload
11
+ slack "#{organization}#{current_user} uploaded the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")}"
12
+ end
13
+
14
+ def after_delete
15
+ slack "#{organization}#{current_user} deleted the following cookbooks: #{misc_output}"
16
+ end
17
+
18
+ def after_promote_remote
19
+ slack "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
20
+ end
21
+
22
+ def after_environmentfromfile
23
+ slack "#{organization}#{current_user} uploaded environment #{object_name}"
24
+ end
25
+
26
+ def after_environmentedit
27
+ slack "#{organization}#{current_user} edited environment #{object_name}"
28
+ end
29
+
30
+ def after_environmentcreate
31
+ slack "#{organization}#{current_user} created environment #{object_name}"
32
+ end
33
+
34
+ def after_environmentdelete
35
+ slack "#{organization}#{current_user} deleted environment #{object_name}"
36
+ end
37
+
38
+ def after_rolefromfile
39
+ slack "#{organization}#{current_user} uploaded role #{object_name}"
40
+ end
41
+
42
+ def after_roleedit
43
+ slack "#{organization}#{current_user} edited role #{object_name}"
44
+ end
45
+
46
+ def after_rolecreate
47
+ slack "#{organization}#{current_user} created role #{object_name}"
48
+ end
49
+
50
+ def after_roledelete
51
+ slack "#{organization}#{current_user} deleted role #{object_name}"
52
+ end
53
+
54
+ def after_databagedit
55
+ slack "#{organization}#{current_user} edited data bag item #{object_name}:#{object_secondary_name}"
56
+ end
57
+
58
+ def after_databagcreate
59
+ slack "#{organization}#{current_user} created data bag #{object_name}"
60
+ end
61
+
62
+ def after_databagdelete
63
+ slack "#{organization}#{current_user} deleted data bag item #{object_name}"
64
+ end
65
+
66
+ def after_databagitemdelete
67
+ slack "#{organization}#{current_user} deleted data bag item #{object_name}:#{object_secondary_name}"
68
+ end
69
+
70
+ def after_databagfromfile
71
+ slack "#{organization}#{current_user} uploaded data bag item #{object_name}:#{object_secondary_name}"
72
+ end
73
+
74
+ def after_nodeedit
75
+ slack "#{organization}#{current_user} edited node #{object_name}"
76
+ end
77
+
78
+ def after_nodedelete
79
+ slack "#{organization}#{current_user} deleted node #{object_name}"
80
+ end
81
+
82
+ def after_nodecreate
83
+ slack "#{organization}#{current_user} created node #{object_name}"
84
+ end
85
+
86
+ def after_nodefromfile
87
+ slack "#{organization}#{current_user} uploaded node #{object_name}"
88
+ end
89
+
90
+ def after_noderunlistadd
91
+ slack "#{organization}#{current_user} added run_list items to #{object_name}: #{object_secondary_name}"
92
+ end
93
+
94
+ def after_noderunlistremove
95
+ slack "#{organization}#{current_user} removed run_list items from #{object_name}: #{object_secondary_name}"
96
+ end
97
+
98
+ def after_noderunlistset
99
+ slack "#{organization}#{current_user} set the run_list for #{object_name} to #{object_secondary_name}"
100
+ end
101
+
102
+
103
+ private
104
+ def slack(message)
105
+ safe_require 'slack-notifier'
106
+ begin
107
+ notifier = ::Slack::Notifier.new( config.webhook_url, channel: channel, username: username, icon_url: config.icon_url)
108
+ notifier.ping message
109
+ rescue Exception => e
110
+ ui.error 'Something went wrong sending to Slack.'
111
+ ui.error e.to_s
112
+ end
113
+ end
114
+
115
+ def channel
116
+ config.channel || '#random'
117
+ end
118
+
119
+ def username
120
+ config.username || 'KnifeSpork'
121
+ end
122
+
123
+ end
124
+ end
125
+ end
@@ -1,122 +1,122 @@
1
- require 'knife-spork/plugins/plugin'
2
-
3
- module KnifeSpork
4
- module Plugins
5
- class StatusNet < Plugin
6
- name :statusnet
7
-
8
- def perform; end
9
-
10
- def after_upload
11
- statusnet "#{organization}#{current_user} uploaded the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")}"
12
- end
13
-
14
- def after_delete
15
- statusnet "#{organization}#{current_user} deleted the following cookbooks: #{misc_output}"
16
- end
17
-
18
- def after_promote_remote
19
- statusnet "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
20
- end
21
-
22
- def after_environmentfromfile
23
- statusnet "#{organization}#{current_user} uploaded environment #{object_name}"
24
- end
25
-
26
- def after_environmentedit
27
- statusnet "#{organization}#{current_user} edited environment #{object_name}"
28
- end
29
-
30
- def after_environmentcreate
31
- statusnet "#{organization}#{current_user} created environment #{object_name}"
32
- end
33
-
34
- def after_environmentdelete
35
- statusnet "#{organization}#{current_user} deleted environment #{object_name}"
36
- end
37
-
38
- def after_rolefromfile
39
- statusnet "#{organization}#{current_user} uploaded role #{object_name}"
40
- end
41
-
42
- def after_roleedit
43
- statusnet "#{organization}#{current_user} edited role #{object_name}"
44
- end
45
-
46
- def after_rolecreate
47
- statusnet "#{organization}#{current_user} created role #{object_name}"
48
- end
49
-
50
- def after_roledelete
51
- statusnet "#{organization}#{current_user} deleted role #{object_name}"
52
- end
53
-
54
- def after_databagedit
55
- statusnet "#{organization}#{current_user} edited data bag item #{object_name}:#{object_secondary_name}"
56
- end
57
-
58
- def after_databagcreate
59
- statusnet "#{organization}#{current_user} created data bag #{object_name}"
60
- end
61
-
62
- def after_databagdelete
63
- statusnet "#{organization}#{current_user} deleted data bag #{object_name}"
64
- end
65
-
66
- def after_databagitemdelete
67
- statusnet "#{organization}#{current_user} deleted data bag item #{object_name}:#{object_secondary_name}"
68
- end
69
-
70
- def after_databagfromfile
71
- statusnet "#{organization}#{current_user} uploaded data bag item #{object_name}:#{object_secondary_name}"
72
- end
73
-
74
- def after_nodeedit
75
- statusnet "#{organization}#{current_user} edited node #{object_name}"
76
- end
77
-
78
- def after_nodedelete
79
- statusnet "#{organization}#{current_user} deleted node #{object_name}"
80
- end
81
-
82
- def after_nodecreate
83
- statusnet "#{organization}#{current_user} created node #{object_name}"
84
- end
85
-
86
- def after_nodefromfile
87
- statusnet "#{organization}#{current_user} uploaded node #{object_name}"
88
- end
89
-
90
- def after_noderunlistadd
91
- statusnet "#{organization}#{current_user} added run_list items to #{object_name}: #{object_secondary_name}"
92
- end
93
-
94
- def after_noderunlistremove
95
- statusnet "#{organization}#{current_user} removed run_list items from #{object_name}: #{object_secondary_name}"
96
- end
97
-
98
- def after_noderunlistset
99
- statusnet "#{organization}#{current_user} set the run_list for #{object_name} to #{object_secondary_name}"
100
- end
101
-
102
- private
103
-
104
- def statusnet(message)
105
- safe_require 'curb'
106
-
107
- begin
108
- c = Curl::Easy.new(config.url)
109
- c.http_auth_types = :basic
110
- c.username = config.username
111
- c.password = config.password
112
- c.post_body = message
113
- c.perform
114
- rescue Exception => e
115
- ui.error 'Something went wrong sending to StatusNet.'
116
- ui.error e.to_s
117
- end
118
- end
119
-
120
- end
121
- end
122
- end
1
+ require 'knife-spork/plugins/plugin'
2
+
3
+ module KnifeSpork
4
+ module Plugins
5
+ class StatusNet < Plugin
6
+ name :statusnet
7
+
8
+ def perform; end
9
+
10
+ def after_upload
11
+ statusnet "#{organization}#{current_user} uploaded the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")}"
12
+ end
13
+
14
+ def after_delete
15
+ statusnet "#{organization}#{current_user} deleted the following cookbooks: #{misc_output}"
16
+ end
17
+
18
+ def after_promote_remote
19
+ statusnet "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
20
+ end
21
+
22
+ def after_environmentfromfile
23
+ statusnet "#{organization}#{current_user} uploaded environment #{object_name}"
24
+ end
25
+
26
+ def after_environmentedit
27
+ statusnet "#{organization}#{current_user} edited environment #{object_name}"
28
+ end
29
+
30
+ def after_environmentcreate
31
+ statusnet "#{organization}#{current_user} created environment #{object_name}"
32
+ end
33
+
34
+ def after_environmentdelete
35
+ statusnet "#{organization}#{current_user} deleted environment #{object_name}"
36
+ end
37
+
38
+ def after_rolefromfile
39
+ statusnet "#{organization}#{current_user} uploaded role #{object_name}"
40
+ end
41
+
42
+ def after_roleedit
43
+ statusnet "#{organization}#{current_user} edited role #{object_name}"
44
+ end
45
+
46
+ def after_rolecreate
47
+ statusnet "#{organization}#{current_user} created role #{object_name}"
48
+ end
49
+
50
+ def after_roledelete
51
+ statusnet "#{organization}#{current_user} deleted role #{object_name}"
52
+ end
53
+
54
+ def after_databagedit
55
+ statusnet "#{organization}#{current_user} edited data bag item #{object_name}:#{object_secondary_name}"
56
+ end
57
+
58
+ def after_databagcreate
59
+ statusnet "#{organization}#{current_user} created data bag #{object_name}"
60
+ end
61
+
62
+ def after_databagdelete
63
+ statusnet "#{organization}#{current_user} deleted data bag #{object_name}"
64
+ end
65
+
66
+ def after_databagitemdelete
67
+ statusnet "#{organization}#{current_user} deleted data bag item #{object_name}:#{object_secondary_name}"
68
+ end
69
+
70
+ def after_databagfromfile
71
+ statusnet "#{organization}#{current_user} uploaded data bag item #{object_name}:#{object_secondary_name}"
72
+ end
73
+
74
+ def after_nodeedit
75
+ statusnet "#{organization}#{current_user} edited node #{object_name}"
76
+ end
77
+
78
+ def after_nodedelete
79
+ statusnet "#{organization}#{current_user} deleted node #{object_name}"
80
+ end
81
+
82
+ def after_nodecreate
83
+ statusnet "#{organization}#{current_user} created node #{object_name}"
84
+ end
85
+
86
+ def after_nodefromfile
87
+ statusnet "#{organization}#{current_user} uploaded node #{object_name}"
88
+ end
89
+
90
+ def after_noderunlistadd
91
+ statusnet "#{organization}#{current_user} added run_list items to #{object_name}: #{object_secondary_name}"
92
+ end
93
+
94
+ def after_noderunlistremove
95
+ statusnet "#{organization}#{current_user} removed run_list items from #{object_name}: #{object_secondary_name}"
96
+ end
97
+
98
+ def after_noderunlistset
99
+ statusnet "#{organization}#{current_user} set the run_list for #{object_name} to #{object_secondary_name}"
100
+ end
101
+
102
+ private
103
+
104
+ def statusnet(message)
105
+ safe_require 'curb'
106
+
107
+ begin
108
+ c = Curl::Easy.new(config.url)
109
+ c.http_auth_types = :basic
110
+ c.username = config.username
111
+ c.password = config.password
112
+ c.post_body = message
113
+ c.perform
114
+ rescue Exception => e
115
+ ui.error 'Something went wrong sending to StatusNet.'
116
+ ui.error e.to_s
117
+ end
118
+ end
119
+
120
+ end
121
+ end
122
+ end