Enable config for docker daemon debug
Exposes a way to configure the docker daemon with debug enabled.
Change-Id: I654a70c8bb7753679be83d78ca653ed44c3a7395
Related-Bug: #1710533
(cherry picked from commit 44b90c9a79
)
This commit is contained in:
parent
8a98b52cc8
commit
e6f31aa6a8
|
@ -44,6 +44,10 @@
|
|||
# [*step*]
|
||||
# step defaults to hiera('step')
|
||||
#
|
||||
# [*debug*]
|
||||
# Boolean. Value to configure docker daemon's debug configuration.
|
||||
# Defaults to false
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*insecure_registry_address*]
|
||||
|
@ -62,11 +66,12 @@
|
|||
#
|
||||
class tripleo::profile::base::docker (
|
||||
$insecure_registries = undef,
|
||||
$registry_mirror = false,
|
||||
$docker_options = '--log-driver=journald --signature-verification=false --iptables=false',
|
||||
$configure_storage = true,
|
||||
$storage_options = '-s overlay2',
|
||||
$step = Integer(hiera('step')),
|
||||
$registry_mirror = false,
|
||||
$docker_options = '--log-driver=journald --signature-verification=false --iptables=false',
|
||||
$configure_storage = true,
|
||||
$storage_options = '-s overlay2',
|
||||
$step = Integer(hiera('step')),
|
||||
$debug = false,
|
||||
# DEPRECATED PARAMETERS
|
||||
$insecure_registry_address = undef,
|
||||
$docker_namespace = undef,
|
||||
|
@ -133,6 +138,9 @@ class tripleo::profile::base::docker (
|
|||
$mirror_changes = [ 'rm dict/entry[. = "registry-mirrors"]', ]
|
||||
}
|
||||
|
||||
$debug_changes = ['set dict/entry[. = "debug"] "debug"',
|
||||
"set dict/entry[. = \"debug\"]/const \"${debug}\"",]
|
||||
|
||||
file { '/etc/docker/daemon.json':
|
||||
ensure => 'present',
|
||||
content => '{}',
|
||||
|
@ -144,7 +152,7 @@ class tripleo::profile::base::docker (
|
|||
augeas { 'docker-daemon.json':
|
||||
lens => 'Json.lns',
|
||||
incl => '/etc/docker/daemon.json',
|
||||
changes => $mirror_changes,
|
||||
changes => concat($mirror_changes, $debug_changes),
|
||||
subscribe => Package['docker'],
|
||||
notify => Service['docker'],
|
||||
require => File['/etc/docker/daemon.json'],
|
||||
|
|
|
@ -82,10 +82,32 @@ describe 'tripleo::profile::base::docker' do
|
|||
it { is_expected.to contain_package('docker') }
|
||||
it { is_expected.to contain_service('docker') }
|
||||
it {
|
||||
is_expected.to contain_augeas('docker-daemon.json').with_changes(['set dict/entry[. = "registry-mirrors"] "registry-mirrors', "set dict/entry[. = \"registry-mirrors\"]/array/string \"http://foo/bar\""])
|
||||
is_expected.to contain_augeas('docker-daemon.json').with_changes(
|
||||
['set dict/entry[. = "registry-mirrors"] "registry-mirrors',
|
||||
"set dict/entry[. = \"registry-mirrors\"]/array/string \"http://foo/bar\"",
|
||||
'set dict/entry[. = "debug"] "debug"',
|
||||
"set dict/entry[. = \"debug\"]/const \"false\""])
|
||||
}
|
||||
end
|
||||
|
||||
context 'with step 1 and docker debug' do
|
||||
let(:params) { {
|
||||
:step => 1,
|
||||
:debug => true,
|
||||
} }
|
||||
|
||||
it { is_expected.to contain_class('tripleo::profile::base::docker') }
|
||||
it { is_expected.to contain_package('docker') }
|
||||
it { is_expected.to contain_service('docker') }
|
||||
it {
|
||||
is_expected.to contain_augeas('docker-daemon.json').with_changes(
|
||||
['rm dict/entry[. = "registry-mirrors"]',
|
||||
'set dict/entry[. = "debug"] "debug"',
|
||||
"set dict/entry[. = \"debug\"]/const \"true\""])
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
context 'with step 1 and docker_options configured' do
|
||||
let(:params) { {
|
||||
:docker_options => '--log-driver=syslog',
|
||||
|
|
Loading…
Reference in New Issue