我们创建服务器所依赖的端口。用户可以提供network_id,也可以提供network和fixed_ips。我们要允许两种配置。
很明显,我看到的是当我不提供固定的ips并在端口创建中有条件时,我在get_resource中遇到错误。如果我不给出条件,则创建成功。被封锁了。
conditions:
ccess_ip_input:
equals:
- get_param: ccess_ip
- yes
resources: g_server:
type: OS::Nova::Server
depends_on:
- am_port
- ccess_port
- ore_port_1
- ore_port_2
- dm_port
properties:
name:
str_replace:
template: $instance_name
params:
$instance_name: {get_param: instance_name}
key_name: {get_param: key_name}
image: {get_param: image}
flavor: {get_param: flavor}
scheduler_hints:
group: {get_param: ng_cluster}
networks:
- port: {get_resource: am_port}
- port: {get_resource: ccess_port}
ccess_port:
type: OS::Neutron::Port
properties:
name:
str_replace:
template: $instance_name-ccess-port
params:
$instance_name: { get_param: instance_name }
network_id: { get_param: ccess_network_id }
port_security_enabled: False
condition: ccess_ip_input
properties:
fixed_ips:
- ip_address: { get_param: ccess_ip }
得到以下错误: 错误:InvalidTemplateReference :: resources.hng_1 ::指定的引用“ ccess_port”(在ng_server.Properties.networks [1] .port中)不正确。