Skip to content

Commit

Permalink
modify specifying version flag to deal with new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
garethr committed Nov 23, 2013
1 parent 83a22be commit edd5bce
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'garethr-docker'
version '0.7.1'
version '0.8.0'
source 'git://github.com/garethr/garethr-docker.git'
author 'Gareth Rushgrove'
summary 'Module for installing docker from repository on get.docker.io'
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ socket if required.
socket_bind => 'unix:///var/run/docker.sock',
}

Unless specified this installs the latest version of docker from the
lxc-docker package. However if you want to specify a specific version
you can do so:

class { 'docker':
version => '0.5.5',
}

### Images

The next step is probably to install a docker image, for this we have a defined type which can be used like so:
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#
class docker(
$version = $docker::params::version,
$ensure = $docker::params::ensure,
$tcp_bind = $docker::params::tcp_bind,
$socket_bind = $docker::params::socket_bind,
$use_upstream_apt_source = $docker::params::use_upstream_apt_source,
Expand Down
9 changes: 8 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@
}
}

if $docker::version {
$dockerpackage = "lxc-docker-${docker::version}"
} else {
$dockerpackage = "lxc-docker"
}

package { 'lxc-docker':
ensure => $docker::version,
name => $dockerpackage,
ensure => $docker::ensure,
}
}
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class docker::params {
$version = present
$version = undef
$ensure = present
$tcp_bind = undef
$socket_bind = 'unix:///var/run/docker.sock'
$use_upstream_apt_source = true
Expand Down
7 changes: 6 additions & 1 deletion spec/classes/docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
end

context 'with a custom version' do
let(:params) { {'version' => 'absent' } }
let(:params) { {'version' => '0.5.5' } }
it { should contain_package('lxc-docker').with_name('lxc-docker-0.5.5').with_ensure('present') }
end

context 'with ensure absent' do
let(:params) { {'ensure' => 'absent' } }
it { should contain_package('lxc-docker').with_ensure('absent') }
end

Expand Down

0 comments on commit edd5bce

Please sign in to comment.