Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions casc-update-master-path.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//only runs on CJOC

import com.cloudbees.opscenter.server.casc.BundleStorage
import hudson.ExtensionList

String masterName = "master1"
String masterPath = "folder1/master1"
boolean regenerateBundleToken = false

setBundleConfig(masterName, masterPath, regenerateBundleToken)

// set the masterPath for a master, and optionally regenerate the bundle token
private static void setBundleConfig(String masterName, String masterPath, boolean regenerateBundleToken) {
sleep(100)
ExtensionList.lookupSingleton(BundleStorage.class).initialize()
BundleStorage.AccessControl accessControl = ExtensionList.lookupSingleton(BundleStorage.class).getAccessControl()
accessControl.updateMasterPath(masterName, masterPath)
if (regenerateBundleToken) {
accessControl.regenerate(masterName)
}
}