Module: Puppet::Util::MongodbOutput

Defined in:
lib/puppet/util/mongodb_output.rb

Class Method Summary collapse

Class Method Details

.sanitize(data) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/puppet/util/mongodb_output.rb', line 4

def self.sanitize(data)
  # Dirty hack to remove JavaScript objects
  data.gsub!(%r{\w+\((\d+).+?\)}, '\1') # Remove extra parameters from 'Timestamp(1462971623, 1)' Objects
  data.gsub!(%r{\w+\((.+?)\)}, '\1')

  data.gsub!(%r{^Error\:.+}, '')
  data.gsub!(%r{^.*warning\:.+}, '') # remove warnings if sslAllowInvalidHostnames is true
  data.gsub!(%r{^.*The server certificate does not match the host name.+}, '') # remove warnings if sslAllowInvalidHostnames is true mongo 3.x
  data
end