From f6ddffd9fd99cbc404aba563fea46c1422d26a9f Mon Sep 17 00:00:00 2001 From: Ricardo Mateus Date: Fri, 27 Sep 2024 10:56:59 +0100 Subject: [PATCH] change payg localhost product indentifier (#9306) Signed-off-by: Ricardo Mateus --- .../taskomatic/task/payg/PaygAuthDataProcessor.java | 12 ++++++++++++ ...nges.rmateus.5.0_change_heades_for_localhost_payg | 1 + 2 files changed, 13 insertions(+) create mode 100644 java/spacewalk-java.changes.rmateus.5.0_change_heades_for_localhost_payg diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/payg/PaygAuthDataProcessor.java b/java/code/src/com/redhat/rhn/taskomatic/task/payg/PaygAuthDataProcessor.java index 49a4267386f7..3acc7b65a09c 100644 --- a/java/code/src/com/redhat/rhn/taskomatic/task/payg/PaygAuthDataProcessor.java +++ b/java/code/src/com/redhat/rhn/taskomatic/task/payg/PaygAuthDataProcessor.java @@ -262,6 +262,18 @@ private CloudRMTCredentials processAndGetCloudRMTCredentials(PaygSshData instanc if (paygData.getHeaderAuth() != null) { + if (instance.isSUSEManagerPayg()) { + // On SUSE Manager 5.0 we need to allow synchronize SUMA older version, like 4.3 + // SUMA 4.3 is a base product, means it also grants access to sles15sp4 base channels + // To access older suma version we are using the authentication credentials collected from localhost + // Localhost is sle-micro, and with those headers we cannot access SLES channels needed for 4.3 + // To overcome this we are forcing the header for OS identifier to be the ones used in suma 4.3 + // With the version set to 5.0 + // Then Public Team cloud team can detect that this is a SUMA machine, + // with the right credentials and grant the needed access to all the channels + paygData.getHeaderAuth().put("X-Instance-Identifier", "SUSE-Manager-Server"); + paygData.getHeaderAuth().put("X-Instance-Version", "5.1"); + } credentials.setExtraAuthData(GSON.toJson(paygData.getHeaderAuth()).getBytes()); } credentials.setPaygSshData(instance); diff --git a/java/spacewalk-java.changes.rmateus.5.0_change_heades_for_localhost_payg b/java/spacewalk-java.changes.rmateus.5.0_change_heades_for_localhost_payg new file mode 100644 index 000000000000..b06e6f8addd5 --- /dev/null +++ b/java/spacewalk-java.changes.rmateus.5.0_change_heades_for_localhost_payg @@ -0,0 +1 @@ +- Change localhost PAYG header to match SUSE Manager product