odania 0.0.22 → 0.0.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9ffca23df7f0bcf704ee4dfeb787327b6d22513
4
- data.tar.gz: 1c5ad5ec6aad793ca550ffc6d46ca6f22b8d7aa9
3
+ metadata.gz: d506a9221ab23566539c2d3c4ef05591c9c52708
4
+ data.tar.gz: a875aed746071e7c03818b937af551bd59eae577
5
5
  SHA512:
6
- metadata.gz: 131db8a62b7dea4c0a3536e9058806b0bec5a1fc94c7241d1a33dc3d1c7574b328ef2700a57ff0e2ce1688d4808a8539c5b9755848ef936b9b6135ffd774c653
7
- data.tar.gz: 491ea63fd9f1c76befb728d332ef9863dbe95da956f7586c6f6df314f52faabc62b7a2cb2572c472c35403b6d977693b63177a5154cee4421fa7533e4bfb005c
6
+ metadata.gz: c8808a430e8ace883a91f90fdb4300533b130e482ce1db76287966c9f5941ba8a97dc539e4364dd30422fe1d75b4764fc5605a43cc134dc47bf4b2598aa31155
7
+ data.tar.gz: 9ecdd650491184c8cb6ce4540c91c03c10b1c5ee5bca7fd1e87487501a3432c98b3460031cfd45228474f1670006d4ba8ad7060d6f0225981da1531c809d76c4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- odania (0.0.22)
4
+ odania (0.0.23)
5
5
  deep_merge
6
6
  diplomat
7
7
  erubis
@@ -76,7 +76,7 @@ module Odania
76
76
 
77
77
  ips = Odania.ips
78
78
  plugin_config['plugin-config']['ips'] = ips
79
- plugin_config['plugin-config']['ip'] = ips.first
79
+ plugin_config['plugin-config']['ip'] = primary_ip(ips)
80
80
  plugin_config['plugin-config']['port'] = 80
81
81
  plugin_config['plugin-config']['tags'] = ["plugin-#{get_plugin_name}"]
82
82
  puts JSON.pretty_generate plugin_config if $debug
@@ -85,6 +85,15 @@ module Odania
85
85
  Odania.plugin.register plugin_instance_name, plugin_config
86
86
  end
87
87
 
88
+ # Rancher assigns two ip's the ip starting with 10. is routed through the hosts
89
+ def primary_ip(ips)
90
+ ips.each do |ip|
91
+ return ip if ip.start_with? '10.'
92
+ end
93
+
94
+ ips.first
95
+ end
96
+
88
97
  def get_plugin_name
89
98
  'odania_varnish'
90
99
  end
@@ -1,3 +1,3 @@
1
1
  module Odania
2
- VERSION = '0.0.22'
2
+ VERSION = '0.0.23'
3
3
  end
@@ -31,7 +31,7 @@ describe Odania::Varnish do
31
31
 
32
32
  it 'generates the varnish config' do
33
33
  $consul_mock.config.set('global_plugins_config', global_cfg)
34
- expect(subject.generate('/tmp/varnish')).to eq('odania-varnish|odania_varnish_1')
34
+ expect(subject.generate('/tmp/varnish')).to eq("odania-varnish|odania_varnish_#{Socket.gethostname.gsub(/[^0-9a-zA-Z_]/, '_')}")
35
35
  end
36
36
  end
37
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odania
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Petersen