Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing value in the --prune parameter for docker stack deploy #407

Merged
merged 2 commits into from
Jan 13, 2019
Merged
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
4 changes: 2 additions & 2 deletions lib/puppet/parser/functions/docker_stack_flags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# docker_stack_flags.rb
#
module Puppet::Parser::Functions
# Transforms a hash into a string of docker swarm init flags
# Transforms a hash into a string of docker stack flags
newfunction(:docker_stack_flags, type: :rvalue) do |args|
opts = args[0] || {}
flags = []
Expand All @@ -25,7 +25,7 @@ module Puppet::Parser::Functions
end

if opts['prune'] && opts['prune'].to_s != 'undef'
flags << "--prune '#{opts['prune']}'"
flags << '--prune'
end

if opts['with_registry_auth'] && opts['with_registry_auth'].to_s != 'undef'
Expand Down
2 changes: 1 addition & 1 deletion manifests/stack.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
Optional[String] $stack_name = undef,
Optional[String] $bundle_file = undef,
Optional[Array] $compose_files = undef,
Optional[String] $prune = undef,
Optional[Boolean] $prune = false,
Optional[Boolean] $with_registry_auth = false,
Optional[Pattern[/^always$|^changed$|^never$/]] $resolve_image = undef,
){
Expand Down
11 changes: 11 additions & 0 deletions spec/defines/stack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
it { should contain_exec('docker stack create foo').with_command(/--compose-file '\/tmp\/docker-compose-2.yaml'/) }
end

context 'with prune' do
let(:params) { {
'stack_name' => 'foo',
'compose_files' => ['/tmp/docker-compose.yaml'],
'prune' => true,
} }
it { should contain_exec('docker stack create foo').with_command(/docker stack deploy/) }
it { should contain_exec('docker stack create foo').with_command(/--compose-file '\/tmp\/docker-compose.yaml'/) }
it { should contain_exec('docker stack create foo').with_command(/--prune/) }
end

context 'with ensure => absent' do
let(:params) { {
'ensure' => 'absent',
Expand Down