cloud66_agent 1.2.1 → 1.2.2
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
|
-
|
4
|
+
ZjNmOWJiODVlYjQ3NzE1NGQ2ZGI4ODY2YzBiMjBjYTM4ODVlZDhjZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDM1YTU2ODYwZmQzMDRhODVmM2IxYzljODEyOGUzNzhmNTE2OTUxMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Yzk1ZWEyMTQ3ZDdkZTJiN2JmNmQwYTZjYTRmYzIyN2U5YjliZjUwYjM4ZjZj
|
10
|
+
MTllOTViYTc2ZDllNzdmMGFmYzFiZTFkZjVhYTA4YWMzZTBlN2Y2NmYxYWVk
|
11
|
+
N2M0Y2M0YTlhODgxYWNmODM0MGIzODk0N2I3MDMxYzAxN2IwMDk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTJkY2VhNWZkMDE3MDdjNWQxZWY5ZDI2YzAxYzFlYTgyNGE1M2EwMDkxMDIw
|
14
|
+
MmJmMjc0OWI1N2U5YjNmNTcyMDg3MzM0OWY0YWE4MTY3ODc5YmY1YTY2NjFl
|
15
|
+
NGRhZWExNTJjODEzMmUyZTY1YWE5ZmZiNTAwMjU1YzBjMjVmN2U=
|
@@ -24,17 +24,14 @@ module Cloud66
|
|
24
24
|
# use the passed in value
|
25
25
|
$config.is_gc = (cloud == 'googlecloud')
|
26
26
|
end
|
27
|
-
|
28
|
-
address_info = Utils::VitalSigns.address_info
|
29
27
|
data = {
|
30
28
|
:timezone => Time.new.zone,
|
31
29
|
:server_uid => server_uid,
|
32
|
-
:ext_ipv4 => address_info[:ext_ipv4],
|
33
|
-
:int_ipv4 => address_info[:int_ipv4],
|
34
|
-
:ext_ipv6 => address_info[:ext_ipv6],
|
35
|
-
:int_ipv6 => address_info[:int_ipv6],
|
36
30
|
:version => Utils::Version.current,
|
37
31
|
:system => Utils::VitalSigns.system_info }
|
32
|
+
|
33
|
+
address_info = Utils::VitalSigns.address_info
|
34
|
+
data = data.merge(address_info)
|
38
35
|
rescue => exc
|
39
36
|
data = { error: exc.message }
|
40
37
|
end
|
@@ -8,39 +8,36 @@ module Cloud66
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.address_info
|
11
|
-
# address information
|
12
|
-
hash = parse_data(`facter ipaddress ipaddress_eth0 ipaddress6 ipaddress6_eth0`)
|
13
|
-
|
14
11
|
result = {}
|
15
12
|
# AWS special case
|
16
13
|
if $config.is_aws
|
17
14
|
reported_ip = `/usr/bin/curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
|
18
15
|
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]?)$/
|
19
|
-
|
16
|
+
reported_ip = `/usr/bin/curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
|
17
|
+
result[:int_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]?)$/
|
18
|
+
# GC special case
|
20
19
|
elsif $config.is_gc
|
21
20
|
external_ip = `/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip`
|
22
21
|
result[:ext_ipv4] = external_ip if external_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]?)$/
|
23
|
-
else
|
24
|
-
# set general external ip address
|
25
|
-
result[:ext_ipv4] = hash['ipaddress']
|
26
|
-
end
|
27
|
-
|
28
|
-
# GC special case
|
29
|
-
if $config.is_gc
|
30
22
|
internal_ip = `/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/ip`
|
31
23
|
result[:int_ipv4] = internal_ip if internal_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]?)$/
|
32
24
|
else
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
interfaces_raw = `facter interfaces`
|
26
|
+
interfaces = interfaces_raw.split(',').select { |interface| interface =~ /^eth/ }
|
27
|
+
|
28
|
+
# don't have any ip address info
|
29
|
+
raise 'no address information' if interfaces.empty?
|
38
30
|
|
39
|
-
|
40
|
-
|
31
|
+
# address information
|
32
|
+
facter_command = "facter #{interfaces.map { |interface| "ipaddress_#{interface} ipaddress6_#{interface}" }.join(' ')}"
|
33
|
+
hash = parse_data(`#{facter_command}`)
|
41
34
|
|
42
|
-
|
43
|
-
|
35
|
+
# don't have any ip address info
|
36
|
+
raise 'no address information' if hash.empty?
|
37
|
+
|
38
|
+
# return all interface information
|
39
|
+
return hash
|
40
|
+
end
|
44
41
|
end
|
45
42
|
|
46
43
|
def self.is_aws?
|
@@ -74,8 +71,8 @@ module Cloud66
|
|
74
71
|
hash = {}
|
75
72
|
data.lines.each do |line|
|
76
73
|
split = line.split('=>')
|
77
|
-
key = split[0]
|
78
74
|
if split.size == 2
|
75
|
+
key = split[0]
|
79
76
|
value = split[1]
|
80
77
|
unless value.nil?
|
81
78
|
value = value.strip
|