假设我想根据2个variables来命名一个资源,所以我有这样的东西:
heat_template_version:2013-05-23
描述:使用创buildnetworking
参数:
client_code:
键入:string
描述:4个字符的客户代码。 将用于实例命名
project_code:
键入:string
描述:3个字符的项目代码
现在我想用基于客户端和项目的名字创build资源:
资源:
testing:
键入:OS :: Neutron :: Net
特性:
名称:{get_param:client_code} {get_param:project_code}
该资源创build给我一个parsing错误。 有反正我可以做到这一点,或者我需要使用预先脚本来生成我的模板?
我find了一个使用str_replace的解决scheme。 我的代码看起来像这样:
heat_template_version: 2013-05-23 description: Create network with parameters: client_code: type: string description: 4 character customer code. Will be used for instance naming project_code: type: string description: 3 character project code resources: test: type: OS::Neutron::Net properties: name: str_replace: template: cust%-proj% params: "cust%": { get_param: client_code } "proj%": { get_param: project_code }
我find了一个使用'list_join'的解决scheme:
heat_template_version: 2013-05-23 int_network: type: OS::Neutron::Net properties: name: list_join: ['-', [ {get_param: tenant}, 'net']]