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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 244a32a5f2ef24f9cf9732eabc121d997f51a38f
4
- data.tar.gz: 3a739ccc5a2413a35fe21bdba2ad71d993da6ba4
3
+ metadata.gz: 602c22b719d9246b52f80bb2c3085d230273bb60
4
+ data.tar.gz: 73a4924dabb8158750b99cc1f21431365a147429
5
5
  SHA512:
6
- metadata.gz: 87129974e6e7202a672d1ccdb354ac61dd3e005f87e59089c80289dbfc4adcd68092379f24ca6345035e15b8426b1129c6a51683457ef47a880d1f22dd6e797b
7
- data.tar.gz: 0a72671ce0b48c4f39d0f664a546cff0190c208bff53fec588cd745e4b9bd39474efa06c6cdcfef3bcce19337c826835f9ffb44686d1e3338967d6cb9eef0547
6
+ metadata.gz: 10476b28b50af8918bad76b9068d67fb65381ad2dd13fd4f4b2556ac7c2094bb0e8c4b784b5d23a9440d74b0acf5d14789f6b3b730ade87fcae2312787c40b6f
7
+ data.tar.gz: ef80d8398d4288f6d3560b1275cc2c454cf5656676235293e7aedcb53e41a50167751711ebb4999cbe1cef3c6bd41aba8810f24f1c41d750e253d7093f97fb15
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'hako-switch-hitter'
7
- spec.version = '0.1.0'
7
+ spec.version = '0.1.1'
8
8
  spec.authors = ['wata']
9
9
  spec.email = ['wata.gm@gmail.com']
10
10
 
@@ -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[:endpoint]
29
- @options[:endpoint]
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[:proto] || protocol
34
+ endpoint['proto'] || protocol
35
35
  end
36
36
 
37
37
  # @return [String]
38
38
  def endpoint_host
39
- return endpoint[:host] if endpoint[:host]
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[:port] || port
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[:path]
53
- endpoint[:path]
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(:scheduler).fetch(:region)
88
+ @app.yaml.fetch('scheduler').fetch('region')
84
89
  end
85
90
 
86
91
  # @return [Fixnum]
87
92
  def port
88
- @app.yaml.fetch(:scheduler).fetch(:elb_v2).fetch(:listeners)[0].port
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(:scheduler).fetch(:elb_v2).fetch(:listeners)[0].protocol
98
+ @app.yaml.fetch('scheduler').fetch('elb_v2').fetch('listeners')[0].fetch('protocol')
94
99
  end
95
100
 
96
101
  # @return [Aws::ElasticLoadBalancingV2::Client]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hako-switch-hitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - wata