diff --git a/lib/fog/aws/compute.rb b/lib/fog/aws/compute.rb index c932012a1..51d5ce9ae 100644 --- a/lib/fog/aws/compute.rb +++ b/lib/fog/aws/compute.rb @@ -9,6 +9,8 @@ module Fog requires :aws_access_key_id, :aws_secret_access_key recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, :aws_session_token, :use_iam_profile, :aws_credentials_expire_at + secrets :aws_secret_access_key, :hmac, :aws_session_token + model_path 'fog/aws/models/compute' model :address collection :addresses diff --git a/lib/fog/aws/storage.rb b/lib/fog/aws/storage.rb index 257d9eeb4..ec595bd55 100644 --- a/lib/fog/aws/storage.rb +++ b/lib/fog/aws/storage.rb @@ -9,6 +9,8 @@ module Fog requires :aws_access_key_id, :aws_secret_access_key recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at + secrets :aws_secret_access_key, :hmac + model_path 'fog/aws/models/storage' collection :directories model :directory diff --git a/lib/fog/core/service.rb b/lib/fog/core/service.rb index 3fb97b45a..7fc7138b3 100644 --- a/lib/fog/core/service.rb +++ b/lib/fog/core/service.rb @@ -9,6 +9,12 @@ module Fog class Error < Fog::Errors::Error; end class NotFound < Fog::Errors::NotFound; end + module NoLeakInspector + def inspect + "#<#{self.class}:#{self.object_id} #{(self.instance_variables - service.secrets).map {|iv| [iv, self.instance_variable_get(iv).inspect].join('=')}.join(' ')}>" + end + end + module Collections def collections @@ -58,6 +64,7 @@ module Fog service::Mock.new(options) else service::Real.send(:include, service::Collections) + service::Real.send(:include, service::NoLeakInspector) service::Real.new(options) end end @@ -163,6 +170,16 @@ module Fog @requests ||= [] end + def secrets(*args) + if args.empty? + @secrets ||= [] + else + args.inject(secrets) do |secrets, secret| + secrets << "@#{secret}".to_sym + end + end + end + def requires(*args) requirements.concat(args) end diff --git a/lib/fog/hp/compute.rb b/lib/fog/hp/compute.rb index d55be8813..f0526be83 100644 --- a/lib/fog/hp/compute.rb +++ b/lib/fog/hp/compute.rb @@ -8,6 +8,8 @@ module Fog requires :hp_secret_key, :hp_account_id, :hp_tenant_id recognizes :hp_auth_uri, :hp_servicenet, :persistent, :connection_options, :hp_use_upass_auth_style, :hp_auth_version, :hp_avl_zone + secrets :hp_secret_key + model_path 'fog/hp/models/compute' model :address collection :addresses