@@ -205,34 +205,38 @@ def self.fetch_worker_settings_from_options_hash(options_hash, raw = false)
205205 classes . each do |c |
206206 section = section [ c ]
207207 raise _ ( "Missing config section %{section_name}" ) % { :section_name => c } if section . nil?
208+
208209 defaults = section [ :defaults ]
209210 unless defaults . nil?
210- defaults . delete_if { | k , v | v == Vmdb ::Settings ::RESET_VALUE }
211+ defaults . delete_if { | _k , v | v == Vmdb ::Settings ::RESET_VALUE }
211212 settings . merge! ( defaults )
212213 end
213214 end
214215
215- section . delete_if { | k , v | v == Vmdb ::Settings ::RESET_VALUE }
216+ section . delete_if { | _k , v | v == Vmdb ::Settings ::RESET_VALUE }
216217 settings . merge! ( section )
218+ normalize_settings! ( settings ) unless raw == true
219+ end
217220
218- # If not specified, provide the worker_settings cleaned up in fixnums, etc. instead of 1.seconds, 10.megabytes
219- # Clean up the configuration values in a format like "30.seconds"
220- unless raw == true
221- settings . keys . each do |k |
222- if settings [ k ] . kind_of? ( String )
223- if settings [ k ] . number_with_method?
224- settings [ k ] = settings [ k ] . to_i_with_method
225- elsif settings [ k ] =~ /\A \d +(.\d +)?\z / # case where int/float saved as string
226- settings [ k ] = settings [ k ] . to_i
227- elsif ManageIQ ::Password . encrypted? ( settings [ k ] )
228- settings [ k ] = ManageIQ ::Password . decrypt ( settings [ k ] )
229- end
230- end
221+ settings
222+ end
223+
224+ # If not specified, provide the worker_settings cleaned up in fixnums, etc. instead of 1.seconds, 10.megabytes
225+ # and decrypt any values which are encrypted with ManageIQ::Password.
226+ def self . normalize_settings! ( settings )
227+ settings . each_key do |k |
228+ if settings [ k ] . kind_of? ( String )
229+ if settings [ k ] . number_with_method?
230+ settings [ k ] = settings [ k ] . to_i_with_method
231+ elsif settings [ k ] . match? ( /\A \d +(.\d +)?\z / ) # case where int/float saved as string
232+ settings [ k ] = settings [ k ] . to_i
233+ elsif ManageIQ ::Password . encrypted? ( settings [ k ] )
234+ settings [ k ] = ManageIQ ::Password . decrypt ( settings [ k ] )
231235 end
232236 end
233237 end
234- settings
235238 end
239+ private_class_method :normalize_settings!
236240
237241 def worker_settings ( options = { } )
238242 self . class . fetch_worker_settings_from_server ( miq_server , options )
0 commit comments