簡體   English   中英

使用create_resources定義的資源的訪問參數

[英]Access parameter from a resource defined using create_resources

我想知道是否可以從使用create_resources函數實例化的類中訪問參數。 我想在其他類中使用該參數來有條件地安裝某些東西。

這是我的情況:

define myResource($myParam) { ... }

create_resources(myResource, $hashResources)

$hashResources = { "MyResource1" : { "myParam" : 1 },
                   "MyResource2" : { "myParam" : 2 }
                 }

myFancyPuppetClass($nameOfResource) {
 if(******myParam from the resource defined with name $nameOfResource in the same catalog******) { ... }
}

這可能嗎? 如果是,我該怎么做? 謝謝!

由於您嘗試創建的資源是已定義的類型,並且無法訪問已定義資源中的參數,因此在最新版本的Puppet中是不可能的。

有關訪問備用資源中的參數的信息,請參閱我的先前答案。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM