cloud66_agent 1.0.7 → 1.0.8.pre1
Sign up to get free protection for your applications and to get access to all the features.
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 = '2013-04-
|
10
|
+
gem.date = '2013-04-18'
|
11
11
|
gem.authors = ["Cloud 66"]
|
12
12
|
gem.email = ['hello@cloud66.com']
|
13
13
|
gem.description = "See https://www.cloud66.com for more info"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cloud66_agent/utils/vital_signs'
|
2
|
+
|
1
3
|
module Cloud66
|
2
4
|
module Utils
|
3
5
|
class Config
|
@@ -10,6 +12,7 @@ module Cloud66
|
|
10
12
|
:secret_key,
|
11
13
|
:agent_uid,
|
12
14
|
:disabled,
|
15
|
+
:is_aws,
|
13
16
|
:log,
|
14
17
|
:log_level
|
15
18
|
|
@@ -22,6 +25,7 @@ module Cloud66
|
|
22
25
|
@log_level ||= 2
|
23
26
|
@api_url ||= 'https://api.cloud66.com'
|
24
27
|
@disabled ||= false
|
28
|
+
@is_aws ||= false
|
25
29
|
end
|
26
30
|
|
27
31
|
def is_agent_configured?
|
@@ -38,6 +42,7 @@ module Cloud66
|
|
38
42
|
'secret_key' => @secret_key,
|
39
43
|
'agent_uid' => @agent_uid,
|
40
44
|
'disabled' => @disabled,
|
45
|
+
'is_aws' => @is_aws,
|
41
46
|
'log' => @log == STDOUT ? "STDOUT" : @log,
|
42
47
|
'log_level' => @log_level,
|
43
48
|
}
|
@@ -59,6 +64,7 @@ module Cloud66
|
|
59
64
|
@secret_key = config['secret_key']
|
60
65
|
@agent_uid = config['agent_uid']
|
61
66
|
@disabled = config['disabled']
|
67
|
+
@is_aws = config['is_aws']
|
62
68
|
@log = config['log']
|
63
69
|
@log_level = config['log_level']
|
64
70
|
rescue
|
@@ -13,10 +13,10 @@ module Cloud66
|
|
13
13
|
# Defines the minor version
|
14
14
|
# PATCH:
|
15
15
|
# Defines the patch version
|
16
|
-
MAJOR, MINOR, PATCH = 1, 0,
|
16
|
+
MAJOR, MINOR, PATCH = 1, 0, 8
|
17
17
|
|
18
18
|
#ie. PRERELEASE_MODIFIER = 'beta1'
|
19
|
-
PRERELEASE_MODIFIER =
|
19
|
+
PRERELEASE_MODIFIER = 'pre1'
|
20
20
|
|
21
21
|
##
|
22
22
|
# Returns the major version ( big release based off of multiple minor releases )
|
@@ -12,14 +12,15 @@ module Cloud66
|
|
12
12
|
|
13
13
|
def self.address_info
|
14
14
|
# address information
|
15
|
-
hash = parse_data(`facter ipaddress
|
15
|
+
hash = parse_data(`facter ipaddress ipaddress_eth0 ipaddress6 ipaddress6_eth0`)
|
16
16
|
|
17
17
|
result = {}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
# AWS special case
|
19
|
+
if $config.is_aws
|
20
|
+
reported_ip = `/usr/bin/curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
|
21
|
+
result[:ext_ipv4] = reported_ip if reported_ip =~ /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
|
22
|
+
else
|
23
|
+
# set general external ip address
|
23
24
|
result[:ext_ipv4] = hash['ipaddress']
|
24
25
|
end
|
25
26
|
result[:int_ipv4] = hash['ipaddress_eth0'] if hash.has_key?('ipaddress_eth0')
|
@@ -27,7 +28,7 @@ module Cloud66
|
|
27
28
|
result[:int_ipv6] = hash['ipaddress6_eth0'] if hash.has_key?('ipaddress6_eth0')
|
28
29
|
|
29
30
|
# don't have any ip address info
|
30
|
-
raise
|
31
|
+
raise 'no address information' if result.empty? || !result.has_key?(:ext_ipv4)
|
31
32
|
|
32
33
|
# return ip address info
|
33
34
|
return result
|
@@ -41,6 +42,11 @@ module Cloud66
|
|
41
42
|
}
|
42
43
|
end
|
43
44
|
|
45
|
+
def self.is_aws?
|
46
|
+
hash = parse_data(`facter ec2_ami_id`)
|
47
|
+
return hash.has_key?('ec2_ami_id')
|
48
|
+
end
|
49
|
+
|
44
50
|
private
|
45
51
|
|
46
52
|
def self.disk_usage_info
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud66_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.8.pre1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Cloud 66
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -151,9 +151,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
none: false
|
153
153
|
requirements:
|
154
|
-
- - ! '
|
154
|
+
- - ! '>'
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
version:
|
156
|
+
version: 1.3.1
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
159
|
rubygems_version: 1.8.25
|