summaryrefslogtreecommitdiff
path: root/lib/oxidized/hook
diff options
context:
space:
mode:
authorWild Kat <wk@futureinquestion.net>2018-03-20 23:15:34 +0100
committerWild Kat <wk@futureinquestion.net>2018-03-20 23:15:34 +0100
commit6f672654c7e725bc828b6577297b86d501780c50 (patch)
treecf29588894d0c071f0e6b393671c84b7dd605163 /lib/oxidized/hook
parentbaee367bfec7ec5241ad7e893de7df8ea7eec1e7 (diff)
parente7075d18e055613cb0324f0fc8eecfe7adeeac56 (diff)
refactor snr support into dcnos model
Diffstat (limited to 'lib/oxidized/hook')
-rw-r--r--lib/oxidized/hook/githubrepo.rb2
-rw-r--r--lib/oxidized/hook/slackdiff.rb18
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb
index d33e54e..f74b22a 100644
--- a/lib/oxidized/hook/githubrepo.rb
+++ b/lib/oxidized/hook/githubrepo.rb
@@ -51,7 +51,7 @@ class GithubRepo < Oxidized::Hook
else
if cfg.has_key?('publickey') && cfg.has_key?('privatekey')
log "Using ssh auth with key", :debug
- Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey))
+ Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey), passphrase: ENV["OXIDIZED_SSH_PASSPHRASE"])
else
log "Using ssh auth with agentforwarding", :debug
Rugged::Credentials::SshKeyFromAgent.new(username: 'git')
diff --git a/lib/oxidized/hook/slackdiff.rb b/lib/oxidized/hook/slackdiff.rb
index 728e5a7..7cd4465 100644
--- a/lib/oxidized/hook/slackdiff.rb
+++ b/lib/oxidized/hook/slackdiff.rb
@@ -30,14 +30,16 @@ class SlackDiff < Oxidized::Hook
if diffenable == true
gitoutput = ctx.node.output.new
diff = gitoutput.get_diff ctx.node, ctx.node.group, ctx.commitref, nil
- title = "#{ctx.node.name.to_s} #{ctx.node.group.to_s} #{ctx.node.model.class.name.to_s.downcase}"
- log "Posting diff as snippet to #{cfg.channel}"
- client.files_upload(channels: cfg.channel, as_user: true,
- content: diff[:patch].lines.to_a[4..-1].join,
- filetype: "diff",
- title: title,
- filename: "change"
- )
+ unless diff == "no diffs"
+ title = "#{ctx.node.name.to_s} #{ctx.node.group.to_s} #{ctx.node.model.class.name.to_s.downcase}"
+ log "Posting diff as snippet to #{cfg.channel}"
+ client.files_upload(channels: cfg.channel, as_user: true,
+ content: diff[:patch].lines.to_a[4..-1].join,
+ filetype: "diff",
+ title: title,
+ filename: "change"
+ )
+ end
end
# message custom formatted - optional
if cfg.has_key?('message') == true