强制厨师重新加载包列表/版本

时间:2017-03-01 08:17:55

标签: chef

操作系统:debian 7.预装了nginx 1.2.1-2.2 + wheezy4。

我正在写一本应该将nginx升级到最新版本的食谱:

# Remove old versions if found
['nginx', 'nginx-common', 'nginx-full'].each do |pkg|
  package pkg do
    version '1.2.1-2.2+wheezy4'
    action :nothing
  end.run_action(:remove)
end

# Install nginx repository
include_recipe 'chef_nginx::repo'

# Forces nginx installations from nginx repo
apt_preference 'dotdeb' do
  glob 'nginx*'
  pin 'release o=nginx'
  pin_priority '1000'
end

# This should install latest nginx ! But it installs 1.2.1!
package 'nginx'

为什么厨师会安装旧版本的nginx? :(如何强制它重新加载包版本。

# apt-cache policy
...
Pinned packages:
...
nginx -> 1.10.3-1~wheezy

1 个答案:

答案 0 :(得分:0)

Chef不会在内存中跟踪apt / deb版本,所以问题在于apt本身。您可能已经在其他地方阅读了一些令人困惑的指南,因为我们确实为yum进行了一些内部缓存,但这仅适用于yum安装。