- 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.
推薦閱讀
- 元器件易學(xué)通:常用元件分冊
- 5G通信系統(tǒng)定位技術(shù)原理與方法
- cdma2000 1x/EV-DO通信網(wǎng)絡(luò)規(guī)劃與設(shè)計
- DSP原理及應(yīng)用:TMS320DM6437架構(gòu)、指令、功能模塊、程序設(shè)計及案例分析
- HFSS電磁仿真設(shè)計從入門到精通
- 通信原理
- 電子電路設(shè)計與應(yīng)用手冊
- 手繪圖說數(shù)字電路圖
- 5G技術(shù)與應(yīng)用
- 太陽能光伏組件生產(chǎn)制造工程技術(shù)
- 通信工程設(shè)計
- 開關(guān)電源與LED照明的優(yōu)化設(shè)計應(yīng)用
- 信息論與編碼原理
- 短距離無線通信系統(tǒng)技術(shù)
- 光傳輸網(wǎng)絡(luò)技術(shù):SDH與DWDM(第2版)