Skip to content

Commit

Permalink
Update gen_params.sh
Browse files Browse the repository at this point in the history
A refactor in firewall 7.0.0 meant changes needed in the gen_params.sh
script.
  • Loading branch information
alex-harvey-z3q committed Sep 24, 2023
1 parent 244ee18 commit 3d8f727
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions gen_params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ EOF
}

firewall_lib() {
cat "$path_to_firewall"'/lib/puppet/type/firewall.rb'
cat "$path_to_firewall"'/lib/puppet/provider/firewall/firewall.rb'
}

sort_cols() {
Expand All @@ -57,14 +57,10 @@ sort_cols() {

first_transform() {
firewall_lib \
| gsed -nE '
/^ new/ {
/(property|param)/ {
/:name/! {
s/^ newp.*\(:([^,\)]*).*/$\1 = undef,/p
}
}
}
| awk '
/\$resource_map = {/ { flag=1; next }
/^ }/ { flag=0 }
flag && /:/ { split($0, arr, ":"); gsub(/^[ \t]+|[ \t]+$/, "", arr[1]); print "$" arr[1] " = undef," }
' | sort_cols | gsed '
s/^/ /
s/ = /=/
Expand All @@ -73,14 +69,10 @@ first_transform() {

second_transform() {
firewall_lib \
| gsed -nE '
/^ new/ {
/(property|param)/ {
/:name/! {
s/^ newp.*\(:([^,\)]*).*/\1 => $\1,/p
}
}
}
| awk '
/\$resource_map = {/ { flag=1; next }
/^ }/ { flag=0 }
flag && /:/ { split($0, arr, ":"); gsub(/^[ \t]+|[ \t]+$/, "", arr[1]); print arr[1] " => $" arr[1] "," }
' | sort_cols | gsed '
s/^/ /
s/ => /=>/
Expand Down

0 comments on commit 3d8f727

Please sign in to comment.