Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fw Builder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Geant DevOps
Fw Builder
Commits
7b5f43ab
Unverified
Commit
7b5f43ab
authored
2 years ago
by
Max Adamo
Browse files
Options
Downloads
Patches
Plain Diff
emit warning if publi key is empty
parent
c71a24b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
functions/fw_builder_public_ips.pp
+15
-10
15 additions, 10 deletions
functions/fw_builder_public_ips.pp
with
15 additions
and
10 deletions
functions/fw_builder_public_ips.pp
+
15
−
10
View file @
7b5f43ab
...
...
@@ -32,20 +32,25 @@ function fw_builder::fw_builder_public_ips(
$public_ipsets
=
[]
}
else
{
# if public is present and contains some value
if
'public'
in
$facts_fw_conf
and
$facts_fw_conf
[
'public'
]
!~
Undef
{
if
'public'
in
$facts_fw_conf
{
$facts_fw_conf_public
=
$facts_fw_conf
[
'public'
]
if
$facts_fw_conf
[
'public'
]
=~
Undef
{
warning
(
'fw_builder public key exists but it\'s empty'
)
$public_ipsets
=
[]
}
else
{
$facts_fw_conf_public
=
$facts_fw_conf
[
'public'
]
# create a list of lists with all the ipsets in public
$unflattened_public_ipsets
=
$facts_fw_conf_public
.
map
|
$app_key
,
$app_value
|
{
if
'ipset'
in
keys
(
$facts_fw_conf_public
[
$app_key
])
{
$facts_fw_conf_public
[
$app_key
][
'ipset'
]
# create a list of lists with all the ipsets in public
$unflattened_public_ipsets
=
$facts_fw_conf_public
.
map
|
$app_key
,
$app_value
|
{
if
'ipset'
in
keys
(
$facts_fw_conf_public
[
$app_key
])
{
$facts_fw_conf_public
[
$app_key
][
'ipset'
]
}
}
}
# flatten the list of list into a list with unique elements, and remove any Undef
$public_ipsets_with_undef
=
unique
(
flatten
(
$unflattened_public_ipsets
))
$public_ipsets
=
$public_ipsets_with_undef
.
filter
|
$item
|
{
$item
!~
Undef
}
# flatten the list of list into a list with unique elements, and remove any Undef
$public_ipsets_with_undef
=
unique
(
flatten
(
$unflattened_public_ipsets
))
$public_ipsets
=
$public_ipsets_with_undef
.
filter
|
$item
|
{
$item
!~
Undef
}
}
}
else
{
$public_ipsets
=
[]
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment