- Mastering Puppet 5
- Ryan Russell Yates Jason Southgate
- 154字
- 2021-07-16 17:46:15
Adding additional type properties
Type properties are attributes that reflect the current state of that resource on the underlying operating system.
During the Puppet run, these values are actively enforced, so they should be both discoverable and updatable. If the attribute can't be updated, it could be implemented as a read-only property. In the following code, we are extending our example type's interface to define a version property:
Puppet::Type.newtype(:mynewtype) do
...
mynewproperty(:version) do
end
...
end
Now we start to use that property in the Puppet DSL, as shown in the following code:
mynewtype{ 'foo':
version => '2.2',
}
But it won't allow the catalog to compile yet, since there's no implementation for that property in any corresponding provider, as shown in the following command:
$ puppet apply -e "mynewtype { 'foo': version => '2.2' }"
err: /Stage[main]// Mynewtype[foo]: Could not evaluate: undefined method 'version' for nil:NilClass
notice: Finished catalog run in 0.04 seconds
推薦閱讀
- 電子產(chǎn)品印制電路板制作技能演練
- 液晶彩電上門維修速查手冊(cè)(第2版)
- Premiere Pro與After Effects從入門到實(shí)戰(zhàn)(微課版)
- 通信網(wǎng)圖論及應(yīng)用
- 電子工程師自學(xué)速成:入門篇(第2版)
- 通信專業(yè)實(shí)務(wù):動(dòng)力與環(huán)境
- 太赫茲超表面的理論基礎(chǔ)與應(yīng)用
- SELinux Cookbook
- 創(chuàng)客電子入門
- 大話無(wú)線通信:網(wǎng)絡(luò)設(shè)計(jì)完全攻略
- 面向5G的智能光承載網(wǎng)規(guī)劃與運(yùn)維實(shí)踐
- SMT工藝與PCB制造(電子技術(shù)輕松學(xué))
- 風(fēng)云三號(hào)氣象衛(wèi)星地面應(yīng)用系統(tǒng)工程技術(shù)和實(shí)踐
- 信號(hào)處理教程
- 新型諾基亞手機(jī)維修技巧