Blame SOURCES/openscap-1.3.6-blueprint-fix-pr-1749.patch

5a421d
From 5f0a9033b466d929613a2a55a1524ec75c09b5b0 Mon Sep 17 00:00:00 2001
5a421d
From: Evgeny Kolesnikov <ekolesni@redhat.com>
5a421d
Date: Thu, 6 May 2021 08:14:12 +0200
5a421d
Subject: [PATCH] Introduce OSBuild Blueprint fix type
5a421d
5a421d
---
5a421d
 utils/oscap-xccdf.c | 7 +++++--
5a421d
 utils/oscap.8       | 2 +-
5a421d
 xsl/xccdf-share.xsl | 1 +
5a421d
 3 files changed, 7 insertions(+), 3 deletions(-)
5a421d
5a421d
diff --git a/utils/oscap-xccdf.c b/utils/oscap-xccdf.c
5a421d
index 95c1c7658d..801e54fa35 100644
5a421d
--- a/utils/oscap-xccdf.c
5a421d
+++ b/utils/oscap-xccdf.c
5a421d
@@ -275,7 +275,8 @@ static struct oscap_module XCCDF_GEN_FIX = {
5a421d
     .usage = "[options] xccdf-file.xml",
5a421d
     .help = GEN_OPTS
5a421d
         "\nFix Options:\n"
5a421d
-		"   --fix-type <type>             - Fix type. Should be one of: bash, ansible, puppet, anaconda (default: bash).\n"
5a421d
+		"   --fix-type <type>             - Fix type. Should be one of: bash, ansible, puppet, anaconda, ignition, kubernetes,\n"
5a421d
+		"                                   blueprint (default: bash).\n"
5a421d
 		"   --output <file>               - Write the script into file.\n"
5a421d
 		"   --result-id <id>              - Fixes will be generated for failed rule-results of the specified TestResult.\n"
5a421d
 		"   --template <id|filename>      - Fix template. (default: bash)\n"
5a421d
@@ -887,10 +888,12 @@ int app_generate_fix(const struct oscap_action *action)
5a421d
 			template = "urn:xccdf:fix:script:ignition";
5a421d
 		} else if (strcmp(action->fix_type, "kubernetes") == 0) {
5a421d
 			template = "urn:xccdf:fix:script:kubernetes";
5a421d
+		} else if (strcmp(action->fix_type, "blueprint") == 0) {
5a421d
+			template = "urn:redhat:osbuild:blueprint";
5a421d
 		} else {
5a421d
 			fprintf(stderr,
5a421d
 					"Unknown fix type '%s'.\n"
5a421d
-					"Please provide one of: bash, ansible, puppet, anaconda, ignition, kubernetes.\n"
5a421d
+					"Please provide one of: bash, ansible, puppet, anaconda, ignition, kubernetes, blueprint.\n"
5a421d
 					"Or provide a custom template using '--template' instead.\n",
5a421d
 					action->fix_type);
5a421d
 			return OSCAP_ERROR;
5a421d
diff --git a/utils/oscap.8 b/utils/oscap.8
5a421d
index 240b829d7b..6cae0ffe8a 100644
5a421d
--- a/utils/oscap.8
5a421d
+++ b/utils/oscap.8
5a421d
@@ -395,7 +395,7 @@ Result-oriented fixes are generated using result-id provided to select only the
5a421d
 Profile-oriented fixes are generated using all rules within the provided profile. If no result-id/profile are provided, (default) profile will be used to generate fixes.
5a421d
 .TP
5a421d
 \fB\-\-fix-type TYPE\fR
5a421d
-Specify fix type. There are multiple programming languages in which the fix script can be generated. TYPE should be one of: bash, ansible, puppet, anaconda, ignition, kubernetes. Default is bash. This option is mutually exclusive with --template, because fix type already determines the template URN.
5a421d
+Specify fix type. There are multiple programming languages in which the fix script can be generated. TYPE should be one of: bash, ansible, puppet, anaconda, ignition, kubernetes, blueprint. Default is bash. This option is mutually exclusive with --template, because fix type already determines the template URN.
5a421d
 .TP
5a421d
 \fB\-\-output FILE\fR
5a421d
 Write the report to this file instead of standard output.
5a421d
diff --git a/xsl/xccdf-share.xsl b/xsl/xccdf-share.xsl
5a421d
index 9f8e587676..d7a9f3b7e2 100644
5a421d
--- a/xsl/xccdf-share.xsl
5a421d
+++ b/xsl/xccdf-share.xsl
5a421d
@@ -295,6 +295,7 @@ Authors:
5a421d
             <xsl:when test="$fix/@system = 'urn:xccdf:fix:script:puppet'">Puppet snippet</xsl:when>
5a421d
             <xsl:when test="$fix/@system = 'urn:redhat:anaconda:pre'">Anaconda snippet</xsl:when>
5a421d
             <xsl:when test="$fix/@system = 'urn:xccdf:fix:script:kubernetes'">Kubernetes snippet</xsl:when>
5a421d
+            <xsl:when test="$fix/@system = 'urn:redhat:osbuild:blueprint'">OSBuild Blueprint snippet</xsl:when>
5a421d
             <xsl:otherwise>script</xsl:otherwise>
5a421d
         </xsl:choose>
5a421d
     </xsl:variable>