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
10 def mask_credentials(uri)
11   if uri.is_a? URI
12     uri = uri.dup
13   else
14     uri = URI.parse(uri)
15   end
16   uri.password = '***' unless uri.password.nil?
17   uri.to_s
18 end