存在吗?方法我从远程源获取值。然后我想根据请求检查值。我的资源类型是卷
volume { 'create a volume 1':
ensure => present,
name => "vol1",
description => 'This is a volume',
size => '100g',
snap_reserve => 10,
force => true,
transport => hiera('credentials')
}
在我的存在?方法
def exists?
$token=getAuthToken(resource[:transport])
allVolumes = returnAllVolumes(resource[:transport])
allVolumes.each do |volume|
if resource[:name].eql? volume["name"]
# Here I want to compare the value from resource
return true
end
end
return false
end
如何打印所有属性?在这种情况下,“名称,描述,大小,snap_reserve”
答案 0 :(得分:0)
哈希(资源)正是我所寻找的。 p>