在一類,我想這樣做:木偶錯誤:重複定義
stop a service
reinstall a package
start the previous service again
這裏是我的類:
class MyClass{
service{"ServiceName-start":
name => "ServiceName",
ensure => "stopped",
}
package{"PackageName":
ensure => "installed",
require => Service["ServiceName-Start"],
}
service{"ServiceName-Stop":
name => "ServiceName",
ensure => "running",
require => Package["PackageName"]
}
}
我得到這個錯誤:
Duplicate definition: Service[ServiceName] is already defined in file /puppet/mycsass.pp at line 2; cannot redefine at /puppet/myclass.pp:9
我不知道什麼傀儡;然而,查看'MyClass'的結構,是由於「ServiceName-start」和「ServiceName-Stop」服務具有相同的'name =>「ServiceName」'而導致的錯誤? –
是的,我希望同樣的服務先停止,然後再啓動 – icn
另外,應該要求=> Service [「ServiceNameStart」],'be'require => Service [「ServiceName-start」],'? –