10 os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } },
11 lsbdistrelease: '11.04',
12 lsbdistcodename: 'natty',
13 operatingsystem: 'Ubuntu',
16 puppetversion: Puppet.version,
20 let(:title) { 'ppa:needs/such.substitution/wow+type' }
22 it { is_expected.not_to contain_package('python-software-properties') }
24 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow+type').that_notifies('Class[Apt::Update]').with(environment: [],
25 command: '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow+type', # rubocop:disable Metrics/LineLength
26 unless: '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow_type-natty.list', # rubocop:disable Metrics/LineLength
28 logoutput: 'on_failure')
32 describe 'Ubuntu 15.10 sources.list filename' do
35 os: { family: 'Debian', name: 'Ubuntu', release: { major: '15', full: '15.10' } },
36 lsbdistrelease: '15.10',
37 lsbdistcodename: 'wily',
38 operatingsystem: 'Ubuntu',
41 puppetversion: Puppet.version,
45 let(:title) { 'ppa:user/foo' }
48 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: [],
49 command: '/usr/bin/add-apt-repository -y ppa:user/foo',
50 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-ubuntu-foo-wily.list',
52 logoutput: 'on_failure')
56 describe 'package_name => software-properties-common' do
62 package_name: 'software-properties-common',
68 os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } },
69 lsbdistrelease: '11.04',
70 lsbdistcodename: 'natty',
71 operatingsystem: 'Ubuntu',
74 puppetversion: Puppet.version,
78 let(:title) { 'ppa:needs/such.substitution/wow' }
80 it { is_expected.to contain_package('software-properties-common') }
82 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
83 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow', # rubocop:disable Metrics/LineLength
84 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', # rubocop:disable Metrics/LineLength
86 'logoutput' => 'on_failure')
90 is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-natty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file')
94 describe 'package_manage => true, multiple ppas, MODULES-2873' do
97 apt::ppa {"ppa:user/foo":
98 package_manage => true
103 os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } },
104 lsbdistrelease: '11.04',
105 lsbdistcodename: 'natty',
106 operatingsystem: 'Ubuntu',
109 puppetversion: Puppet.version,
114 package_manage: true,
118 let(:title) { 'ppa:user/bar' }
120 it { is_expected.to contain_package('python-software-properties') }
122 is_expected.to contain_exec('add-apt-repository-ppa:user/bar').that_notifies('Class[Apt::Update]').with('environment' => [],
123 'command' => '/usr/bin/add-apt-repository -y ppa:user/bar',
124 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/user-bar-natty.list',
126 'logoutput' => 'on_failure')
130 is_expected.to contain_file('/etc/apt/sources.list.d/user-bar-natty.list').that_requires('Exec[add-apt-repository-ppa:user/bar]').with('ensure' => 'file')
134 describe 'package_manage => false' do
135 let :pre_condition do
140 os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } },
141 lsbdistrelease: '11.04',
142 lsbdistcodename: 'natty',
143 operatingsystem: 'Ubuntu',
146 puppetversion: Puppet.version,
151 package_manage: false,
155 let(:title) { 'ppa:needs/such.substitution/wow' }
157 it { is_expected.not_to contain_package('python-software-properties') }
159 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
160 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow', # rubocop:disable Metrics/LineLength
161 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', # rubocop:disable Metrics/LineLength
163 'logoutput' => 'on_failure')
167 is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-natty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file')
171 describe 'apt included, no proxy' do
172 let :pre_condition do
174 apt::ppa { "ppa:user/foo2": }
179 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
180 lsbdistrelease: '14.04',
181 lsbdistcodename: 'trusty',
182 operatingsystem: 'Ubuntu',
185 puppetversion: Puppet.version,
191 package_manage: true,
192 require: 'Apt::Ppa[ppa:user/foo2]',
195 let(:title) { 'ppa:user/foo' }
197 it { is_expected.to compile.with_all_deps }
198 it { is_expected.to contain_package('software-properties-common') }
200 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: [],
201 command: '/usr/bin/add-apt-repository ppa:user/foo',
202 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
204 logoutput: 'on_failure')
208 describe 'apt included, proxy host' do
209 let :pre_condition do
211 proxy => { "host" => "localhost" },
216 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
217 lsbdistrelease: '14.04',
218 lsbdistcodename: 'trusty',
219 operatingsystem: 'Ubuntu',
222 puppetversion: Puppet.version,
228 'package_manage' => true,
231 let(:title) { 'ppa:user/foo' }
233 it { is_expected.to contain_package('software-properties-common') }
235 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8080'],
236 command: '/usr/bin/add-apt-repository ppa:user/foo',
237 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
239 logoutput: 'on_failure')
243 describe 'apt included, proxy host and port' do
244 let :pre_condition do
246 proxy => { "host" => "localhost", "port" => 8180 },
251 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
252 lsbdistrelease: '14.04',
253 lsbdistcodename: 'trusty',
254 operatingsystem: 'Ubuntu',
257 puppetversion: Puppet.version,
263 package_manage: true,
266 let(:title) { 'ppa:user/foo' }
268 it { is_expected.to contain_package('software-properties-common') }
270 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8180'],
271 command: '/usr/bin/add-apt-repository ppa:user/foo',
272 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
274 logoutput: 'on_failure')
278 describe 'apt included, proxy host and port and https' do
279 let :pre_condition do
281 proxy => { "host" => "localhost", "port" => 8180, "https" => true },
286 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
287 lsbdistrelease: '14.04',
288 lsbdistcodename: 'trusty',
289 operatingsystem: 'Ubuntu',
292 puppetversion: Puppet.version,
298 package_manage: true,
301 let(:title) { 'ppa:user/foo' }
303 it { is_expected.to contain_package('software-properties-common') }
305 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8180', 'https_proxy=https://localhost:8180'],
306 command: '/usr/bin/add-apt-repository ppa:user/foo',
307 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
309 logoutput: 'on_failure')
313 describe 'ensure absent' do
314 let :pre_condition do
319 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
320 lsbdistrelease: '14.04',
321 lsbdistcodename: 'trusty',
322 operatingsystem: 'Ubuntu',
325 puppetversion: Puppet.version,
328 let(:title) { 'ppa:user/foo' }
336 is_expected.to contain_file('/etc/apt/sources.list.d/user-foo-trusty.list').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
340 context 'validation' do
341 describe 'no release' do
344 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
345 lsbdistrelease: '14.04',
346 operatingsystem: 'Ubuntu',
349 lsbdistcodeanme: nil,
350 puppetversion: Puppet.version,
353 let(:title) { 'ppa:user/foo' }
356 is_expected.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required})
360 describe 'not ubuntu' do
363 os: { family: 'Debian', name: 'Debian', release: { major: '6', full: '6.0.7' } },
364 lsbdistrelease: '6.0.7',
365 lsbdistcodename: 'wheezy',
366 operatingsystem: 'Debian',
369 puppetversion: Puppet.version,
372 let(:title) { 'ppa:user/foo' }
375 is_expected.to raise_error(Puppet::Error, %r{not currently supported on Debian})