我们希望使用OpenStack应用程序接口来启动堆栈。但是模板文件将嵌套另一个模板文件。有没有办法实现这一点?
主模板文件中有问题的部分如下:
node_vlan_group:
type: OS::Heat::ResourceGroup
depends_on: [node_sp_net]
properties:
count: {get_param: node_vlan_count}
resource_def:
type: node_vlan_template.yaml
properties:
vlan_index: '%index%'
vlan_names: {get_param: node_vlan_names}
vlan_cidrs4: {get_param: node_cidrs_ipv4}
vlan_gateways4: {get_param: node_gateways_ipv4}
在"type“字段中,包含了另一个模板。但是如何通过API使用它呢?
(当在热客户端上使用命令行界面命令时,我可以将这个模板和内联的node_vlan_template.yaml放在同一个文件夹中,它可以工作。但是通过API,我需要一种方法来提供这个node_vlan_template.yaml的内容。)
发布于 2017-02-15 23:25:10
通过将嵌套文件内容添加到POST正文以创建堆栈,可以解决此问题。看起来像文件:{"node_vlan_template.yaml":"content of node_vlan_template.yaml"}
另一件需要注意的事情是,内容应该是从文件中转储的字符串,而不是python dict对象。
关于ResourceGroup的用法,在http://hardysteven.blogspot.com/2014/09/using-heat-resourcegroup-resources.html上有一个很好的帖子
https://stackoverflow.com/questions/42218453
复制相似问题