Replace duplicated code snippet with calls to helper functions

Reduce code duplication by replacing a code snippet repeated throughout
system tests using "trusted-keys" and/or "managed-keys" configuration
sections with calls to keyfile_to_{managed,trusted}_keys() helper
functions.
This commit is contained in:
Michał Kępień
2018-06-13 07:47:12 +02:00
parent 2392b8bc7d
commit 120af964ce
21 changed files with 34 additions and 270 deletions

View File

@@ -27,16 +27,7 @@ cat $infile $keyname1.key $keyname2.key > $zonefile
$SIGNER -g -o $zone $zonefile > /dev/null 2>&1
# Configure the resolving server with a trusted key.
cat $keyname2.key | grep -v '^; ' | $PERL -n -e '
local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
local $key = join("", @rest);
print <<EOF
trusted-keys {
"$dn" $flags $proto $alg "$key";
};
EOF
' > trusted.conf
keyfile_to_trusted_keys $keyname2 > trusted.conf
zone=undelegated
infile=undelegated.db.in
@@ -47,14 +38,5 @@ cat $infile $keyname1.key $keyname2.key > $zonefile
$SIGNER -g -o $zone $zonefile > /dev/null 2>&1
cat $keyname2.key | grep -v '^; ' | $PERL -n -e '
local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
local $key = join("", @rest);
print <<EOF
trusted-keys {
"$dn" $flags $proto $alg "$key";
};
EOF
' >> trusted.conf
keyfile_to_trusted_keys $keyname2 >> trusted.conf
cp trusted.conf ../ns2/trusted.conf