Skip to content
Snippets Groups Projects
Commit 327f2791 authored by drebs's avatar drebs
Browse files

Fix ENC to correctly resolve subdomains of role-domains

parent 8d594a4c
Branches fix-enc
No related tags found
1 merge request!29Fix ENC
Pipeline #84869 passed
...@@ -58,7 +58,7 @@ enc() { ...@@ -58,7 +58,7 @@ enc() {
# accordingly. # accordingly.
# 1. role 2. tag 4. environment # 1. role 2. tag 4. environment
regex="([[:alnum:]_]+)-([[:alnum:]_]+)(-([[:alnum:]_]+))?((\.[[:alnum:]_-]+)?)+$" regex="^([[:alnum:]_]+)-([[:alnum:]_]+)(-([[:alnum:]_]+))?((\.[[:alnum:]_-]+)?)+$"
fqdn=${1} fqdn=${1}
# we're only interested in matching FQDNs that match the regular expression # we're only interested in matching FQDNs that match the regular expression
...@@ -137,6 +137,16 @@ run_tests() { ...@@ -137,6 +137,16 @@ run_tests() {
output=$( enc arbitraryfqdn.example.com ) output=$( enc arbitraryfqdn.example.com )
[ "${output}" == $'classes:' ] || exit 1 [ "${output}" == $'classes:' ] || exit 1
# Test using subdomains of roles
output=$( enc arbitraryfqdn.server-1 )
[ "${output}" == $'classes:' ] || exit 1
# Test using role-subdomains of roles
output=$( enc monitoring-1.server-1 )
[ "${output}" == $'classes:\n - profile::base::minimal\n - role::monitoring\nenvironment: production' ] || exit 1
} }
if [ ${1} == '--run-tests' ]; then if [ ${1} == '--run-tests' ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment