Mac-Osx

傀儡重複聲明:類

  • March 7, 2016

我對 puppet 有點陌生,但我不確定這將如何成為重複聲明,有人可以給我一些指導,這是否是類傳遞參數的正確用法?

Error: Duplicate declaration: Class[Jenkins_dotfiles] is already declared in file /tmp/puppet-manifests-test/manifests/site.pp:193; cannot redeclare at /tmp/puppet-manifests-test/manifests/site.pp:193

使用此程式碼:

$user = 'jenkins'
$group = 'staff'
$home = "/Users/${user}"
...
if ($is_jenkins) {
   class {
       'jenkins_dotfiles':
           home => '/var/root',
           user => 'root';
       'jenkins_dotfiles':
           home => $home,
           user => $user;

jenkins_dotfiles/manifests/init.pp

class jenkins_dotfiles($home, $user) {
...
}

你聲明了兩次**。**一次使用參數值'/var/root', 'root',另一次使用參數$home$user。您可能應該創建jenkins_dotfiles一個定義的類型,而不是一個類。

引用自:https://serverfault.com/questions/761754