Merge pull request #49 from specialunderwear/lxc_conf_upstart
It would be nice if upstart users could also make use of the lxc_conf pa...
This commit is contained in:
Коммит
f95cd8e784
|
@ -75,6 +75,7 @@ class docker(
|
|||
$extra_parameters = undef,
|
||||
$proxy = $docker::params::proxy,
|
||||
$no_proxy = $docker::params::no_proxy,
|
||||
$execdriver = $docker::params::execdriver,
|
||||
) inherits docker::params {
|
||||
|
||||
validate_string($version)
|
||||
|
|
|
@ -18,4 +18,5 @@ class docker::params {
|
|||
}
|
||||
$proxy = undef
|
||||
$no_proxy = undef
|
||||
$execdriver = undef
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ class docker::service (
|
|||
$extra_parameters = $docker::extra_parameters,
|
||||
$proxy = $docker::proxy,
|
||||
$no_proxy = $docker::no_proxy,
|
||||
$execdriver = $docker::execdriver,
|
||||
){
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
|
|
|
@ -35,6 +35,21 @@ describe 'docker', :type => :class do
|
|||
it { should contain_file('/etc/init/docker.conf').with_content(/no_proxy=.github.com \/usr\/bin\/docker/) }
|
||||
end
|
||||
|
||||
context 'with execdriver param lxc' do
|
||||
let(:params) { { 'execdriver' => 'lxc' }}
|
||||
it { should contain_file('/etc/init/docker.conf').with_content(/-e lxc/) }
|
||||
end
|
||||
|
||||
context 'with execdriver param native' do
|
||||
let(:params) { { 'execdriver' => 'native' }}
|
||||
it { should contain_file('/etc/init/docker.conf').with_content(/-e native/) }
|
||||
end
|
||||
|
||||
context 'without execdriver param' do
|
||||
it { should_not contain_file('/etc/init/docker.conf').with_content(/-e lxc/) }
|
||||
it { should_not contain_file('/etc/init/docker.conf').with_content(/-e native/) }
|
||||
end
|
||||
|
||||
it { should contain_service('docker').without_provider }
|
||||
it { should_not contain_package('linux-image-extra-3.8.0-29-generic') }
|
||||
it { should_not contain_package('linux-image-generic-lts-raring') }
|
||||
|
|
|
@ -23,6 +23,11 @@ require 'spec_helper'
|
|||
end
|
||||
end
|
||||
|
||||
context 'when lxc_conf disables swap' do
|
||||
let(:params) { {'command' => 'command', 'image' => 'base', 'lxc_conf' => 'lxc.cgroup.memory.memsw.limit_in_bytes=536870912'} }
|
||||
it { should contain_file(initscript).with_content(/-lxc-conf=\"lxc.cgroup.memory.memsw.limit_in_bytes=536870912\"/) }
|
||||
end
|
||||
|
||||
context 'when `use_name` is true' do
|
||||
let(:params) { {'command' => 'command', 'image' => 'base', 'use_name' => true } }
|
||||
it { should contain_file(initscript).with_content(/ -name sample /) }
|
||||
|
|
|
@ -9,4 +9,4 @@ setuid root
|
|||
respawn
|
||||
respawn limit 5 20
|
||||
|
||||
exec docker run <% if @username %>-u '<%= @username %>' <% end %><% if @hostname %>-h '<%= @hostname %>'<% end %><% if @disable_network %> -n false<%end %><% if @dns %><% @dns_array.each do |address| %> -dns <%= address %><% end %><% end %><% if @env %><% @env_array.each do |env| %> -e <%= env %><% end %><% end %><% if @ports %><% @ports_array.each do |port| %> -p <%= port %><% end %><% end %><% if @volumes %><% @volumes_array.each do |volume| %> -v <%= volume %><% end %><% end %><% if @volumes_from %> -volumes-from <%= @volumes_from %><% end %> -m <%= @memory_limit %> <% if @links %><%= @links_array.map {|link| "-link #{link}" }.join(' ') %> <% end %><% if @use_name %>-name <%= @name %><% end %> <%= @image %> <% if @command %><%= @command %><% end %>
|
||||
exec docker run <% if @username %>-u '<%= @username %>' <% end %><% if @hostname %>-h '<%= @hostname %>'<% end %><% if @disable_network %> -n false<%end %><% if @dns %><% @dns_array.each do |address| %> -dns <%= address %><% end %><% end %><% if @env %><% @env_array.each do |env| %> -e <%= env %><% end %><% end %><% if @ports %><% @ports_array.each do |port| %> -p <%= port %><% end %><% end %><% if @volumes %><% @volumes_array.each do |volume| %> -v <%= volume %><% end %><% end %><% if @volumes_from %> -volumes-from <%= @volumes_from %><% end %> -m <%= @memory_limit %> <% if @links %><%= @links_array.map {|link| "-link #{link}" }.join(' ') %> <% end %><% if @use_name %>-name <%= @name %><% end %><% if @lxc_conf_array %><% @lxc_conf_array.each do |lxcconf| %> -lxc-conf="<%=lxcconf%>"<% end %><% end %> <%= @image %> <% if @command %><%= @command %><% end %>
|
||||
|
|
|
@ -6,6 +6,6 @@ stop on runlevel [!2345]
|
|||
respawn
|
||||
|
||||
script
|
||||
<% if @proxy %>http_proxy=<%= @proxy %> https_proxy=<%= @proxy %> <% end %><% if @no_proxy %>no_proxy=<%= @no_proxy %> <% end %>/usr/bin/docker -d <% if @root_dir %>-g <%= @root_dir %><% end %> <% if @tcp_bind %>-H <%= @tcp_bind %><% end %><% if @socket_bind %> -H <%= @socket_bind %><% end %> <% if @dns %> -dns <%= @dns %><% end %><% if @extra_parameters %><% @extra_parameters.each do |param| %> <%= param %><% end %><% end %>
|
||||
<% if @proxy %>http_proxy=<%= @proxy %> https_proxy=<%= @proxy %> <% end %><% if @no_proxy %>no_proxy=<%= @no_proxy %> <% end %>/usr/bin/docker -d <% if @root_dir %>-g <%= @root_dir %> <% end %><% if @execdriver %>-e <%= @execdriver %> <% end %><% if @tcp_bind %>-H <%= @tcp_bind %><% end %><% if @socket_bind %> -H <%= @socket_bind %><% end %> <% if @dns %> -dns <%= @dns %><% end %><% if @extra_parameters %><% @extra_parameters.each do |param| %> <%= param %><% end %><% end %>
|
||||
end script
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче