module Puppet::Network::Uri

This module holds funtions for network URI's

Public Instance Methods

mask_credentials(uri) click to toggle source

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.

@param uri [URI|String] an uri or address to be masked @return [String] a masked url

   # File lib/puppet/network/uri.rb
 9 def mask_credentials(uri)
10   if uri.is_a? URI
11     uri = uri.dup
12   else
13     uri = URI.parse(uri)
14   end
15   uri.password = '***' unless uri.password.nil?
16   uri.to_s
17 end