0
嘗試獲取本地和全局安裝的一些NPM軟件包。我這樣做是這樣的:木偶:在使用`define`時在同一行上進行重複排列
$npm_packages_loc = {
'mysql' => {
'version' => 'latest',
'ensure' => 'present',
},
'googleapis' => {
'version' => 'latest',
'ensure' => 'present',
}
}
這只是說,我想「mysql的」和「googleapi」包安裝的,我希望他們在最新的版本。
## Install NPM local packages
# Obtains and multiplexes NPM packages defgined in '$npm_modules_loc'
define npm_packages($version, $ensure) {
npm_packages_loc_inst { $version:
package => $name,
ensure => $ensure,
}
}
# Installs the packages via nodejs::npm
define npm_packages_loc_inst($package, $ensure) {
$version = name
nodejs::npm { "/opt/app/:${package}":
ensure => $ensure,
version => $version,
}
}
create_resources ('npm_packages', $npm_packages_loc)
但是,這樣做傀儡來看,我收到以下錯誤時:
重複聲明:MYAPP :: Npm_packages_loc_inst [最新]文件中已聲明的/ etc /傀儡/模塊/測試/ MYAPP /manifests/init.pp:79;無法在/etc/puppet/modules/test/myapp/manifests/init.pp:79重新聲明:
不知道爲什麼它的行爲如此,但我顯然做錯了什麼。任何幫助表示讚賞:)
相關:http://stackoverflow.com/questions/25858390/puppet-manifest-has-a-file-declaration-that-somehow-duplicates-itself – 2014-10-09 19:15:53