To use this function add it to the class library file named PuppetService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: PuppetService.ts
Description: Orchestrator Function to remove a virtual machine from Puppet during decommissioning using the Puppet REST API.
Function: DecomissionFromPuppet
public DecomissionFromPuppet(strHostName:string, strHostDomainName:string, arrPuppetMasterFQDN: string[]): void {
arrPuppetMasterFQDN.forEach((strPuppetMasterFQDN: string): void => {
this.objLogger.info("===== Attempting to DELETE the SSL Certificate for '" + strHostName + ".cloudbuildtools.com' from " + strHostDomainName);
try {
let objURL = new URL("https://" + strPuppetMasterFQDN + ":8140/production/certificate_status/" + strHostName + "." +strHostDomainName);
objURL.requestType = "DELETE";
let strContent = objURL.getContent();
strContent = strContent.replace(/\n/, "");
this.objLogger.info("===== Result: " + strContent);
}
catch (objException) {
this.objLogger.info("===== Failed to DELETE the SSL Certificate for '" + strHostName + ".cloudbuildtools.com' from " + strPuppetMasterFQDN);
}
});
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
