2

これは非常に単純な問題であり、いくつかの提案された解決策を読みましたが、git::config クラスをインポートするために puppet apply を取得できません。これが私のファイル設定です:

nodes.pp 経由で git モジュールをインポートします。

#/etc/puppet/manifests/nodes.pp
node default {
}
include git

site.pp は nodes.pp をインポートします。

#/etc/puppet/manifests/site.pp
import 'nodes.pp'

git モジュールは次のように定義されています。

#/etc/puppet/modules/git/manifests/init.pp
class git {
    include git::install
    include git::config
}
class git::install{
    package {'git': => present }
}

および構成ファイル:

#/etc/puppet/modules/git/manifests/config.pp
define git::config{
    [some code here]
}

puppet apply を実行すると、puppet が git::config クラスを見つけられません。

sudo puppet apply --modulepath=/etc/puppet/modules /etc/puppet/manifests/site.pp
Error: Could not find class git::config for xxxx on node xxxx.

元のモジュールは puppetlabs-git (同じフォルダー構造) でしたが、簡略化されたファイル構造 (上記) を使用してエラーを再現しました。

更新 1

上記のタイプミス、git config.pp と init.pp はフォルダー /modules/git/manifests にあり、config.pp ファイルは「define git::config」を読み取ります

4

2 に答える 2

5

includeを呼び出すことはできませんgit::configクラスではなく、git::config定義された型です。a を使用する構文は次のとおりです。defined type

git::config { 'the_name_var':
  param1 => 'foo',
  param2 => 'bar'
}

お役に立てれば

于 2015-02-26T17:56:24.227 に答える
5

パペット コードの構造が間違っています。pp ファイルをマニフェスト フォルダーに移動する必要があります。

/etc/puppet/modules/git/init.pp
/etc/puppet/modules/git/config.pp

/etc/puppet/modules/git/manifests/init.pp
/etc/puppet/modules/git/manifests/config.pp
于 2015-02-26T03:22:51.327 に答える