mappru 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/mappru +5 -4
- data/lib/mappru/driver.rb +0 -1
- data/lib/mappru/exporter.rb +6 -2
- data/lib/mappru/version.rb +1 -1
- data/lib/mappru.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dc8eb3b82ed3ed02195af6fd449f315b525b164
|
4
|
+
data.tar.gz: 643e6d69321a42e687cd9fd3704966d849c10ec9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a107a38dc9bf505e63f42808855288c78244f9ae829a1ab3a232c2a8d14d4a101cc528e0b24279915daf1a38c2960060e174660598d327ee09cd78f5413681
|
7
|
+
data.tar.gz: 54464a727881e6682f86d151efc3e14ec1bdb285db3811c827753c4779f23550a95d2ba6a07dc7fac011ce48bd343a7293c81ba1c4e3aab193cb440f9ead2241
|
data/exe/mappru
CHANGED
@@ -91,13 +91,14 @@ def run_export(client, options)
|
|
91
91
|
requires = []
|
92
92
|
|
93
93
|
exported.each do |vpc_id, rts|
|
94
|
-
|
95
|
-
|
94
|
+
vpc_dir_basename = client.vpc_name_by_id(vpc_id) || vpc_id
|
95
|
+
vpc_dir_basename.gsub(/\s+/, '_')
|
96
|
+
vpc_dir = File.join(dir, vpc_dir_basename)
|
96
97
|
FileUtils.mkdir_p(vpc_dir)
|
97
98
|
|
98
99
|
rts.each do |rt_name, attrs|
|
99
|
-
filename = "#{rt_name}.rtbl"
|
100
|
-
requires << File.join(
|
100
|
+
filename = "#{rt_name}.rtbl".gsub(/\s+/, '_')
|
101
|
+
requires << File.join(vpc_dir_basename, filename)
|
101
102
|
rt_file = File.join(vpc_dir, filename)
|
102
103
|
|
103
104
|
logger.info(" write `#{rt_file}`")
|
data/lib/mappru/driver.rb
CHANGED
@@ -70,7 +70,6 @@ class Mappru::Driver
|
|
70
70
|
log(:info, "Update Route `#{vpc_id}` > `#{rt_name}` > `#{dest_cidr}`", color: :green)
|
71
71
|
log(:info, diff(old_route, route, color: @options[:color]), color: false)
|
72
72
|
|
73
|
-
|
74
73
|
unless @options[:dry_run]
|
75
74
|
rt_id = rt_id_by_vpc_rt_name.fetch(vpc_id).fetch(rt_name)
|
76
75
|
params = route.merge(route_table_id: rt_id, destination_cidr_block: dest_cidr)
|
data/lib/mappru/exporter.rb
CHANGED
@@ -55,7 +55,11 @@ class Mappru::Exporter
|
|
55
55
|
|
56
56
|
# route -> (Array<Route>, nil)
|
57
57
|
# http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/RouteTable.html#routes-instance_method
|
58
|
-
rt.routes.reject(&:nil?).
|
58
|
+
sorted_routes = rt.routes.reject(&:nil?).sort_by do |route|
|
59
|
+
IPAddr.new(route.destination_cidr_block).to_i
|
60
|
+
end
|
61
|
+
|
62
|
+
sorted_routes.each do |route|
|
59
63
|
# Skip "local"
|
60
64
|
next if route.gateway_id == 'local'
|
61
65
|
|
@@ -72,7 +76,7 @@ class Mappru::Exporter
|
|
72
76
|
].each {|k| hash[k] = route.send(k) }
|
73
77
|
|
74
78
|
result[:routes] << hash
|
75
|
-
|
79
|
+
end
|
76
80
|
|
77
81
|
result
|
78
82
|
end
|
data/lib/mappru/version.rb
CHANGED
data/lib/mappru.rb
CHANGED