|
|
2f7d90 |
From 712000a675103393045fde191856ce1dd306f1ca Mon Sep 17 00:00:00 2001
|
|
|
2f7d90 |
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
|
|
|
2f7d90 |
Date: Mon, 13 Jan 2020 17:28:09 +0100
|
|
|
2f7d90 |
Subject: [PATCH] Add a test to check --fix-type Anaconda
|
|
|
2f7d90 |
|
|
|
2f7d90 |
There should be 2 equal ways of generating Anaconda remediations:
|
|
|
2f7d90 |
"oscap xccdf generate fix --fix-type anaconda" and
|
|
|
2f7d90 |
"oscap xccdf generate fix --template urn:redhat:anaconda:pre"
|
|
|
2f7d90 |
Both commands should give the same output.
|
|
|
2f7d90 |
This tests a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1736850
|
|
|
2f7d90 |
introduced by b1448ec95a957a76eb8be6d439531c532d97ff3c
|
|
|
2f7d90 |
---
|
|
|
2f7d90 |
.../API/XCCDF/unittests/test_report_anaconda_fixes.sh | 10 ++++++++++
|
|
|
2f7d90 |
1 file changed, 10 insertions(+)
|
|
|
2f7d90 |
|
|
|
2f7d90 |
diff --git a/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh b/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh
|
|
|
2f7d90 |
index d4e86e657..650f3d75b 100755
|
|
|
2f7d90 |
--- a/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh
|
|
|
2f7d90 |
+++ b/tests/API/XCCDF/unittests/test_report_anaconda_fixes.sh
|
|
|
2f7d90 |
@@ -23,6 +23,16 @@ grep -v "$line1" $result | grep -v "$line2" | grep -v "$line3"
|
|
|
2f7d90 |
[ "`grep -v "$line1" $result | grep -v "$line2" | sed 's/\W//g'`"x == x ]
|
|
|
2f7d90 |
:> $result
|
|
|
2f7d90 |
|
|
|
2f7d90 |
+# use --fix-type instead of URN template to generate the same fix
|
|
|
2f7d90 |
+$OSCAP xccdf generate fix --fix-type anaconda \
|
|
|
2f7d90 |
+ --output $result $srcdir/${name}.xccdf.xml 2>&1 > $stderr
|
|
|
2f7d90 |
+[ -f $stderr ]; [ ! -s $stderr ]; :> $stderr
|
|
|
2f7d90 |
+grep "$line1" $result
|
|
|
2f7d90 |
+grep "$line2" $result
|
|
|
2f7d90 |
+grep -v "$line1" $result | grep -v "$line2" | grep -v "$line3"
|
|
|
2f7d90 |
+[ "`grep -v "$line1" $result | grep -v "$line2" | sed 's/\W//g'`"x == x ]
|
|
|
2f7d90 |
+:> $result
|
|
|
2f7d90 |
+
|
|
|
2f7d90 |
$OSCAP xccdf generate fix --template urn:redhat:anaconda:pre \
|
|
|
2f7d90 |
--profile xccdf_moc.elpmaxe.www_profile_1 \
|
|
|
2f7d90 |
--output $result $srcdir/${name}.xccdf.xml 2>&1 > $stderr
|