Skip to content

Commit

Permalink
Add stable_lts recipe for the LTS repository
Browse files Browse the repository at this point in the history
Support Squeeze's "Long Term Support" repository: https://wiki.debian.org/LTS
Enabled by default on Squeeze.

Fixes #14
  • Loading branch information
Teemu Matilainen committed Jul 17, 2014
1 parent 4f58a9e commit 5844893
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 1.6.1 / _Not released yet_

Features:

- Add `stable_lts` recipe for the [Long Term Support](https://wiki.debian.org/LTS)
repository. Enabled by default on Squeeze. ([GH-14][])

# 1.6.0 / 2014-04-20

Expand Down Expand Up @@ -89,3 +93,4 @@ Features:
[GH-9]: https://github.com/reaktor/chef-debian/issues/9 "Issue 9"
[GH-10]: https://github.com/reaktor/chef-debian/issues/10 "Issue 10"
[GH-11]: https://github.com/reaktor/chef-debian/issues/11 "Issue 11"
[GH-14]: https://github.com/reaktor/chef-debian/issues/14 "Issue 14"
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ The other recipes configure apt to use the corresponding Debian repository:
* `security` - Sets up apt source for [Debian Security Updates]
(http://www.debian.org/security/) repository.
* `sid` - Alias for `unstable` recipe.
* `stable_lts` - Sets up apt source for [Debian Long Term Support]
(https://wiki.debian.org/LTS) repository.
* `stable_proposed_updates` - Sets up apt source for [Debian
stable-proposed-updates](http://wiki.debian.org/StableProposedUpdates)
repository and includes `stable_updates` recipe.
Expand Down Expand Up @@ -78,6 +80,7 @@ Attribute | Default
`node['debian']['backports']` | false
`node['debian']['backports_sloppy']` | false
`node['debian']['security']` | true
`node['debian']['stable_lts']` | true on Squeeze, false otherwise
`node['debian']['stable_proposed_updates']` | false
`node['debian']['stable_updates']` | true
`node['debian']['testing']` | false
Expand Down Expand Up @@ -164,6 +167,6 @@ License and Author

Author:: Teemu Matilainen <<teemu.matilainen@reaktor.fi>>

Copyright © 2011-2013, [Reaktor Innovations Oy](http://reaktor.fi/en)
Copyright © 2011-2014, [Reaktor Innovations Oy](http://reaktor.fi/)

Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE).
3 changes: 2 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Teemu Matilainen <teemu.matilainen@reaktor.fi>
#
# Copyright 2012-2013, Reaktor Innovations Oy
# Copyright 2012-2014, Reaktor Innovations Oy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -29,6 +29,7 @@
default['debian']['backports'] = false
default['debian']['backports_sloppy'] = false
default['debian']['security'] = true
default['debian']['stable_lts'] = (node['platform_version'].to_i < 7)
default['debian']['stable_proposed_updates'] = false
default['debian']['stable_updates'] = true
default['debian']['testing'] = false
Expand Down
12 changes: 10 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Teemu Matilainen <teemu.matilainen@reaktor.fi>
#
# Copyright 2011-2013, Reaktor Innovations Oy
# Copyright 2011-2014, Reaktor Innovations Oy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,6 +33,14 @@

include_recipe 'apt'

%w[backports backports_sloppy security stable_proposed_updates stable_updates testing unstable].each do |repo|
%w[
backports
backports_sloppy
security
stable_lts
stable_proposed_updates
stable_updates
testing unstable
].each do |repo|
include_recipe "debian::#{repo}" if node['debian'][repo]
end
29 changes: 29 additions & 0 deletions recipes/stable_lts.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Cookbook Name:: debian
# Recipe:: stable_lts
#
# Author:: Teemu Matilainen <teemu.matilainen@reaktor.fi>
#
# Copyright 2014, Reaktor Innovations Oy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

if node['platform_version'].to_i >= 7
Chef::Log.info "#{node['debian']['codename']}-lts does not exist yet"
Chef::Log.info "Please file an issue if I'm wrong: https://github.com/reaktor/chef-debian/issues"
else
debian_repository "stable-lts" do
distribution "#{node['debian']['codename']}-lts"
end
end
18 changes: 17 additions & 1 deletion spec/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,26 @@
end.converge 'debian::default'
end

it { should add_apt_source 'deb http://example.com/debian-mirror cheese resistor diode'; subject }
it { should add_apt_source 'deb http://example.com/debian-mirror cheese resistor diode' }
it { should add_apt_source 'deb-src http://example.com/debian-mirror cheese resistor diode' }
it { should include_recipe 'debian::backports' }
end

context 'Wheezy' do
subject do
debian_runner('7.0').converge('debian::default')
end

it { should_not include_recipe 'debian::stable_lts' }
end

context 'Squeeze' do
subject do
debian_runner('6.0.5').converge('debian::default')
end

it { should include_recipe 'debian::stable_lts' }
end
end

context 'on non-Debian' do
Expand Down
31 changes: 31 additions & 0 deletions spec/recipes/stable_lts_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'spec_helper'

describe 'debian::stable_lts' do
context 'on Squeeze' do
let(:chef_run) do
debian_runner('6.0.5').converge('debian::stable_lts')
end

it 'configures the LTS repository' do
expect(chef_run).to add_apt_source(
'deb http://http.debian.net/debian squeeze-lts main contrib non-free',
'stable-lts.list')
end
end

context 'on Wheezy' do
let(:chef_run) do
debian_runner('7.0').converge('debian::stable_lts')
end

it 'warns' do
allow(Chef::Log).to receive(:info)
expect(Chef::Log).to receive(:info).with('wheezy-lts does not exist yet')
chef_run
end

it 'does not configure the LTS repository' do
expect(chef_run).to_not create_file('/etc/apt/sources.list.d/stable-lts.list')
end
end
end

0 comments on commit 5844893

Please sign in to comment.