Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9125437
get_docker_secrets_flags.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
718 B
Subscribers
None
get_docker_secrets_flags.rb
View Options
# frozen_string_literal: true
require
'shellwords'
def
get_docker_secrets_flags
(
args
)
flags
=
[]
if
args
[
'ensure'
].
to_s
==
'present'
flags
<<
'create'
end
if
args
[
'secret_name'
]
&&
args
[
'secret_name'
].
to_s
!=
'undef'
flags
<<
"'
#{
args
[
'secret_name'
]
}
'"
end
if
args
[
'secret_path'
]
&&
args
[
'secret_path'
].
to_s
!=
'undef'
flags
<<
"'
#{
args
[
'secret_path'
]
}
'"
end
multi_flags
=
->
(
values
,
format
)
{
filtered
=
[
values
].
flatten
.
compact
filtered
.
map
{
|
val
|
format
+
"
\\\n
"
%
val
}
}
[
[
'-l %s'
,
'label'
]
,
].
each
do
|
(
format
,
key
)
|
values
=
args
[
key
]
new_flags
=
multi_flags
.
call
(
values
,
format
)
flags
.
concat
(
new_flags
)
end
flags
.
flatten
.
join
(
' '
)
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sat, Jun 21, 8:47 PM (4 w, 2 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3359126
Attached To
R205 puppet-puppetlabs-docker
Event Timeline
Log In to Comment