在network_sg.create
之后,network_sg
除非我创建一个新的network_sg
资源。
有没有办法克服这个问题?我尝试冻结network_sg
但在创建新 SG 时出现冻结错误。
network_sg = Azure::Armrest::Network::NetworkSecurityGroupService.new(conf)
options = {
:location => 'eastus',
}
network_sg.create('test-network_sg-4', rg, options)
# Can't re-use the `network_sg` anymore.
# And I have to recreate `network_sg = Azure::Armrest::Network::NetworkSecurityGroupService.new(conf)` before I can use it again.
network_sg.list_all.each do |network_sg|
$evm.log('info', "azure network_sg test is: #{network_sg.name} ")
end
将network_sg设置为常量有效。它可以重复使用。
NETWORK_SG = Azure::Armrest::Network::NetworkSecurityGroupService.new(conf)