cloud66_agent 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzM3YmRiZDk3YjVlNTQyMzFkMTk0OTYwNDllYjU2MTI4MmM0NzkyNQ==
4
+ MzY5YzEwYjIxZGVjNGVjMDIyYmUwZDYzMDg5NDgzYzcxYmIyMWMyMg==
5
5
  data.tar.gz: !binary |-
6
- M2QyMTBkY2ZhNDUyMDZiMTJlYzRjZWQ3ZDBhMTU1NTFkMGY0Y2Y1ZQ==
6
+ ZjcwZDA5N2E2YmZkNGI5NDIyOGE3OGYxNTkyM2MzZmU1ODA4YTIxNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDY1M2I0YzFhMzU5NWM3N2IwMTA5OWI1M2NlNGYwZDE3OTNmZjU0YTkyNjli
10
- MTJiM2NhNGVhMGQ2MWZhYjhiMzY0NDlhNzBhY2ExMzNmY2I1MTc2OTRiY2M2
11
- YzJkZWMxZTJlYzA5NTMyZmNlM2JhNzNlZmZlODNlMjY0ZWMxNDY=
9
+ MDE5ODUxNDVmNzk1M2YzMDgyOTNiMTM2ZWNjMTg3ZGMzYWFkZmRlZThiMGQz
10
+ N2M2MTQ2MWExNTgwNWJmODgxMzY4NTA5ZjhhNDNkZWYyNzMyZDkxNzgzY2Y0
11
+ ZmEwZTA3ZWQ2MTk2NjY0ZjFiMWFhZDc1YzY2YzU1YjJiZjRjNWM=
12
12
  data.tar.gz: !binary |-
13
- ZTVmNDVjYTMyYzhlOTBiNDRkOGJkOGNiMzdlYTNhYzNlZjU3YmMxY2VjMzIx
14
- ODU3Y2I4YzMxZDM5MGI3MDBlYTIwNTU3MDYzYTJlZjU2MDZkY2VlNzNmY2I2
15
- ZjYwNGUyMmZjY2U0NmMwYWQyYWM1YTEzN2EyZjVjOTZiZWYxNDY=
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
@@ -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-04'
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)
@@ -13,7 +13,7 @@ module Cloud66
13
13
  # Defines the minor version
14
14
  # PATCH:
15
15
  # Defines the patch version
16
- MAJOR, MINOR, PATCH = 1, 1, 2
16
+ MAJOR, MINOR, PATCH = 1, 2, 0
17
17
 
18
18
  #ie. PRERELEASE_MODIFIER = 'beta1' or nil
19
19
  PRERELEASE_MODIFIER = nil
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.1.2
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-04 00:00:00.000000000 Z
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.2.1
149
+ rubygems_version: 2.1.11
149
150
  signing_key:
150
151
  specification_version: 4
151
152
  summary: Cloud 66 server component