Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for new report environment information (since 2.7.12)

  • Loading branch information...
commit 64222f36b0e60198b1a1095f7d1dafd3f5ad398e 1 parent 0f80d68
@guzmanbraso guzmanbraso authored
Showing with 8 additions and 4 deletions.
  1. +1 −0  irc.yaml
  2. +7 −4 lib/puppet/reports/irc.rb
View
1  irc.yaml
@@ -2,6 +2,7 @@
:irc_server: 'irc://puppetbot:password@irc.freenode.net:6667#channel'
:irc_password: 'password'
:irc_ssl: false
+:irc_register_first: false
:github_password: 'password'
:github_user: 'user'
View
11 lib/puppet/reports/irc.rb
@@ -30,13 +30,15 @@ def process
self.logs.each do |log|
output << log
end
-
+ if self.environment.nil?
+ self.environment == 'production'
+ end
if CONFIG[:github_user] && CONFIG[:github_password]
gist_id = gist(self.host,output)
- message = "Puppet run for #{self.host} #{self.status} at #{Time.now.asctime}. Created a Gist showing the output at #{gist_id}"
+ message = "Puppet #{self.environment} run for #{self.host} #{self.status} at #{Time.now.asctime}. Created a Gist showing the output at #{gist_id}"
else
Puppet.info "No GitHub credentials provided in irc.yaml - cannot create Gist with log output."
- message = "Puppet run for #{self.host} #{self.status} at #{Time.now.asctime}."
+ message = "Puppet #{self.environment} run for #{self.host} #{self.status} at #{Time.now.asctime}."
end
max_attempts = 2
@@ -47,6 +49,7 @@ def process
:uri => CONFIG[:irc_server],
:message => message,
:ssl => CONFIG[:irc_ssl],
+ :register_first => CONFIG[:irc_register_first],
:join => true,
}
if CONFIG.has_key?(:irc_password)
@@ -79,7 +82,7 @@ def gist(host,output)
req.content_type = 'application/json'
req.body = JSON.dump({
"files" => { "#{host}-#{Time.now.to_i.to_s}" => { "content" => output.join("\n") } },
- "description" => "Puppet run failed on #{host} @ #{Time.now.asctime}",
+ "description" => "Puppet #{environment} run failed on #{host} @ #{Time.now.asctime}",
"public" => false
})
response = https.request(req)
Please sign in to comment.
Something went wrong with that request. Please try again.