hako-switch-hitter 0.1.0 → 0.1.1
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 +4 -4
- data/hako-switch-hitter.gemspec +1 -1
- data/lib/hako/scripts/switch_hitter.rb +15 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 602c22b719d9246b52f80bb2c3085d230273bb60
|
4
|
+
data.tar.gz: 73a4924dabb8158750b99cc1f21431365a147429
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10476b28b50af8918bad76b9068d67fb65381ad2dd13fd4f4b2556ac7c2094bb0e8c4b784b5d23a9440d74b0acf5d14789f6b3b730ade87fcae2312787c40b6f
|
7
|
+
data.tar.gz: ef80d8398d4288f6d3560b1275cc2c454cf5656676235293e7aedcb53e41a50167751711ebb4999cbe1cef3c6bd41aba8810f24f1c41d750e253d7093f97fb15
|
data/hako-switch-hitter.gemspec
CHANGED
@@ -25,18 +25,18 @@ module Hako
|
|
25
25
|
|
26
26
|
# @return [Hash]
|
27
27
|
def endpoint
|
28
|
-
raise Error.new("Switch hitter endpoint is not configured") unless @options[
|
29
|
-
@options[
|
28
|
+
raise Error.new("Switch hitter endpoint is not configured") unless @options['endpoint']
|
29
|
+
@options['endpoint']
|
30
30
|
end
|
31
31
|
|
32
32
|
# @return [String]
|
33
33
|
def endpoint_proto
|
34
|
-
endpoint[
|
34
|
+
endpoint['proto'] || protocol
|
35
35
|
end
|
36
36
|
|
37
37
|
# @return [String]
|
38
38
|
def endpoint_host
|
39
|
-
return endpoint[
|
39
|
+
return endpoint['host'] if endpoint['host']
|
40
40
|
|
41
41
|
load_balancer = describe_load_balancer
|
42
42
|
load_balancer.dns_name
|
@@ -44,13 +44,13 @@ module Hako
|
|
44
44
|
|
45
45
|
# @return [Fixnum]
|
46
46
|
def endpoint_port
|
47
|
-
endpoint[
|
47
|
+
endpoint['port'] || port
|
48
48
|
end
|
49
49
|
|
50
50
|
# @return [String]
|
51
51
|
def endpoint_path
|
52
|
-
raise Error.new("Switch hitter path is not configured") unless endpoint[
|
53
|
-
endpoint[
|
52
|
+
raise Error.new("Switch hitter path is not configured") unless endpoint['path']
|
53
|
+
endpoint['path']
|
54
54
|
end
|
55
55
|
|
56
56
|
# @return [Net::HTTP]
|
@@ -68,6 +68,11 @@ module Hako
|
|
68
68
|
net_http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
69
69
|
end
|
70
70
|
|
71
|
+
if @dry_run
|
72
|
+
Hako.logger.info("Switch hitter will request #{endpoint_proto.downcase}://#{endpoint_host}:#{endpoint_port}#{endpoint_path} [dry-run]")
|
73
|
+
return
|
74
|
+
end
|
75
|
+
|
71
76
|
net_http.start do
|
72
77
|
req = Net::HTTP::Get.new(endpoint_path)
|
73
78
|
res = net_http.request(req)
|
@@ -80,17 +85,17 @@ module Hako
|
|
80
85
|
|
81
86
|
# @return [String]
|
82
87
|
def region
|
83
|
-
@app.yaml.fetch(
|
88
|
+
@app.yaml.fetch('scheduler').fetch('region')
|
84
89
|
end
|
85
90
|
|
86
91
|
# @return [Fixnum]
|
87
92
|
def port
|
88
|
-
@app.yaml.fetch(
|
93
|
+
@app.yaml.fetch('scheduler').fetch('elb_v2').fetch('listeners')[0].fetch('port')
|
89
94
|
end
|
90
95
|
|
91
96
|
# @return [String]
|
92
97
|
def protocol
|
93
|
-
@app.yaml.fetch(
|
98
|
+
@app.yaml.fetch('scheduler').fetch('elb_v2').fetch('listeners')[0].fetch('protocol')
|
94
99
|
end
|
95
100
|
|
96
101
|
# @return [Aws::ElasticLoadBalancingV2::Client]
|