【问题标题】:downgrade chef-client version 11降级厨师客户端版本 11
【发布时间】:2014-06-12 20:58:09
【问题描述】:

试图降级chef-client。附上一个sn-p:

$ chef-client --version
Chef: 11.10.4

$ curl -sL https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 11.8.2
Downloading Chef 11.8.2 for ubuntu...
downloading https://www.opscode.com/chef/metadata?v=11.8.2&prerelease=false&nightlies=false&p=ubuntu&pv=12.04&m=x86_64
  to file /tmp/install.sh.1934/metadata.txt
trying wget...
url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.8.2-1.ubuntu.12.04_amd64.deb
md5 3d3b3662830a44eeec71aadc098a4018
sha256  a5b00a24e68e29a01c7ab9de5cdaf0cc9fd1c889599ad9af70293e5b4de8615c
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.8.2-1.ubuntu.12.04_amd64.deb
  to file /tmp/install.sh.1934/chef_11.8.2-1.ubuntu.12.04_amd64.deb
trying wget...
Comparing checksum with sha256sum...
Installing Chef 11.8.2
installing with dpkg...
(Reading database ... 107385 files and directories currently installed.)
Preparing to replace chef 11.8.2-1.ubuntu.12.04 (using .../chef_11.8.2-1.ubuntu.12.04_amd64.deb) ...
Unpacking replacement chef ...
Setting up chef (11.8.2-1.ubuntu.12.04) ...
Thank you for installing Chef!

$ chef-client --version
Chef: 11.10.4

也试过重启机器,结果还是一样。

可以吗,chef-client可以降级吗?

【问题讨论】:

    标签: knife cookbook chef-infra


    【解决方案1】:

    如果您从综合安装程序安装了 Chef 11.10.4(与旧版本使用的 install.sh 基本相同),那么您基本上在 /opt/chef 内安装了独立的 Chef。

    删除该目录将删除旧安装的几乎所有痕迹。剩下的就是删除/usr/bin 中的符号链接,这可能是chef-clientchef-solochef-shellknifeohai 和其他一些符号链接(在@987654330 中查找符号链接文件@那个指向/opt/chef

    之后,使用上述技术重新安装,您应该安装了正确的版本。

    【讨论】:

    • 另一种选择是使用与您的底层软件包安装程序(例如 apt-get)关联的清除命令,这可能会自动执行此操作并使事情变得更清洁。
    • @MarkO'Connor, dpkg --purge chef 不会这样做,因为dpkg-query -L chef 不保存所有文件记录。
    【解决方案2】:

    只需从https://downloads.chef.io/chef 安装特定版本(取决于您的操作系统)。我通过简单的安装成功地降级了我的厨师客户端版本,覆盖了较新的版本。

    【讨论】: