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 'ppa depending on ppa, MODULES-1156' do
62 describe 'package_name => software-properties-common' do
68 package_name: 'software-properties-common',
74 os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } },
75 lsbdistrelease: '11.04',
76 lsbdistcodename: 'natty',
77 operatingsystem: 'Ubuntu',
80 puppetversion: Puppet.version,
84 let(:title) { 'ppa:needs/such.substitution/wow' }
86 it { is_expected.to contain_package('software-properties-common') }
88 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
89 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow', # rubocop:disable Metrics/LineLength
90 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', # rubocop:disable Metrics/LineLength
92 'logoutput' => 'on_failure')
96 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')
100 describe 'package_manage => true, multiple ppas, MODULES-2873' do
101 let :pre_condition do
103 apt::ppa {"ppa:user/foo":
104 package_manage => true
109 os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } },
110 lsbdistrelease: '11.04',
111 lsbdistcodename: 'natty',
112 operatingsystem: 'Ubuntu',
115 puppetversion: Puppet.version,
120 package_manage: true,
124 let(:title) { 'ppa:user/bar' }
126 it { is_expected.to contain_package('python-software-properties') }
128 is_expected.to contain_exec('add-apt-repository-ppa:user/bar').that_notifies('Class[Apt::Update]').with('environment' => [],
129 'command' => '/usr/bin/add-apt-repository -y ppa:user/bar',
130 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/user-bar-natty.list',
132 'logoutput' => 'on_failure')
136 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')
140 describe 'package_manage => false' do
141 let :pre_condition do
146 os: { family: 'Debian', name: 'Ubuntu', release: { major: '11', full: '11.04' } },
147 lsbdistrelease: '11.04',
148 lsbdistcodename: 'natty',
149 operatingsystem: 'Ubuntu',
152 puppetversion: Puppet.version,
157 package_manage: false,
161 let(:title) { 'ppa:needs/such.substitution/wow' }
163 it { is_expected.not_to contain_package('python-software-properties') }
165 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
166 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow', # rubocop:disable Metrics/LineLength
167 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list', # rubocop:disable Metrics/LineLength
169 'logoutput' => 'on_failure')
173 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')
177 describe 'apt included, no proxy' do
178 let :pre_condition do
180 apt::ppa { "ppa:user/foo2": }
185 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
186 lsbdistrelease: '14.04',
187 lsbdistcodename: 'trusty',
188 operatingsystem: 'Ubuntu',
191 puppetversion: Puppet.version,
197 package_manage: true,
198 require: 'Apt::Ppa[ppa:user/foo2]',
201 let(:title) { 'ppa:user/foo' }
203 it { is_expected.to compile.with_all_deps }
204 it { is_expected.to contain_package('software-properties-common') }
206 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: [],
207 command: '/usr/bin/add-apt-repository ppa:user/foo',
208 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
210 logoutput: 'on_failure')
214 describe 'apt included, proxy host' do
215 let :pre_condition do
217 proxy => { "host" => "localhost" },
222 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
223 lsbdistrelease: '14.04',
224 lsbdistcodename: 'trusty',
225 operatingsystem: 'Ubuntu',
228 puppetversion: Puppet.version,
234 'package_manage' => true,
237 let(:title) { 'ppa:user/foo' }
239 it { is_expected.to contain_package('software-properties-common') }
241 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8080'],
242 command: '/usr/bin/add-apt-repository ppa:user/foo',
243 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
245 logoutput: 'on_failure')
249 describe 'apt included, proxy host and port' do
250 let :pre_condition do
252 proxy => { "host" => "localhost", "port" => 8180 },
257 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
258 lsbdistrelease: '14.04',
259 lsbdistcodename: 'trusty',
260 operatingsystem: 'Ubuntu',
263 puppetversion: Puppet.version,
269 package_manage: true,
272 let(:title) { 'ppa:user/foo' }
274 it { is_expected.to contain_package('software-properties-common') }
276 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8180'],
277 command: '/usr/bin/add-apt-repository ppa:user/foo',
278 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
280 logoutput: 'on_failure')
284 describe 'apt included, proxy host and port and https' do
285 let :pre_condition do
287 proxy => { "host" => "localhost", "port" => 8180, "https" => true },
292 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
293 lsbdistrelease: '14.04',
294 lsbdistcodename: 'trusty',
295 operatingsystem: 'Ubuntu',
298 puppetversion: Puppet.version,
304 package_manage: true,
307 let(:title) { 'ppa:user/foo' }
309 it { is_expected.to contain_package('software-properties-common') }
311 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'],
312 command: '/usr/bin/add-apt-repository ppa:user/foo',
313 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
315 logoutput: 'on_failure')
319 describe 'ensure absent' do
320 let :pre_condition do
325 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
326 lsbdistrelease: '14.04',
327 lsbdistcodename: 'trusty',
328 operatingsystem: 'Ubuntu',
331 puppetversion: Puppet.version,
334 let(:title) { 'ppa:user/foo' }
342 is_expected.to contain_file('/etc/apt/sources.list.d/user-foo-trusty.list').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
346 context 'validation' do
347 describe 'no release' do
350 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
351 lsbdistrelease: '14.04',
352 operatingsystem: 'Ubuntu',
355 lsbdistcodeanme: nil,
356 puppetversion: Puppet.version,
359 let(:title) { 'ppa:user/foo' }
364 }.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required})
368 describe 'not ubuntu' do
371 os: { family: 'Debian', name: 'Debian', release: { major: '6', full: '6.0.7' } },
372 lsbdistrelease: '6.0.7',
373 lsbdistcodename: 'wheezy',
374 operatingsystem: 'Debian',
377 puppetversion: Puppet.version,
380 let(:title) { 'ppa:user/foo' }
385 }.to raise_error(Puppet::Error, %r{not currently supported on Debian})