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