[chef] Re: Package provider


Chronological Thread 
  • From: Brian Hatfield < >
  • To:
  • Subject: [chef] Re: Package provider
  • Date: Mon, 20 May 2013 07:11:14 -0400

One of the core 'ideas' of chef is idempotence, and although sometimes it can take some work on your part to get there, it generally achieves this goal.

Which means if you tell chef "package 'xmltolk'", which has a default action of install, and that package (any version) is installed, then Chef will rightly say "package is installed - system is in described state!".

:upgrade is not the default action for the package resource because it's not really idempotent (running it twice may not lead to the same results).

So long story short, use 'action :upgrade'. There's other ways to achieve your goal, such as specifying a version string, which can be found documented here: http://docs.opscode.com/resource_package.html

Brian


On Mon, May 20, 2013 at 2:50 AM, Jens Skott < " target="_blank"> > wrote:
Hello, we run chef11 and an internal repo for RPM:s (satellite).
Since we do releases to stage and test every few hours every day of the week we need the nodes to install new packages often. 
When we found out the RPMS didnt get installed we did some digging.
Got this out of shef:
chef > recipe_mode
chef:recipe > package "xmltolk"
 => <package[xmltolk] @name: "xmltolk" @noop: nil @before: nil @params: {} @provider: nil @allowed_actions: [:nothing, :install, :upgrade, :remove, :purge, :reconfig] @action: :install @updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @source_line: "(irb#1):1:in `irb_binding'" @elapsed_time: 0 @candidate_version: nil @options: nil @package_name: "xmltolk" @resource_name: :package @response_file: nil @source: nil @version: nil @cookbook_name: nil @recipe_name: nil> 
chef:recipe > chef_run
 => nil 
chef:recipe > run_chef
[2013-05-17T14:17:01+02:00] INFO: Processing package[xmltolk] action install ((irb#1) line 1)
[2013-05-17T14:17:06+02:00] DEBUG: package[xmltolk] checking yum info for xmltolk
[2013-05-17T14:17:06+02:00] DEBUG: package[xmltolk] installed version: STAGE-3 candidate version: STAGE-4
[2013-05-17T14:17:06+02:00] DEBUG: package[xmltolk] is already installed - nothing to do

the recipe itself has:

package "xmltolk" do
action [:install]
end

If we do an upgrade it works fine, but we want to recipe just to contain 
package "xmltolk" 

Any suggestions

Jens Skott 
Schibsted Centralen IT





Archive powered by MHonArc 2.6.16.

§