Implement fancy progress bars configuration.
purge_sources_list => false,
purge_sources_list_d => false,
purge_preferences_d => false,
- update_timeout => undef
+ update_timeout => undef,
+ fancy_progress => undef
}
Puppet will manage your system's `sources.list` file and `sources.list.d` directory but will do its best to respect existing content.
$purge_preferences_d = false,
$update_timeout = undef,
$update_tries = undef,
- $sources = undef
+ $sources = undef,
+ $fancy_progress = undef
) {
if $::osfamily != 'Debian' {
recurse => $purge_preferences_d,
}
+ case $fancy_progress {
+ true: {
+ file { '99progressbar':
+ ensure => present,
+ content => 'Dpkg::Progress-Fancy "1";',
+ path => "${apt_conf_d}/99progressbar",
+ }
+ }
+ false: {
+ file { '99progressbar':
+ ensure => absent,
+ path => "${apt_conf_d}/99progressbar",
+ }
+ }
+ undef: {} # do nothing
+ default: { fail('Valid values for fancy_progress are true or false') }
+ }
+
case $disable_keys {
true: {
file { '99unauth':
end
end
+ context 'fancy_progress => true' do
+ it 'should work with no errors' do
+ pp = <<-EOS
+ class { 'apt': fancy_progress => true }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ describe file('/etc/apt/apt.conf.d/99progressbar') do
+ it { should be_file }
+ it { should contain 'Dpkg::Progress-Fancy "1";' }
+ end
+ end
+ context 'fancy_progress => false' do
+ it 'should work with no errors' do
+ pp = <<-EOS
+ class { 'apt': fancy_progress => false }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true)
+ end
+
+ describe file('/etc/apt/apt.conf.d/99progressbar') do
+ it { should_not be_file }
+ end
+ end
+
context 'reset' do
it 'fixes the sources.list' do
shell('cp /tmp/sources.list /etc/apt')