Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 48 lines (36 sloc) 1.482 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
includeTargets << grailsScript("Init")
includeTargets << new File("${cloudBeesPluginDir}/scripts/_CheckConfig.groovy")
includeTargets << new File("${cloudBeesPluginDir}/scripts/_BeesHelper.groovy")
includeTargets << new File("${cloudBeesPluginDir}/scripts/_BeesCommon.groovy")

USAGE = '''
grails bees-config-set <name1=value1,name2=value2> [type] [appId]
name : the name of the configuration parameter
value : the value of the configuraiton parameter
type : global or application
appId : application id (defaults to application name)

Beware! Will delete all existing parameters!
'''

target(beesConfigSet: "Sets configuration parameters globally or for an application. Overwrites existing ones!") {
    depends(checkConfig, prepareClient)

    def type = getConfigType(1)
    def appId = buildAppId(2)
    def account = buildOrgId()
    def resource = (type == "application") ? appId : account

    def parameter = getRequiredArg(0)
    def xmlFile = buildParamXmlFile(parameter)

    def response
    try{
        event "StatusFinal", ["Setting parameter on $type scope for $resource"]
        response = beesClient.configurationParametersUpdate(resource, type, xmlFile)

    } catch (Exception e){
        dealWith e

    } finally {
        xmlFile.delete()
    }

    if(response.status){
        event "StatusFinal", ["Status: ${response.status}"]
    } else {
        event "StatusError", ["No status found."]
    }

}

setDefaultTarget(beesConfigSet)
Something went wrong with that request. Please try again.