Ver código fonte

temporarily handle inablity to list ec2 classic

Chris Mague 6 anos atrás
pai
commit
05ebb82bfc
1 arquivos alterados com 7 adições e 1 exclusões
  1. 7 1
      lib/neoinfra/vpcs.rb

+ 7 - 1
lib/neoinfra/vpcs.rb

@@ -26,7 +26,13 @@ module NeoInfra
 
     def list_vpcs
       node_counts = Hash.new(0)
-      Node.all.each { |x| node_counts[x.subnet.subnet.name] += 1 }
+      Node.all.each do |x|
+        begin
+          node_counts[x.subnet.subnet.name] += 1
+        rescue
+          foo = "noop"
+        end
+      end
       Vpc.all.collect { |x| { 'nodes' => node_counts[x.name], 'vpc_id' => x.vpc_id, 'name' => x.name, 'region' => x.region.region, 'owner' => x.owned.name, 'cidr' => x.cidr, 'default' => x.default } }.select { |y| y['default'] == 'false' }.sort_by { |h| h['nodes'] }.reverse
     end