aly 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31c380fbca73a1136b7c8dea73e13ddd28f03a8e6e3a9a395bd55d225215ee56
4
- data.tar.gz: b320bcbb2b06fadd45f1ba005526fba07657287dbdf81e7ba48c50c3e4d24723
3
+ metadata.gz: 929950a91790b6ca3522f18cb114d29d58ccc1d4c61e4de6b649198d5624ecf3
4
+ data.tar.gz: 0c55d48418ec5a8661f8ef912dc7fc647514c99be0c14964a2f2d7fb4ed78198
5
5
  SHA512:
6
- metadata.gz: 3ea21f6de6ea31ded361e64a40b97f7f48fe1e8652994effebbd99d1b380c1b8a08d11519cdb4dd2d58196f66fd24adde2cc5d4d2069367809c8e7766cab4906
7
- data.tar.gz: 1a5f4e03792bded3c18cb798d03c574a35f96bda022c36265f0ff281cd7d52f8fe3edd987dbc36826768272f824b20dd42b320da63e30fa576b4a7032b4f8034
6
+ metadata.gz: e3e21c88c0dc447b9ca035786bbe4f1c4504f148a7731cb9cc8b9d1205152392e5e83d7fb702aaefd6f20ffb5acea3fc22677f3bccd20332c0914391ceae2e30
7
+ data.tar.gz: da9a871f358fa988084dc84f5498c3800bd6eefc8467dcae6faf81fc7f4a2aab60cc6128cf84d387103ff92b658611dda502c4a9f1beb2162100749a6dc0b3e8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aly (0.2.1)
4
+ aly (0.2.2)
5
5
  terminal-table (~> 1.8.0)
6
6
  thor (~> 0.20.0)
7
7
 
data/lib/aly/app.rb CHANGED
@@ -23,7 +23,7 @@ module Aly
23
23
 
24
24
  def ecs(*args, **options)
25
25
  raw_out = exec('ecs', 'DescribeInstances', '--pager', **options)
26
- selected = raw_out['Instances']['Instance'].each do |item|
26
+ selected = (raw_out['Instances']['Instance'] || []).each do |item|
27
27
  item['PrivateIP'] = (item['NetworkInterfaces']['NetworkInterface'] || []).map { |ni| ni['PrimaryIpAddress'] }.join(',')
28
28
  item['PublicIP'] = item['EipAddress']['IpAddress'] || ''
29
29
  item['PublicIP'] = item['PublicIpAddress']['IpAddress'].join(',') if item['PublicIP'] == ''
@@ -92,9 +92,9 @@ module Aly
92
92
 
93
93
  def slb(*args, **options)
94
94
  raw_out = exec('slb', 'DescribeLoadBalancers', '--pager', **options)
95
- selected = raw_out['LoadBalancers']['LoadBalancer']
95
+ selected = raw_out['LoadBalancers']['LoadBalancer'] || []
96
96
 
97
- listeners = exec('slb', 'DescribeLoadBalancerListeners', '--pager', 'path=Listeners', **options)['Listeners'].each_with_object({}) do |listener, result|
97
+ listeners = (exec('slb', 'DescribeLoadBalancerListeners', '--pager', 'path=Listeners', **options)['Listeners'] || []).each_with_object({}) do |listener, result|
98
98
  instance_id = listener['LoadBalancerId']
99
99
  result[instance_id] ||= []
100
100
  result[instance_id] << listener
@@ -156,7 +156,7 @@ module Aly
156
156
  end
157
157
 
158
158
  def show_slb(host, **options)
159
- @listeners ||= exec('slb', 'DescribeLoadBalancerListeners', '--pager', 'path=Listeners', **options)['Listeners']
159
+ @listeners ||= exec('slb', 'DescribeLoadBalancerListeners', '--pager', 'path=Listeners', **options)['Listeners'] || []
160
160
  lb = @slb.find { |e| e['Address'] == host }
161
161
  listeners = @listeners.select { |e| e['LoadBalancerId'] == lb['LoadBalancerId'] }
162
162
  background_servers = exec('slb', 'DescribeLoadBalancerAttribute', "--LoadBalancerId=#{lb['LoadBalancerId']}", **options)['BackendServers']['BackendServer']
@@ -254,11 +254,11 @@ module Aly
254
254
  end
255
255
 
256
256
  def show(*args, **options)
257
- @slb ||= exec('slb', 'DescribeLoadBalancers', '--pager', **options)['LoadBalancers']['LoadBalancer']
257
+ @slb ||= exec('slb', 'DescribeLoadBalancers', '--pager', **options)['LoadBalancers']['LoadBalancer'] || []
258
258
 
259
- @eip ||= exec('vpc', 'DescribeEipAddresses', '--PageSize=100', **options)['EipAddresses']['EipAddress']
259
+ @eip ||= exec('vpc', 'DescribeEipAddresses', '--PageSize=100', **options)['EipAddresses']['EipAddress'] || []
260
260
  unless @ecs
261
- @ecs = exec('ecs', 'DescribeInstances', '--pager', **options)['Instances']['Instance']
261
+ @ecs = exec('ecs', 'DescribeInstances', '--pager', **options)['Instances']['Instance'] || []
262
262
  @ecs.each do |item|
263
263
  item['PrivateIP'] = (item['NetworkInterfaces']['NetworkInterface'] || []).map { |ni| ni['PrimaryIpAddress'] }
264
264
  item['PublicIP'] = []
data/lib/aly/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aly
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-10 00:00:00.000000000 Z
11
+ date: 2022-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor