فهرست منبع

add in exceptions as eu-west-3 is unhappy

Chris Mague 7 سال پیش
والد
کامیت
68df684f25
3فایلهای تغییر یافته به همراه18 افزوده شده و 3 حذف شده
  1. 6 1
      lib/neoinfra/aws.rb
  2. 6 1
      lib/neoinfra/nodes.rb
  3. 6 1
      lib/neoinfra/vpcs.rb

+ 6 - 1
lib/neoinfra/aws.rb

@@ -130,7 +130,12 @@ module NeoInfra
         }
         self.regions.each do |region|
           region_conf = { region: region }
-          conn = Fog::Compute.new(region_conf.merge(base_conf))
+          begin
+            conn = Fog::Compute.new(region_conf.merge(base_conf))
+          rescue
+            puts "Error loading security groups for region #{region}"
+            next
+          end
           conn.security_groups.all.each do |grp|
             if SecurityGroup.where(sg_id: grp.group_id).empty?
               g = SecurityGroup.new(

+ 6 - 1
lib/neoinfra/nodes.rb

@@ -59,7 +59,12 @@ module NeoInfra
         }
         aws.regions.each do |region|
           region_conf = { region: region }
-          new_conn = Fog::Compute.new(region_conf.merge(base_conf))
+          begin
+            new_conn = Fog::Compute.new(region_conf.merge(base_conf))
+          rescue
+            puts "Error loading nodes in region: #{region}"
+            next
+          end
           new_conn.servers.all.each do |ec2|
             if SshKey.where(name: ec2.key_name).empty?
               s = SshKey.new(

+ 6 - 1
lib/neoinfra/vpcs.rb

@@ -41,7 +41,12 @@ module NeoInfra
         }
         aws.regions.each do |region|
           region_conf = { region: region }
-          new_conn = Fog::Compute.new(region_conf.merge(base_conf))
+          begin
+            new_conn = Fog::Compute.new(region_conf.merge(base_conf))
+          rescue
+            puts "Error loading VPCs in region: #{region}"
+            next
+          end
           # Get VPCs
           new_conn.vpcs.all.each do |vpc|
             next unless Vpc.where(vpc_id: vpc.id).empty?