cloud66_agent 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.ruby-version +1 -1
- data/bin/cloud66_agent +6 -0
- data/cloud66_agent.gemspec +1 -1
- data/lib/cloud66_agent/commands/send_message.rb +19 -0
- data/lib/cloud66_agent/utils/server.rb +5 -0
- data/lib/cloud66_agent/utils/version.rb +1 -1
- data/lib/cloud66_agent.rb +5 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzY5YzEwYjIxZGVjNGVjMDIyYmUwZDYzMDg5NDgzYzcxYmIyMWMyMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjcwZDA5N2E2YmZkNGI5NDIyOGE3OGYxNTkyM2MzZmU1ODA4YTIxNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDE5ODUxNDVmNzk1M2YzMDgyOTNiMTM2ZWNjMTg3ZGMzYWFkZmRlZThiMGQz
|
10
|
+
N2M2MTQ2MWExNTgwNWJmODgxMzY4NTA5ZjhhNDNkZWYyNzMyZDkxNzgzY2Y0
|
11
|
+
ZmEwZTA3ZWQ2MTk2NjY0ZjFiMWFhZDc1YzY2YzU1YjJiZjRjNWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDgzMmIzNWIzNmViMGUxOWEwODNhMGQ3Yjk3ODY0NjAyNjg4ZTZlZTMwMmRl
|
14
|
+
ZWU5YmJkMmRlZjYzOGVkZTVhYzdiNzU2MjUxYzI2NDkwMDgzNzhiNDQ4Njhk
|
15
|
+
NmQyODQzM2ViOGRiMjM4ZTRlMTI2ZmU1ODA3NDRlYzI4NmUxZGY=
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-1.9.3
|
1
|
+
ruby-1.9.3-p448
|
data/bin/cloud66_agent
CHANGED
@@ -79,6 +79,12 @@ elsif command == 'fail2ban'
|
|
79
79
|
elsif command == 'vitals'
|
80
80
|
# disable vital signs
|
81
81
|
exit 0
|
82
|
+
elsif command == 'send_message'
|
83
|
+
OptionParser.new do |opts|
|
84
|
+
opts.on('--key KEY', 'Key related to message ') { |v| @key = v }
|
85
|
+
opts.on('--options OPTIONS', 'Added options for message') { |v| @options = JSON.parse(v) unless v.nil? }
|
86
|
+
end.order!
|
87
|
+
Cloud66Agent.send_message(@key,@options)
|
82
88
|
else
|
83
89
|
begin
|
84
90
|
Cloud66Agent.send command
|
data/cloud66_agent.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.name = "cloud66_agent"
|
8
8
|
gem.version = Cloud66::Utils::Version.current
|
9
9
|
gem.platform = Gem::Platform::RUBY
|
10
|
-
gem.date = '2014-02-
|
10
|
+
gem.date = '2014-02-27'
|
11
11
|
gem.authors = ["Cloud 66"]
|
12
12
|
gem.email = ['hello@cloud66.com']
|
13
13
|
gem.licenses = ['MIT']
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'cloud66_agent/utils/server'
|
2
|
+
|
3
|
+
module Cloud66
|
4
|
+
module Commands
|
5
|
+
class SendMessage
|
6
|
+
def self.perform(key,options)
|
7
|
+
data = {
|
8
|
+
key: key,
|
9
|
+
options: options
|
10
|
+
}
|
11
|
+
Utils::Server.send_message(data)
|
12
|
+
exit 0
|
13
|
+
rescue => exc
|
14
|
+
$logger.error "Command \"send_message\" failed: #{exc.message}"
|
15
|
+
exit -1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -38,6 +38,11 @@ module Cloud66
|
|
38
38
|
process(do_request(:post, "/server/#{$config.agent_uid}/fail2ban.json", build_content(data)))
|
39
39
|
end
|
40
40
|
|
41
|
+
def self.send_message(data)
|
42
|
+
#puts data
|
43
|
+
process(do_request(:post, "/server/#{$config.agent_uid}/message.json", build_content(data)))
|
44
|
+
end
|
45
|
+
|
41
46
|
private
|
42
47
|
|
43
48
|
def self.process(response)
|
data/lib/cloud66_agent.rb
CHANGED
@@ -33,4 +33,9 @@ class Cloud66Agent
|
|
33
33
|
raise ArgumentError.new if is_banned.nil? || ip_address.nil? || attack.nil? || port.nil?
|
34
34
|
Cloud66::Commands::Fail2ban.perform(is_banned, ip_address, attack, port)
|
35
35
|
end
|
36
|
+
|
37
|
+
def self.send_message(key,options)
|
38
|
+
raise ArgumentError.new if key.nil? || (!options.nil? && !options.is_a?(Hash))
|
39
|
+
Cloud66::Commands::SendMessage.perform(key,options)
|
40
|
+
end
|
36
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud66_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloud 66
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/cloud66_agent/commands/job_end.rb
|
119
119
|
- lib/cloud66_agent/commands/job_start.rb
|
120
120
|
- lib/cloud66_agent/commands/pulse.rb
|
121
|
+
- lib/cloud66_agent/commands/send_message.rb
|
121
122
|
- lib/cloud66_agent/commands/vitals.rb
|
122
123
|
- lib/cloud66_agent/plugins/backup.rb
|
123
124
|
- lib/cloud66_agent/plugins/plugin.rb
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
requirements: []
|
147
148
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.1.11
|
149
150
|
signing_key:
|
150
151
|
specification_version: 4
|
151
152
|
summary: Cloud 66 server component
|