Просмотр исходного кода

setup relationships has a todo

Chris Mague 7 лет назад
Родитель
Сommit
1d111684ba
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      lib/neoinfra/aws.rb

+ 12 - 0
lib/neoinfra/aws.rb

@@ -172,6 +172,18 @@ module NeoInfra
                       )
                       rl.save
                     end
+                    # TODO: remove duplicate Relationships
+                    SecurityGroupsIpRules.create(
+                      from_node: SecurityGroup.where(sg_id: grp.group_id).first,
+                      to_node: IpRules.where(
+                        cidr_block: r['cidrIp'],
+                        direction: 'ingress',
+                        proto: iprule['ipProtocol'],
+                        to_port: to_port,
+                        from_port: from_port,
+                        private: RFC_1918.any? { |rfc| rfc.include?(IPAddr.new(r['cidrIp']))}
+                      ).first
+                    )
                   end
                 end
               end