From 226c15c8293d8f13cc011118cc1aaef1a3123337 Mon Sep 17 00:00:00 2001 From: Tristan Rivoallan Date: Tue, 12 Sep 2017 12:09:28 +0200 Subject: [PATCH 1/3] Chef 13 compatibility Updated cookbook so that it depends on "poise-python" cookbook instead of the deprecated "python" cookbook --- .kitchen.yml | 16 ++++------------ Berksfile | 2 +- metadata.rb | 18 +++++++++--------- recipes/default.rb | 7 +++---- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 9870362..c261e35 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,21 +1,13 @@ driver: name: vagrant - require_chef_omnibus: true - -chef_versions: -- 11 -- 12 + require_chef_omnibus: 13 platforms: -- name: ubuntu-12.04 - run_list: - - recipe[apt] -- name: ubuntu-10.04 - run_list: - - recipe[apt] -- name: centos-6.4 +- name: ubuntu-16.04 +- name: debian-9 suites: - name: default run_list: + - recipe[apt] - recipe[supervisor] diff --git a/Berksfile b/Berksfile index 54c9d88..57c4aec 100644 --- a/Berksfile +++ b/Berksfile @@ -1,4 +1,4 @@ -site :opscode +source 'https://supermarket.chef.io' metadata group :integration do diff --git a/metadata.rb b/metadata.rb index 7eee14e..6fce9be 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,14 +1,14 @@ -name "supervisor" -maintainer "Noah Kantrowitz" -maintainer_email "noah@coderanger.net" -license "Apache 2.0" -description "Installs supervisor and provides resources to configure services" -version "0.4.12" +name 'supervisor' +maintainer 'Noah Kantrowitz' +maintainer_email 'noah@coderanger.net' +license 'Apache 2.0' +description 'Installs supervisor and provides resources to configure services' +version '0.5.0' -recipe "supervisor", "Installs and configures supervisord" +recipe 'supervisor', 'Installs and configures supervisord' -depends "python" +depends 'poise-python', '~> 1.6.0' -%w{ ubuntu debian redhat centos fedora amazon smartos raspbian }.each do |os| +%w( ubuntu debian redhat centos fedora amazon smartos raspbian ).each do |os| supports os end diff --git a/recipes/default.rb b/recipes/default.rb index b2df96f..6790068 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -17,8 +17,6 @@ # limitations under the License. # -include_recipe "python" - # foodcritic FC023: we prefer not having the resource on non-smartos if platform_family?("smartos") package "py27-expat" do @@ -26,7 +24,8 @@ end end -python_pip "supervisor" do +package 'python-pip' +python_package "supervisor" do action :upgrade version node['supervisor']['version'] if node['supervisor']['version'] end @@ -85,7 +84,7 @@ variables({ # TODO: use this variable in the debian platform-family template # instead of altering the PATH and calling "which supervisord". - :supervisord => "#{node['python']['prefix_dir']}/bin/supervisord" + :supervisord => "/usr/bin/supervisord" }) end From 9c0943b254d92418d1b8834d9fa89823d5e4e293 Mon Sep 17 00:00:00 2001 From: Tristan Rivoallan Date: Tue, 12 Sep 2017 14:55:05 +0200 Subject: [PATCH 2/3] Compatibility with older distributions --- .kitchen.yml | 2 ++ recipes/default.rb | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index c261e35..20dd438 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -4,7 +4,9 @@ driver: platforms: - name: ubuntu-16.04 +- name: ubuntu-14.04 - name: debian-9 +- name: debian-8 suites: - name: default diff --git a/recipes/default.rb b/recipes/default.rb index 6790068..54787b6 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -17,6 +17,11 @@ # limitations under the License. # +# Install +python_runtime 'supervisor' do + version '2.7' +end + # foodcritic FC023: we prefer not having the resource on non-smartos if platform_family?("smartos") package "py27-expat" do @@ -24,9 +29,9 @@ end end -package 'python-pip' python_package "supervisor" do action :upgrade + python 'supervisor' version node['supervisor']['version'] if node['supervisor']['version'] end @@ -84,7 +89,7 @@ variables({ # TODO: use this variable in the debian platform-family template # instead of altering the PATH and calling "which supervisord". - :supervisord => "/usr/bin/supervisord" + :supervisord => "/usr/local/bin/supervisord" }) end From 32756eea6a88929b08e0286d12077c63973689aa Mon Sep 17 00:00:00 2001 From: Tristan Rivoallan Date: Fri, 15 Sep 2017 11:35:59 +0200 Subject: [PATCH 3/3] More flexible Python dependency --- recipes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/default.rb b/recipes/default.rb index 54787b6..f3a1c93 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -19,7 +19,7 @@ # Install python_runtime 'supervisor' do - version '2.7' + version '2' end # foodcritic FC023: we prefer not having the resource on non-smartos