Puppet

錯誤木偶“雜湊”;在 /tmp/modules/apt/manifests/init.pp:6 的預設值上預期 ‘)’

  • November 7, 2017

我正在收回一個使用 puppet 安裝伺服器的項目。我們的 process.pp 文件可以正常工作

當我跑

puppet parser validate manifests/ikuwprocess.pp

從來沒有錯誤

但是在我們呼叫apt的過程中,我收到了這個錯誤:

Error: Syntax error at 'Hash'; expected ')' at /tmp/modules/apt/manifests/init.pp:6 on node ourserver.40qyqnbkn0mu3edhynn2jlebec.ax.internal.toto.net

init.pp 似乎是 puppet 中未修改的文件,可以在此處找到:https ://github.com/puppetlabs/puppetlabs-apt/blob/master/manifests/init.pp

但是當我執行解析器時,我得到了錯誤

puppet parser validate /tmp/modules/apt/manifests/init.pp
Error: Could not parse for environment production: Syntax error at 'Hash'; expected ')' at /tmp/modules/apt/manifests/init.pp:6

我不知道該怎麼辦……這是我的作業系統版本:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

還有我正在使用的木偶版本

puppet --version
3.8.7

我做錯了什麼我錯過了什麼?

如果您需要更多資訊,請告訴我,我會盡快提供

$$ EDIT $$經過推薦後,我嘗試了這個但仍然無法正常工作:

puppet module install puppetlabs-stdlib --version 4.21.0 
Notice: Preparing to install into /home/myaccount/.puppet/modules ... Notice: Created target directory /home/myaccount/.puppet/modules 
Notice: Downloading from https://forgeapi.puppetlabs.com ... 
Notice: Installing -- do not interrupt ... 
/home/myaccount/.puppet/modules 
└── puppetlabs-stdlib (v4.21.0)

$$ EDIT $$試圖遷移到 puppet 的最新版本

wget -O - https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet_agent.sh | sudo sh

Reading package lists... Done 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
 puppet-agent
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 0 B/16.8 MB of archives.
After this operation, 91.3 MB of additional disk space will be used.
Selecting previously unselected package puppet-agent.
(Reading database ... 30718 files and directories currently installed.)
Preparing to unpack .../puppet-agent_5.3.3-1trusty_amd64.deb ...
Unpacking puppet-agent (5.3.3-1trusty) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up puppet-agent (5.3.3-1trusty) ...

但是當我嘗試呼叫 puppet 時:

puppet --version
-bash: /usr/bin/puppet: No such file or directory

沒有什麼叫做傀儡/usr/bin/

該錯誤是由於您使用的是截至 2016 年 12 月 EOL的舊版本 Puppet (3.X) ,而新版本的 Apt 模組使用僅 Puppet 4+的新Puppet 數據類型。

最簡單的解決方法是升級到最新版本的 Puppet。由於上游的 Ubuntu 14.04 是舊版本,我建議移至 Puppet apt repos。您可以使用我編寫的腳本輕鬆完成此操作:

wget -O - https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet_agent.sh | 須藤

或者您可以手動設置用於升級的儲存庫,此處提供文件:https ://puppet.com/docs/puppet/5.3/puppet_platform.html#apt-based-systems

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