Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
fixtures:
forge_modules:
stdlib: 'puppetlabs-stdlib'
epel: 'stahnma-epel'
# forge_modules:
# - 'puppetlabs-stdlib'
# - 'stahnma-epel'
repositories:
apt:
repo: git://github.com/puppetlabs/puppetlabs-apt.git
repo: https://github.com/puppetlabs/puppetlabs-apt.git
ref: 2.1.0
puppetlabs-stdlib:
repo: https://github.com/puppetlabs/puppetlabs-stdlib
epel:
repo: https://github.com/stahnma/puppet-module-epel
symlinks:
docker: "#{source_dir}"
5 changes: 5 additions & 0 deletions lib/facter/dockerd_binary.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Facter.add(:dockerd_binary) do
setcode do
Facter::Core::Execution.which('dockerd')
end
end
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
require 'puppetlabs_spec_helper/module_spec_helper'

RSpec.configure do |config|
config.mock_with :rspec
end

RSpec::Matchers.define :require_string_for do |property|
match do |type_class|
config = {:name => 'name'}
Expand Down
30 changes: 30 additions & 0 deletions spec/unit/dockerd_daemon_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'spec_helper'

describe 'dockerd_binary fact' do

before :each do
Facter.clear
end

context 'when the dockerd binary is NOT present' do

before :each do
Facter.fact(:dockerd_binary).stubs(:value).returns(nil)
end

it 'return nil' do
expect(Facter.fact(:dockerd_binary).value).to be_nil
end
end

context 'when the dockerd binary is installed' do

before :each do
Facter.fact(:dockerd_binary).stubs(:value).returns('/some/path/to/dockerd')
end

it 'return the full path to the dockerd binary' do
expect(Facter.fact(:dockerd_binary).value).to eq('/some/path/to/dockerd')
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
EnvironmentFile=-/etc/default/docker
EnvironmentFile=-/etc/default/docker-storage
ExecStart=
<% unless @dockerd_binary -%>
ExecStart=/usr/bin/<%= @docker_command %> <%= @daemon_subcommand %> $OPTIONS \
$DOCKER_STORAGE_OPTIONS
<% end -%>
ExecStart=<%= @dockerd_binary %> $OPTIONS \
$DOCKER_STORAGE_OPTIONS
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ EnvironmentFile=-/etc/sysconfig/docker-network
<% if @daemon_environment_files %><% @daemon_environment_files.each do |param| %>EnvironmentFile=-<%= param %>
<% end %><% end -%>
ExecStart=
<% unless @dockerd_binary -%>
ExecStart=/usr/bin/<%= @docker_command %> <%= @daemon_subcommand %> $OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY
<% end -%>
ExecStart=<%= @dockerd_binary %> $OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY