簡體   English   中英

引用模塊內部模塊的人偶

[英]Puppet referring to a module inside a module

我在Linux 6機器上使用Puppet 3.5.1。

我有一個包含子模塊“ B”的本地模塊“ A”。 這樣子模塊“ B”位於“ / etc / puppet / modules / A / modules / B”中。

我在模塊“ A”類中引用子模塊“ B”:(/ etc / puppet / modules / A / manifest / init.pp文件)

class A::one (
...
    class { 'B': 
        val1 => 'abc',
        val2 => 'abc',
    }
...
)

然后,B不引用任何其他對象。 當啟動puppet master和puppet代理時,在代理上出現以下錯誤:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class B

我錯過了什么?

我看到一些帖子的解決方案是為人偶代理節點添加“ include B”。 如果是這樣的解決方案,因為這是另一個模塊中的一個模塊,我該如何引用它?

編輯1

我將子模塊“ B”從“ / etc / puppet / modules / A / modules”移動到“ / etc / puppet / modules”中。 它給出了錯誤:

Error: Duplicate declaration: Class[B] is already declared; cannot redeclare at /etc/puppet/modules/A/manifest/init.pp

就自動裝載器而言,在模塊中具有modules/子樹不是有效的結構。 子模塊沒有語義。

如果您非常希望這種特殊情況能夠正常工作,則必須將/etc/puppet/modules/Amodulepath配置設置中。

您可能希望提出一個新問題並描述您實際要解決的問題,因為您的代碼體系結構似乎有點不干凈。

暫無
暫無

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

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