Module: Puppet::Network::Uri

Included in:
ModuleTool::Applications::Installer
Defined in:
lib/puppet/network/uri.rb

Overview

This module holds funtions for network URI’s

Instance Method Summary collapse

Instance Method Details

#mask_credentials(uri) ⇒ String

Mask credentials in given URI or address as string. Resulting string will contain ‘***’ in place of password. It will only be replaced if actual password is given.

Parameters:

  • uri (URI|String)

    an uri or address to be masked

Returns:

  • (String)

    a masked url



11
12
13
14
15
16
17
18
19
# File 'lib/puppet/network/uri.rb', line 11

def mask_credentials(uri)
  if uri.is_a? URI
    uri = uri.dup
  else
    uri = URI.parse(uri)
  end
  uri.password = '***' unless uri.password.nil?
  uri.to_s
end