From 6bb34219aea2f98d699048427cf6611b6ee308ca Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 23 Jul 2012 11:54:48 -0500 Subject: [PATCH] Move python-pip include to a class. You can't have two different classes install the same package (FAIL) But you can have two different classes include the same class, so by encapsulating the "install pip" code into a module, we can safely consume it across multiple modules. Sometimes I really hate puppet. Change-Id: I3467c52b6887298c1b4d01a29873c63edf0adfd3 --- modules/github/manifests/init.pp | 11 ++--------- modules/jenkins_jobs/manifests/init.pp | 4 +++- modules/jenkins_master/manifests/init.pp | 9 +++++---- modules/jenkins_slave/manifests/init.pp | 6 +++--- modules/lodgeit/manifests/init.pp | 5 +++-- modules/pip/manifests/init.pp | 12 ++++++++++++ modules/pypimirror/manifests/init.pp | 4 +++- 7 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 modules/pip/manifests/init.pp diff --git a/modules/github/manifests/init.pp b/modules/github/manifests/init.pp index b2fc5ce0b7..a32ac233d1 100644 --- a/modules/github/manifests/init.pp +++ b/modules/github/manifests/init.pp @@ -4,19 +4,12 @@ class github ( $projects = [] ) { - package { "python-dev": - ensure => present, - } - - package { "python-pip": - ensure => present, - require => Package[python-dev] - } + include pip package { "PyGithub": ensure => latest, # okay to use latest for pip provider => pip, - require => Package[python-pip] + require => Class[pip] } group { "github": diff --git a/modules/jenkins_jobs/manifests/init.pp b/modules/jenkins_jobs/manifests/init.pp index e79984ba17..33c3b7a1ea 100644 --- a/modules/jenkins_jobs/manifests/init.pp +++ b/modules/jenkins_jobs/manifests/init.pp @@ -1,5 +1,7 @@ class jenkins_jobs($url, $username, $password, $site) { + include pip + package { 'python-yaml': ensure => 'present' } @@ -37,7 +39,7 @@ class jenkins_jobs($url, $username, $password, $site) { package { "python-jenkins": ensure => latest, # okay to use latest for pip provider => pip, - require => Package[python-pip], + require => Class[pip] } } diff --git a/modules/jenkins_master/manifests/init.pp b/modules/jenkins_master/manifests/init.pp index c8bf48e06d..0da211e8dd 100644 --- a/modules/jenkins_master/manifests/init.pp +++ b/modules/jenkins_master/manifests/init.pp @@ -4,6 +4,8 @@ class jenkins_master($site, $serveradmin, $logo, $ssl_chain_file='' ) { + include pip + #This key is at http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key apt::key { "D50582E6": keyid => "D50582E6", @@ -87,7 +89,6 @@ class jenkins_master($site, $serveradmin, $logo, $packages = [ "jenkins", - "python-pip", "python-babel", "apache2" ] @@ -115,19 +116,19 @@ class jenkins_master($site, $serveradmin, $logo, package { "apache-libcloud": ensure => present, provider => pip, - require => Package[python-pip] + require => Class[pip] } package { "git-review": ensure => latest, provider => pip, - require => Package[python-pip] + require => Class[pip] } package { "tox": ensure => latest, # okay to use latest for pip provider => pip, - require => Package[python-pip], + require => Class[pip], } exec { "update apt cache": diff --git a/modules/jenkins_slave/manifests/init.pp b/modules/jenkins_slave/manifests/init.pp index 2fc1f4de32..42c6366abf 100644 --- a/modules/jenkins_slave/manifests/init.pp +++ b/modules/jenkins_slave/manifests/init.pp @@ -1,5 +1,7 @@ class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) { + include pip + if ($user == true) { jenkinsuser { "jenkins": ensure => present, @@ -16,7 +18,6 @@ class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) { "automake", "ccache", "devscripts", - "python-pip", ] # Packages that most jenkins slaves (eg, unit test runners) need @@ -52,7 +53,6 @@ class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) { "pep8", "psmisc", "pylint", - "python-all-dev", "python-cheetah", "python-libvirt", "python-libxml2", @@ -89,7 +89,7 @@ class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) { package { $pip_packages: ensure => latest, # we want the latest from these provider => pip, - require => Package[python-pip], + require => Class[pip] } file { 'profilerubygems': diff --git a/modules/lodgeit/manifests/init.pp b/modules/lodgeit/manifests/init.pp index f53bccad0c..ed9eb7660c 100644 --- a/modules/lodgeit/manifests/init.pp +++ b/modules/lodgeit/manifests/init.pp @@ -1,7 +1,6 @@ class lodgeit { $packages = [ "nginx", "python-imaging", - "python-pip", "python-jinja2", "python-pybabel", "python-werkzeug", @@ -11,12 +10,14 @@ class lodgeit { "drizzle", "python-mysqldb" ] + include pip + package { $packages: ensure => present } package { 'SQLAlchemy': provider => pip, ensure => present, - require => Package[python-pip] + require => Class[pip] } file { '/srv/lodgeit': diff --git a/modules/pip/manifests/init.pp b/modules/pip/manifests/init.pp new file mode 100644 index 0000000000..f10f34ed8c --- /dev/null +++ b/modules/pip/manifests/init.pp @@ -0,0 +1,12 @@ +class pip { + + package { "python-all-dev": + ensure => present + } + + package { "python-pip": + ensure => present, + require => Package[python-all-dev] + } + +} diff --git a/modules/pypimirror/manifests/init.pp b/modules/pypimirror/manifests/init.pp index 4997b73fc5..f08bc5d596 100644 --- a/modules/pypimirror/manifests/init.pp +++ b/modules/pypimirror/manifests/init.pp @@ -6,6 +6,8 @@ class pypimirror ( $base_url, $projects = [] ) { + include pip + package { 'nginx': ensure => present, } @@ -13,7 +15,7 @@ class pypimirror ( $base_url, package { 'pip': ensure => latest, # okay to use latest for pip provider => 'pip', - require => Package['python-pip'], + require => Class[pip] } file { '/usr/local/mirror_scripts':