Puppet打印资源的所有属性

时间:2016-11-08 00:27:46

标签: ruby puppet puppet-enterprise

存在吗?方法我从远程源获取值。然后我想根据请求检查值。我的资源类型是卷

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”

1 个答案:

答案 0 :(得分:0)

哈希(资源)正是我所寻找的。