lib/capistrano/ops/notification/slack.rb in capistrano-ops-0.2.0 vs lib/capistrano/ops/notification/slack.rb in capistrano-ops-0.2.1

- old
+ new

@@ -21,11 +21,12 @@ }.to_json response = http.request(request) puts response.body end - def backup_notification(result, date, database, backup_path) + def backup_notification(result, date, database, backup_path, notification_level) return if @slack_secret.nil? || @slack_channel.nil? + return if notification_level == 'error' && result uri = URI.parse("#{@slack_base_url}chat.postMessage") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri, initHeader = {'Content-Type' =>'application/json', 'Authorization' => 'Bearer ' + @slack_secret}) message_one = "Backup of #{database} successfully finished at #{Time.now}"