2017-03-01 36 views
0

操作系統: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 
+0

指定你想要的版本在上一個'package'nginx''資源中,就像你在第一個那樣。 另外,嘗試登錄到機器並檢查什麼apt-get install nginx'試圖安裝,也許你的repo是錯誤的 – Navarro

+0

我不想使用硬編碼的版本。關於手冊apt-get ..它工作正常..請參閱'apt-cache policy'以上 –

+1

您不必在配方中對其進行硬編碼,使用屬性以便可以在角色/環境/策略的基礎上進行更改。 – Navarro

回答

0

廚師不容易追蹤/ DEB版本在內存中以便問題與APT本身。你可能看過一些混亂的導遊在其他地方,因爲我們確實有一些內部緩存yum,但這隻適用於yum安裝