Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00e5bd9

Browse files
author
Peter Bell
committed
merged check_upgrade branch
2 parents f1ce6e7 + 3eec94c commit 00e5bd9

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

Berksfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ site :opscode
22

33
metadata
44

5+
cookbook "chef-sugar"
6+
57
group :integration do
68
cookbook "minitest-handler"
79
cookbook "apt"

metadata.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
depends "build-essential"
99
depends "yum-epel"
10+
depends "chef-sugar"
1011

1112
recipe "python", "Installs python, pip, and virtualenv"
1213
recipe "python::package", "Installs python using packages."

providers/pip.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
require 'chef/mixin/shell_out'
2222
require 'chef/mixin/language'
23-
require 'versionub'
23+
require 'chef/sugar/core_extensions'
2424
include Chef::Mixin::ShellOut
2525

2626
def whyrun_supported?
@@ -128,10 +128,17 @@ def candidate_version
128128
if out.match(/not installed/) then
129129
new_resource.version||'latest'
130130
elsif out.match(/#{new_resource.package_name} [\d\.]+ \([\d\.]+\)/) then
131+
<<<<<<< HEAD
131132
available_version = Versionub.parse(out.split(' ').last.tr('()',''))
132133
if ! new_resource.version
133134
available_version.to_s
134135
elsif available_version > Versionub.parse(new_resource.version)
136+
=======
137+
available_version = out.split(' ').last.tr('()','')
138+
if ! new_resource.version
139+
available_version
140+
elsif available_version.satisfies?(">= #{new_resource.version}")
141+
>>>>>>> check_upgrade
135142
new_resource.version
136143
else
137144
available_version.to_s

recipes/pip.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
pip_binary = "/usr/local/bin/pip"
3434
end
3535

36-
chef_gem 'versionub' do
37-
action :nothing
38-
end.run_action(:install)
39-
4036
cookbook_file "#{Chef::Config[:file_cache_path]}/get-pip.py" do
4137
source 'get-pip.py'
4238
mode "0644"

0 commit comments

Comments
 (0)