cloud66_agent 1.2.0 → 1.2.1.beta1

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
- MzY5YzEwYjIxZGVjNGVjMDIyYmUwZDYzMDg5NDgzYzcxYmIyMWMyMg==
4
+ OWJmOWMzYzg2OTExNWE4YTU2MzkzM2Y1MmU1ZWEwZDU0ZGI4OTVmMQ==
5
5
  data.tar.gz: !binary |-
6
- ZjcwZDA5N2E2YmZkNGI5NDIyOGE3OGYxNTkyM2MzZmU1ODA4YTIxNQ==
6
+ YzFlNzExM2Q5M2FiNWVhYWE0ZGIwZTNmNjM2NTQ5NmJkMWUzMDI4ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDE5ODUxNDVmNzk1M2YzMDgyOTNiMTM2ZWNjMTg3ZGMzYWFkZmRlZThiMGQz
10
- N2M2MTQ2MWExNTgwNWJmODgxMzY4NTA5ZjhhNDNkZWYyNzMyZDkxNzgzY2Y0
11
- ZmEwZTA3ZWQ2MTk2NjY0ZjFiMWFhZDc1YzY2YzU1YjJiZjRjNWM=
9
+ YzcyYzAzOWUxNmI4Nzk4N2RiZTljYzI3ODc3NTE2ZmJlNmEwZmMxNzc5N2Fh
10
+ ZjRlNTg0MGEyNTkzNThiNmFkZDkxMzI5NTAwNTJjYmFmN2I5M2RlZTcyYzgy
11
+ MjE2YjI1NGUzMTQ3Zjk3ZjEwYTQ5ODM3NGU2YmM1N2U4YzE5N2E=
12
12
  data.tar.gz: !binary |-
13
- NDgzMmIzNWIzNmViMGUxOWEwODNhMGQ3Yjk3ODY0NjAyNjg4ZTZlZTMwMmRl
14
- ZWU5YmJkMmRlZjYzOGVkZTVhYzdiNzU2MjUxYzI2NDkwMDgzNzhiNDQ4Njhk
15
- NmQyODQzM2ViOGRiMjM4ZTRlMTI2ZmU1ODA3NDRlYzI4NmUxZGY=
13
+ MzBkYTFmYTBiNzRlNGMyYmJjOTAyMDI1MTZkNTY4YTQ2ZjhiOGU2ZTIyY2Ux
14
+ ZTZlMTA0NjNlMDMyNzhlOGZmZDg5MjFhMDFlYzcwYTk3NWZhYTI0ZTdmNDk3
15
+ MWU1YTNlMTMyZTExNWE3Y2JmYjQ5MTMwMGQ3ODA2Yzk1NDgwMDM=
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-1.9.3-p448
1
+ ruby-1.9.3
@@ -10,10 +10,21 @@ module Cloud66
10
10
  if cloud.nil? || cloud.empty?
11
11
  # try figure it out
12
12
  $config.is_aws = Utils::VitalSigns.is_aws?
13
+
14
+ if $config.is_aws
15
+ $config.is_gc = false
16
+ else
17
+ # try figure it out
18
+ $config.is_gc = Utils::VitalSigns.is_gc?
19
+ end
13
20
  else
14
21
  # use the passed in value
15
22
  $config.is_aws = (cloud == 'aws')
23
+
24
+ # use the passed in value
25
+ $config.is_gc = (cloud == 'googlecloud')
16
26
  end
27
+
17
28
  address_info = Utils::VitalSigns.address_info
18
29
  data = {
19
30
  :timezone => Time.new.zone,
@@ -13,6 +13,7 @@ module Cloud66
13
13
  :agent_uid,
14
14
  :disabled,
15
15
  :is_aws,
16
+ :is_gc,
16
17
  :log,
17
18
  :log_level
18
19
 
@@ -26,6 +27,7 @@ module Cloud66
26
27
  @api_url ||= 'https://api.cloud66.com'
27
28
  @disabled ||= false
28
29
  @is_aws ||= false
30
+ @is_gc ||= false
29
31
  end
30
32
 
31
33
  def is_agent_configured?
@@ -43,6 +45,7 @@ module Cloud66
43
45
  'agent_uid' => @agent_uid,
44
46
  'disabled' => @disabled,
45
47
  'is_aws' => @is_aws,
48
+ 'is_gc' => @is_gc,
46
49
  'log' => @log == STDOUT ? "STDOUT" : @log,
47
50
  'log_level' => @log_level,
48
51
  }
@@ -65,6 +68,7 @@ module Cloud66
65
68
  @agent_uid = config['agent_uid']
66
69
  @disabled = config['disabled']
67
70
  @is_aws = config['is_aws']
71
+ @is_gc = config['is_gc']
68
72
  @log = config['log']
69
73
  @log_level = config['log_level']
70
74
  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, 2, 0
16
+ MAJOR, MINOR, PATCH = 1, 2, 1
17
17
 
18
18
  #ie. PRERELEASE_MODIFIER = 'beta1' or nil
19
- PRERELEASE_MODIFIER = nil
19
+ PRERELEASE_MODIFIER = 'beta1'
20
20
 
21
21
  ##
22
22
  # Returns the major version ( big release based off of multiple minor releases )
@@ -16,11 +16,23 @@ module Cloud66
16
16
  if $config.is_aws
17
17
  reported_ip = `/usr/bin/curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
18
18
  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
+ # GC special case
20
+ elsif $config.is_gc
21
+ external_ip = `/usr/bin/curl -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip`
22
+ 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]?)$/
19
23
  else
20
24
  # set general external ip address
21
25
  result[:ext_ipv4] = hash['ipaddress']
22
26
  end
23
- result[:int_ipv4] = hash['ipaddress_eth0'] if hash.has_key?('ipaddress_eth0')
27
+
28
+ # GC special case
29
+ if $config.is_gc
30
+ internal_ip = `/usr/bin/curl -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/ip`
31
+ 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]?)$/
32
+ else
33
+ result[:int_ipv4] = hash['ipaddress_eth0'] if hash.has_key?('ipaddress_eth0')
34
+ end
35
+
24
36
  result[:ext_ipv6] = hash['ipaddress6'] if hash.has_key?('ipaddress6')
25
37
  result[:int_ipv6] = hash['ipaddress6_eth0'] if hash.has_key?('ipaddress6_eth0')
26
38
 
@@ -45,6 +57,16 @@ module Cloud66
45
57
  return true
46
58
  end
47
59
 
60
+ def self.is_gc?
61
+ # 6 seconds to find out if this is a AWS image or not!
62
+ external_ip = `/usr/bin/curl --connect-timeout 6 -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip` rescue nil
63
+ return false if external_ip.nil? || external_ip.empty?
64
+ return false unless 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]?)$/
65
+
66
+ # it is google cloud
67
+ return true
68
+ end
69
+
48
70
  private
49
71
 
50
72
  # parse the data, not using YAML due to YAML parsing issues and JSON output not always working
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud66_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloud 66
@@ -141,12 +141,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ! '>='
144
+ - - ! '>'
145
145
  - !ruby/object:Gem::Version
146
- version: '0'
146
+ version: 1.3.1
147
147
  requirements: []
148
148
  rubyforge_project:
149
- rubygems_version: 2.1.11
149
+ rubygems_version: 2.2.2
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: Cloud 66 server component