From daad8d0118f20c1cef4cf98c52cb3eec0ce8b400 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 9 Aug 2019 13:04:29 +0100 Subject: [PATCH 1/3] GIS-7717 GIS-7718 - Select the host dependent certificate --- install/installhelper.groovy | 12 ++++++++++++ textutils/subst.groovy | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 textutils/subst.groovy diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 75ba5d6..6fcdc6c 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -97,4 +97,16 @@ def checkISMfile(String ISMfile) { } } +certificatethumbprints = [:] +certificatethumbprints['floreana'] = '0FDEB0A227982C877146CA595091173AC9655479' // Authoring takes place on this machine - so this is what should be in the ISM file already +certificatethumbprints['hawaii'] = '49FD1B361CFF35014B81940C5B046543045DD34B' + +def selectSigningCertificate(String nodeName, String ISMfile) { + def masterpattern = '0FDEB0A227982C877146CA595091173AC9655479' + echo "Substituting occurrences of ${masterpattern} with ${certificatethumbprints[nodeName]} in ISM file: ${ISMfile}" + + textutils_subst = load("${autobuilder.commonscripts()}/textutils/subst.groovy") + textutils_subst.substitute(ISMfile, masterpattern, certificatethumbprints[nodeName]) +} + return this; diff --git a/textutils/subst.groovy b/textutils/subst.groovy new file mode 100644 index 0000000..aae44c6 --- /dev/null +++ b/textutils/subst.groovy @@ -0,0 +1,8 @@ + +def substitute(String filepath, String pattern, String subst) { + fileText = readFile(filepath) + def converted = fileText.replaceAll(pattern, subst) + writeFile(file: filepath, text: converted +} + +return this; \ No newline at end of file From 3cbc5bbf9337fd9ed25e928a8e298712a149bb1a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 9 Aug 2019 13:14:02 +0100 Subject: [PATCH 2/3] GIS-7717 GIS-7718 - Select the host dependent certificate --- textutils/subst.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textutils/subst.groovy b/textutils/subst.groovy index aae44c6..ea1678c 100644 --- a/textutils/subst.groovy +++ b/textutils/subst.groovy @@ -2,7 +2,7 @@ def substitute(String filepath, String pattern, String subst) { fileText = readFile(filepath) def converted = fileText.replaceAll(pattern, subst) - writeFile(file: filepath, text: converted + writeFile(file: filepath, text: converted) } return this; \ No newline at end of file From dad17a4f5a0016a5211858f84c9b3b39bfde8be5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 9 Aug 2019 14:52:51 +0100 Subject: [PATCH 3/3] GIS-7717 GIS-7718 - Text substitution correction --- textutils/subst.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/textutils/subst.groovy b/textutils/subst.groovy index ea1678c..055a269 100644 --- a/textutils/subst.groovy +++ b/textutils/subst.groovy @@ -1,8 +1,8 @@ def substitute(String filepath, String pattern, String subst) { - fileText = readFile(filepath) + fileText = readFile(file: filepath, encoding: 'UTF-8') def converted = fileText.replaceAll(pattern, subst) - writeFile(file: filepath, text: converted) + writeFile(file: filepath, text: converted, encoding: 'UTF-8') } return this; \ No newline at end of file