Project

General

Profile

« Previous | Next » 

Revision 654d7fe2

Added by William Clark over 1 year ago

Refs #35607 - convert telemetry value to python

View differences:

spec/acceptance/settings_spec.rb
require 'spec_helper_acceptance'
describe 'TELEMETRY setting' do
context 'default TELEMETRY' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
include pulpcore
PUPPET
end
end
describe file('/etc/pulp/settings.py') do
it { is_expected.to be_file }
its(:content) { is_expected.to match(/^# TELEMETRY = False$/) }
end
end
context 'TELEMETRY disabled' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'pulpcore':
telemetry => false,
}
PUPPET
end
end
describe file('/etc/pulp/settings.py') do
it { is_expected.to be_file }
its(:content) { is_expected.to match(/^TELEMETRY = False$/) }
end
end
context 'TELEMETRY enabled' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'pulpcore':
telemetry => true,
}
PUPPET
end
end
describe file('/etc/pulp/settings.py') do
it { is_expected.to be_file }
its(:content) { is_expected.to match(/^TELEMETRY = True$/) }
end
end
end
templates/settings.py.erb
<% if scope['pulpcore::telemetry'].nil? -%>
# TELEMETRY = False
<% else -%>
TELEMETRY = <%= scope['pulpcore::telemetry'] %>
TELEMETRY = <%= scope.call_function('to_python', [scope['pulpcore::telemetry']]) %>
<% end -%>
CONTENT_HOST = "<%= scope['pulpcore::servername'] %>"

Also available in: Unified diff