Sha256: ce58d32a153f1296a642bf586663793eea263258675dbb10a9f01c45c3caec97

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

module Pvcglue
  class Packages
    class Slack < Pvcglue::Packages

      def installed?
        return true unless minion.project.respond_to?(:slack_webhook_url)
        get_minion_state
      end

      def install!
        docs.set_item(
          heading: 'Slack Notifications',
          body: 'Using slacktee.',
          notes: [
            ''
          ],
          cheatsheet: [
            'Test:  echo "Hello World!" | slacktee',
          ],
          references: [
            '[slacktee home]https://github.com/course-hero/slacktee',
            '[slacktee usage]https://github.com/course-hero/slacktee#usage',
            '[Real-time notifications from systemd to Slack]https://www.scaledrone.com/blog/posts/real-time-notifications-from-systemd-to-slack',
          ]
        ) do
          # Persistence
          connection.run!(:root, '', 'curl -o /usr/local/bin/slacktee.sh https://raw.githubusercontent.com/course-hero/slacktee/v1.2.12/slacktee.sh')
          connection.run!(:root, '', 'chmod +x /usr/local/bin/slacktee.sh')
          connection.run!(:root, '', 'cp /usr/local/bin/slacktee.sh /usr/local/bin/slacktee')
          connection.write_to_file_from_template(user_name, 'slacktee.erb', '.slacktee')
        end
        connection.run!(user_name, '', %Q(echo 'Test from #{user_name} on #{minion.machine_name} at #{Time.now.utc.to_s}' | slacktee.sh ))

        set_minion_state
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pvcglue-0.9.6 lib/pvcglue/packages/slack.rb
pvcglue-0.9.5 lib/pvcglue/packages/slack.rb