开发cloudify配方文件-配方参数

为了让服务描述文件运行在不同的环境下,采用Groovy properties文件使用keys来定义需要使用的参数

Properties文件必须和groovy文件保存在同一个文件夹下,建议的命名方式为:<myRecipe>-service.properties,keys的参数定义采用Key=Value命名方式,使用参数用 ${Key}

以下是一个例子properties文件:

service_params.groovy

version = "5.5.0"

name = "apache-activemq-${version}"

zipName = "${name}-bin.zip"

installDir = "install"

downloadPath = "http://apache.spd.co.il//activemq/apache-activemq/${version}/${zipName}"

script = "install/${name}/bin/activemq"

 

using_params.groovy

new AntBuilder().sequential {

    mkdir(dir:installDir)

    get(src:downloadPath, dest:"${installDir}/${zipName}", skipexisting:true)

    unzip(src:"${installDir}/${zipName}", dest:installDir, overwrite:true)

    //dos2unix on the linux script files

    fixcrlf(srcDir:"${installDir}/${name}/bin", eol:"lf", eof:"remove", excludes:"*.bat *.jar")

    chmod(dir:"${installDir}/${name}/bin", perm:'+x', excludes:"*.bat *.jar")

}

你可能感兴趣的:(开发cloudify配方文件-配方参数)