[chef] Re: Re: Re: How would I prevent python_pip from installing packages that are already installed?


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: Re: How would I prevent python_pip from installing packages that are already installed?
  • Date: Fri, 6 Mar 2015 16:32:22 -0800



On Friday, March 6, 2015 at 2:39 PM, Fabien Delpierre wrote:

> Daniel,
> Setting the version like:
> python_pip 'package' do
> version 'x'
> ...
> end
> ...sounds like something I should be able to figure out. I have a 
> requirements file that looks like this:
> package==version
> And a long list of packages.

Ruby’s pretty good for quick and dirty scripting of this kind of thing. 
Something like this should work:

require ‘pp’ # just for debugging/showing the example

names_and_version_specs = IO.readlines('/tmp/example.txt')
names_and_versions = names_and_version_specs.map do |line|
  line.strip.split('==')
end

# debug
pp names_and_versions

# do something like this in your recipe:
# names_and_versions.each do |name, pkg_version|
# python_pip name do
# version pkg_version
# end
# end



HTH,

--  
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§