- Mastering Puppet 5
- Ryan Russell Yates Jason Southgate
- 127字
- 2021-07-16 17:46:16
Using autorequire for implicit relationships
To make it easier for users of your type, you can use autorequire to avoid tediously specifying a lot of explicit relationships in longhand between resources. The autorequire method establishes implicit ordering between resources in the catalog. A typical example of this would be filing resources depending on their parent directories.
For example, in our type, if the source parameter is a file path, then we should ensure the corresponding file resource is managed first, as shown in the following code:
Puppet::Type.newtype(:mynewtype) do
...
autorequire(:file) do
self[:source]
end
...
end
Manually specified dependencies in the Puppet DSL have a higher precedence for the compiler than the implicit dependencies that are put in place by virtue of the autorequire method.
推薦閱讀
- 5G承載關鍵技術與規(guī)劃設計
- 電子線路
- 通信專業(yè)實務:動力與環(huán)境
- Cadence Allegro 17.4電子設計速成實戰(zhàn)寶典
- TD-LTE原理與網(wǎng)絡規(guī)劃設計(“十二五”國家重點圖書出版規(guī)劃項目)
- 輕松實現(xiàn)Altium Designer板級設計與數(shù)據(jù)管理
- 基于加權多維標度的無線信號定位理論與方法
- 碳化硅功率器件:特性、測試和應用技術
- 面向未來的光交換網(wǎng)絡及其器件技術
- 全程圖解變頻器應用與檢測技能
- GPRS網(wǎng)絡信令實例詳解
- 物聯(lián)網(wǎng)
- 怎樣識讀電子電路圖
- 云計算安全
- 光纖通信技術