Skip to content

Commit

Permalink
Use proper yaml for the mongod config
Browse files Browse the repository at this point in the history
  • Loading branch information
h-haaks committed Apr 9, 2024
1 parent 70dac73 commit fd4c664
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
5 changes: 2 additions & 3 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
with_group('root').
with_content(%r{^storage\.dbPath: #{db_path}$}).
with_content(%r{^net\.bindIp: 127\.0\.0\.1$}).
with_content(%r{^systemLog\.logAppend: true$}).
with_content(%r{^systemLog\.path: #{log_path}$}).
with_content(%r{systemLog:\n\s*destination: file\n\s*path: "#{log_path}"\n\s*logAppend: true\n}m).
without_content(%r{^storage\.journal\.enabled:})
end

Expand Down Expand Up @@ -340,7 +339,7 @@
}
end

it { is_expected.to contain_file(config_file).with_content(%r{^systemLog\.destination: syslog$}) }
it { is_expected.to contain_file(config_file).with_content(%r{systemLog:\n\s*destination: syslog\n}m) }
end
end

Expand Down
33 changes: 17 additions & 16 deletions templates/mongodb.conf.erb
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
#mongodb.conf - generated from Puppet

#System Log

<% config_hash = {} -%>
<% if @syslog || @logpath || @logappend || @system_logrotate || !@verbose.nil? || @verbositylevel -%>
<% config_hash['systemLog'] = {} -%>
<% if @syslog -%>
systemLog.destination: syslog
<% config_hash['systemLog']['destination'] = 'syslog' -%>
<% elsif @logpath -%>
systemLog.path: <%= @logpath %>
systemLog.destination: file
<% config_hash['systemLog']['destination'] = 'file' -%>
<% config_hash['systemLog']['path'] = @logpath -%>
<% if @logappend -%>
systemLog.logAppend: <%= @logappend %>
<% config_hash['systemLog']['logAppend'] = @logappend -%>
<% end -%>
<% if @system_logrotate -%>
systemLog.logRotate: <%= @system_logrotate %>
<% config_hash['systemLog']['logRotate'] = @system_logrotate -%>
<% end -%>
<% end -%>
<% if @verbose -%>
systemLog.quiet: false
<% else -%>
systemLog.quiet: true
<% if !@verbose.nil? -%>
<% config_hash['systemLog']['quiet'] = @verbose -%>
<% end -%>
<% if @verbositylevel == "v" -%>
systemLog.verbosity: 1
<% config_hash['systemLog']['verbosity'] = 1 -%>
<% elsif @verbositylevel == "vv" -%>
systemLog.verbosity: 2
<% config_hash['systemLog']['verbosity'] = 2 -%>
<% elsif @verbositylevel == "vvv" -%>
systemLog.verbosity: 3
<% config_hash['systemLog']['verbosity'] = 3 -%>
<% elsif @verbositylevel == "vvvv" -%>
systemLog.verbosity: 4
<% config_hash['systemLog']['verbosity'] = 4 -%>
<% elsif @verbositylevel == "vvvvv" -%>
systemLog.verbosity: 5
<% config_hash['systemLog']['verbosity'] = 5 -%>
<% end -%>
<% end -%>
<%= config_hash.to_yaml() -%>

#Process Management
<% if @fork or @pidfilepath -%>
Expand Down

0 comments on commit fd4c664

Please sign in to comment.