2 describe 'apt::ppa', :type => :define do
10 :lsbdistrelease => '11.04',
11 :lsbdistcodename => 'natty',
12 :operatingsystem => 'Ubuntu',
13 :osfamily => 'Debian',
14 :lsbdistid => 'Ubuntu',
18 let(:title) { 'ppa:needs/such.substitution/wow' }
19 it { is_expected.to_not contain_package('python-software-properties') }
20 it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Exec[apt_update]').with({
22 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
23 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
25 'logoutput' => 'on_failure',
30 describe 'apt included, no proxy' do
36 :lsbdistrelease => '14.04',
37 :lsbdistcodename => 'trusty',
38 :operatingsystem => 'Ubuntu',
39 :lsbdistid => 'Ubuntu',
40 :osfamily => 'Debian',
46 'package_manage' => true,
49 let(:title) { 'ppa:foo' }
50 it { is_expected.to contain_package('software-properties-common') }
51 it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Exec[apt_update]').with({
53 'command' => '/usr/bin/add-apt-repository ppa:foo',
54 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
56 'logoutput' => 'on_failure',
61 describe 'apt included, proxy host' do
67 :lsbdistrelease => '14.04',
68 :lsbdistcodename => 'trusty',
69 :operatingsystem => 'Ubuntu',
70 :lsbdistid => 'Ubuntu',
71 :osfamily => 'Debian',
77 'package_manage' => true,
78 'proxy' => { 'host' => 'localhost', }
81 let(:title) { 'ppa:foo' }
82 it { is_expected.to contain_package('software-properties-common') }
83 it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Exec[apt_update]').with({
84 'environment' => ['http_proxy=http://localhost:8080', 'https_proxy=http://localhost:8080'],
85 'command' => '/usr/bin/add-apt-repository ppa:foo',
86 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
88 'logoutput' => 'on_failure',
93 describe 'apt included, proxy host and port' do
99 :lsbdistrelease => '14.04',
100 :lsbdistcodename => 'trusty',
101 :operatingsystem => 'Ubuntu',
102 :lsbdistid => 'Ubuntu',
103 :osfamily => 'Debian',
109 'package_manage' => true,
110 'proxy' => { 'host' => 'localhost', 'port' => 8180, }
113 let(:title) { 'ppa:foo' }
114 it { is_expected.to contain_package('software-properties-common') }
115 it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Exec[apt_update]').with({
116 'environment' => ['http_proxy=http://localhost:8180', 'https_proxy=http://localhost:8180'],
117 'command' => '/usr/bin/add-apt-repository ppa:foo',
118 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
120 'logoutput' => 'on_failure',
125 describe 'ensure absent' do
126 let :pre_condition do
131 :lsbdistrelease => '14.04',
132 :lsbdistcodename => 'trusty',
133 :operatingsystem => 'Ubuntu',
134 :lsbdistid => 'Ubuntu',
135 :osfamily => 'Debian',
138 let(:title) { 'ppa:foo' }
144 it { is_expected.to contain_file('/etc/apt/sources.list.d/foo-trusty.list').that_notifies('Exec[apt_update]').with({
145 'ensure' => 'absent',
150 context 'validation' do
151 describe 'no release' do
154 :lsbdistrelease => '14.04',
155 :operatingsystem => 'Ubuntu',
156 :lsbdistid => 'Ubuntu',
157 :osfamily => 'Debian',
160 let(:title) { 'ppa:foo' }
163 is_expected.to compile
164 }.to raise_error(Puppet::Error, /lsbdistcodename fact not available: release parameter required/)
168 describe 'not ubuntu' do
171 :lsbdistrelease => '14.04',
172 :lsbdistcodename => 'trusty',
173 :operatingsystem => 'Debian',
174 :lsbdistid => 'Ubuntu',
175 :osfamily => 'Debian',
178 let(:title) { 'ppa:foo' }
181 is_expected.to compile
182 }.to raise_error(Puppet::Error, /apt::ppa is currently supported on Ubuntu only./)