sfn 2.1.8 → 2.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 610903a7a6be9347a5c0d51bff46e3eba9239e28
4
- data.tar.gz: 0aacd95b68b649c70416a02c77c8bf06d60072cf
3
+ metadata.gz: be1b4ec736e954ea46336a4a6e3a957c8331a450
4
+ data.tar.gz: a62b4144c909edaeaa66e0c871ed6fe23e66934b
5
5
  SHA512:
6
- metadata.gz: 3cce4831036082b7f85c80e7d29b9d71aff2ae54b645830030126732642edfac1c10fd3e3a9e36f8bc889666cfd3bdc98f1c1113f948f3d6bc61310834cea2b9
7
- data.tar.gz: bb744d8e3639da9440321c325f1f70ce593fa0e748795e0f4184e7dd9ec492345b85956755c83fcafac2227bfdb54b7a45e399715e767b521ca58d7533fb5185
6
+ metadata.gz: a8a4930dc3f88d29f9c277cd40037fbb8e7b8fae0f21efe709271bde0ec9afec7a968cf50aed21dd708488ba3a3a3883e6d2b66a048479ef90dce3100095ba59
7
+ data.tar.gz: 6ad2aba6a8d844eb5984e5c147a0ec0bc11bcd4f29838d72df2ea4dc96ad61d47a2acf594b9194953f68e2f18beeb0ed19e765ad45e65462bf9327e2fdafb454
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v2.1.10
2
+ * [fix] Prevent direct output key modification on graph mapping
3
+ * [enhancement] Restrict graph colors to readable values
4
+
1
5
  # v2.1.8
2
6
  * [fix] Fix some planner errors caused by unexpected types (#146)
3
7
  * [fix] Use common stack scrubbing implementation for create and update (#148)
@@ -25,6 +25,10 @@ module Sfn
25
25
  end
26
26
  run_action 'Pre-processing template for graphing' do
27
27
  output_discovery(file, @outputs, nil, nil)
28
+ ui.debug 'Output remapping results from pre-processing:'
29
+ @outputs.each_pair do |o_key, o_value|
30
+ ui.debug "#{o_key} -> #{o_value}"
31
+ end
28
32
  nil
29
33
  end
30
34
  graph = nil
@@ -73,6 +77,7 @@ module Sfn
73
77
  end
74
78
  end
75
79
  if(parent_template)
80
+ ui.debug "Pre-processing stack resource `#{resource_name}`"
76
81
  substack_parameters = Smash[
77
82
  parent_template.fetch('Resources', resource_name, 'Properties', 'Parameters', {}).map do |key, value|
78
83
  result = [key, value]
@@ -80,16 +85,21 @@ module Sfn
80
85
  v_key = value.keys.first
81
86
  v_value = value.values.first
82
87
  if(v_key == 'Fn::GetAtt' && parent_template.fetch('Resources', {}).keys.include?(v_value.first) && v_value.last.start_with?('Outputs.'))
83
- output_key = v_value.first << '__' << v_value.last.split('.', 2).last
88
+ output_key = v_value.first + '__' + v_value.last.split('.', 2).last
89
+ ui.debug "Output key for check: #{output_key}"
84
90
  if(outputs.key?(output_key))
85
91
  new_value = outputs[output_key]
86
92
  result = [key, new_value]
93
+ ui.debug "Parameter for output swap `#{key}`: #{value} -> #{new_value}"
87
94
  end
88
95
  end
89
96
  end
90
97
  result
91
98
  end
92
99
  ]
100
+
101
+ ui.debug "Generated internal parameters for `#{resource_name}`: #{substack_parameters}"
102
+
93
103
  processor = GraphProcessor.new({},
94
104
  :parameters => substack_parameters
95
105
  )
@@ -143,7 +153,7 @@ module Sfn
143
153
  )
144
154
  next
145
155
  else
146
- graph.node(node_name).attributes << graph.fillcolor(colorize(node_prefix).inspect)
156
+ graph.node(node_name).attributes << graph.fillcolor(colorize(node_prefix.empty? ? config[:file] : node_prefix).inspect)
147
157
  graph.box3d << graph.node(node_name)
148
158
  end
149
159
  graph.filled << graph.node(node_name)
@@ -182,11 +192,21 @@ module Sfn
182
192
 
183
193
  def colorize(string)
184
194
  hash = string.chars.inject(0) do |memo, chr|
185
- chr.ord + ((memo << 5) - memo)
195
+ if(memo + chr.ord > 127)
196
+ (memo - chr.ord).abs
197
+ else
198
+ memo + chr.ord
199
+ end
186
200
  end
187
201
  color = '#'
188
- 6.times do |count|
189
- color << ('00' + ((hash >> count * 8) & 0xFF).to_s(16)).slice(-2)
202
+ 3.times do |i|
203
+ color << (255 ^ hash).to_s(16)
204
+ new_val = hash + (hash * (1 / (i + 1.to_f))).to_i
205
+ if(hash * (i + 1) < 127)
206
+ hash = new_val
207
+ else
208
+ hash = hash / (i + 1)
209
+ end
190
210
  end
191
211
  color
192
212
  end
data/lib/sfn/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Sfn
2
2
  # Current library version
3
- VERSION = Gem::Version.new('2.1.8')
3
+ VERSION = Gem::Version.new('2.1.10')
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts