Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9125355
docker_stack_flags.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
967 B
Subscribers
None
docker_stack_flags.rb
View Options
require
'shellwords'
#
# docker_stack_flags.rb
#
module
Puppet::Parser::Functions
# Transforms a hash into a string of docker swarm init flags
newfunction
(
:docker_stack_flags
,
:type
=>
:rvalue
)
do
|
args
|
opts
=
args
[
0
]
||
{}
flags
=
[]
if
opts
[
'bundle_file'
]
&&
opts
[
'bundle_file'
].
to_s
!=
'undef'
flags
<<
"--bundle-file '
#{
opts
[
'bundle_file'
]
}
'"
end
if
opts
[
'compose_files'
]
&&
opts
[
'compose_files'
].
to_s
!=
'undef'
opts
[
'compose_files'
].
each
do
|
file
|
flags
<<
"--compose-file '
#{
file
}
'"
end
end
if
opts
[
'resolve_image'
]
&&
opts
[
'resolve_image'
].
to_s
!=
'undef'
flags
<<
"--resolve-image '
#{
opts
[
'resolve_image'
]
}
'"
end
if
opts
[
'prune'
]
&&
opts
[
'prune'
].
to_s
!=
'undef'
flags
<<
"--prune '
#{
opts
[
'prune'
]
}
'"
end
if
opts
[
'with_registry_auth'
]
&&
opts
[
'with_registry_auth'
].
to_s
!=
'undef'
flags
<<
'--with-registry-auth'
end
flags
.
flatten
.
join
(
' '
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sat, Jun 21, 8:35 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3372360
Attached To
R205 puppet-puppetlabs-docker
Event Timeline
Log In to Comment