Sha256: 615f7edbedc324786e9d93aae9094c2ad0d11c8dc208038b12536f9ab95ff78f
Contents?: true
Size: 1.01 KB
Versions: 15
Compression:
Stored size: 1.01 KB
Contents
require 'open3' module Brillo module Helpers module ExecHelper def execute *command command_string = Array(command).join(' ') log_anonymized command_string stdout, stderr, status = Open3.capture3 command_string [status.success?, stdout, stderr] end def execute! *command success, stdout, stderr = execute(command) if success [success, stdout, stderr] else raise RuntimeError, "#{stdout} #{stderr}" end end private def log_anonymized command_string command_string = command_string.gsub(/PGPASSWORD=[^\s]+/, "PGPASSWORD={FILTERED}") command_string = command_string.gsub(/--password=[^\s]+/, "--password={FILTERED}") command_string = command_string.gsub(/EC2_ACCESS_KEY=[^\s]+/, "EC2_ACCESS_KEY={FILTERED}") command_string = command_string.gsub(/EC2_SECRET_KEY=[^\s]+/, "EC2_SECRET_KEY={FILTERED}") logger.info "Running \n\t #{command_string}" end end end end
Version data entries
15 entries across 15 versions & 1 rubygems