Skip to content

Commit

Permalink
Hide the password value in automate and evm.log.
Browse files Browse the repository at this point in the history
  • Loading branch information
lfu committed Sep 14, 2018
1 parent c9a6e98 commit b25ce0b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/miq_automation_engine/engine/miq_ae_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ module MiqAeEngine
DEFAULT_ATTRIBUTES = %w( User::user MiqServer::miq_server object_name )

def self.instantiate(uri, user)
$miq_ae_logger.info("MiqAeEngine: Instantiating Workspace for URI=#{uri}")
$miq_ae_logger.info("MiqAeEngine: Instantiating Workspace for URI=#{MiqPassword.sanitize_encoded_string(uri)}")
workspace, t = Benchmark.realtime_block(:total_time) { MiqAeWorkspaceRuntime.instantiate(uri, user) }
$miq_ae_logger.info("MiqAeEngine: Instantiating Workspace for URI=#{uri}...Complete - Counts: #{format_benchmark_counts(t)}, Timings: #{format_benchmark_times(t)}")
$miq_ae_logger.info("MiqAeEngine: Instantiating Workspace for URI=#{MiqPassword.sanitize_encoded_string(uri)}...Complete - Counts: #{format_benchmark_counts(t)}, Timings: #{format_benchmark_times(t)}")
workspace
end

Expand Down Expand Up @@ -78,7 +78,7 @@ def self.deliver(*args)
begin
miq_task&.state_active
object_name = "#{options[:object_type]}.#{options[:object_id]}"
_log.info("Delivering #{options[:attrs].inspect} for object [#{object_name}] with state [#{state}] to Automate")
_log.info("Delivering #{MiqPassword.sanitize_string(options[:attrs].inspect)} for object [#{object_name}] with state [#{state}] to Automate")
automate_attrs = automate_attrs_from_options(options)

if options[:object_type]
Expand All @@ -92,7 +92,7 @@ def self.deliver(*args)
ws = resolve_automation_object(uri, user_obj)

if ws.nil? || ws.root.nil?
message = "Error delivering #{options[:attrs].inspect} for object [#{object_name}] with state [#{state}] to Automate: Empty Workspace"
message = "Error delivering #{MiqPassword.sanitize_string(options[:attrs].inspect)} for object [#{object_name}] with state [#{state}] to Automate: Empty Workspace"
_log.error(message)
return nil
end
Expand All @@ -105,7 +105,7 @@ def self.deliver(*args)
deliver_on = Time.now.utc + ae_retry_interval
change_options_by_ws(options, ws)

message = "Requeuing #{options.inspect} for object [#{object_name}] with state [#{options[:state]}] to Automate for delivery in [#{ae_retry_interval}] seconds"
message = "Requeuing #{MiqPassword.sanitize_string(options.inspect)} for object [#{object_name}] with state [#{options[:state]}] to Automate for delivery in [#{ae_retry_interval}] seconds"
_log.info(message)
queue_options = {:deliver_on => deliver_on}
queue_options[:server_guid] = MiqServer.my_guid if ws.root['ae_retry_server_affinity']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def find_first_fq_domain(uri, ns, klass, instance, method)
if matching_domain
parts[0] = matching_domain
updated_ns = parts.join('/')
$miq_ae_logger.info("Updated namespace [#{uri} #{updated_ns}]")
$miq_ae_logger.info("Updated namespace [#{MiqPassword.sanitize_encoded_string(uri)} #{updated_ns}]")
end
updated_ns
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def varset(uri, value)
end

def instantiate(uri, user, root = nil)
$miq_ae_logger.info("Instantiating [#{uri}]") if root.nil?
$miq_ae_logger.info("Instantiating [#{MiqPassword.sanitize_encoded_string(uri)}]") if root.nil?
@ae_user = user
@dom_search.ae_user = user
scheme, userinfo, host, port, registry, path, opaque, query, fragment = MiqAeUri.split(uri, "miqaedb")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def disconnect_sql

def log(level, msg)
Thread.current["tracking_label"] = @tracking_label
$miq_ae_logger.send(level, "<AEMethod #{current_method}> #{msg}")
$miq_ae_logger.send(level, "<AEMethod #{current_method}> #{MiqPassword.sanitize_string(msg)}")
end

def set_state_var(name, value)
Expand Down

0 comments on commit b25ce0b

Please sign in to comment.