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
This commit is contained in:
Monty Taylor 2012-07-23 11:54:48 -05:00
parent 5609c50cd5
commit 6bb34219ae
7 changed files with 31 additions and 20 deletions

View File

@ -4,19 +4,12 @@ class github (
$projects = [] $projects = []
) { ) {
package { "python-dev": include pip
ensure => present,
}
package { "python-pip":
ensure => present,
require => Package[python-dev]
}
package { "PyGithub": package { "PyGithub":
ensure => latest, # okay to use latest for pip ensure => latest, # okay to use latest for pip
provider => pip, provider => pip,
require => Package[python-pip] require => Class[pip]
} }
group { "github": group { "github":

View File

@ -1,5 +1,7 @@
class jenkins_jobs($url, $username, $password, $site) { class jenkins_jobs($url, $username, $password, $site) {
include pip
package { 'python-yaml': package { 'python-yaml':
ensure => 'present' ensure => 'present'
} }
@ -37,7 +39,7 @@ class jenkins_jobs($url, $username, $password, $site) {
package { "python-jenkins": package { "python-jenkins":
ensure => latest, # okay to use latest for pip ensure => latest, # okay to use latest for pip
provider => pip, provider => pip,
require => Package[python-pip], require => Class[pip]
} }
} }

View File

@ -4,6 +4,8 @@ class jenkins_master($site, $serveradmin, $logo,
$ssl_chain_file='' $ssl_chain_file=''
) { ) {
include pip
#This key is at http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key #This key is at http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key
apt::key { "D50582E6": apt::key { "D50582E6":
keyid => "D50582E6", keyid => "D50582E6",
@ -87,7 +89,6 @@ class jenkins_master($site, $serveradmin, $logo,
$packages = [ $packages = [
"jenkins", "jenkins",
"python-pip",
"python-babel", "python-babel",
"apache2" "apache2"
] ]
@ -115,19 +116,19 @@ class jenkins_master($site, $serveradmin, $logo,
package { "apache-libcloud": package { "apache-libcloud":
ensure => present, ensure => present,
provider => pip, provider => pip,
require => Package[python-pip] require => Class[pip]
} }
package { "git-review": package { "git-review":
ensure => latest, ensure => latest,
provider => pip, provider => pip,
require => Package[python-pip] require => Class[pip]
} }
package { "tox": package { "tox":
ensure => latest, # okay to use latest for pip ensure => latest, # okay to use latest for pip
provider => pip, provider => pip,
require => Package[python-pip], require => Class[pip],
} }
exec { "update apt cache": exec { "update apt cache":

View File

@ -1,5 +1,7 @@
class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) { class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) {
include pip
if ($user == true) { if ($user == true) {
jenkinsuser { "jenkins": jenkinsuser { "jenkins":
ensure => present, ensure => present,
@ -16,7 +18,6 @@ class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) {
"automake", "automake",
"ccache", "ccache",
"devscripts", "devscripts",
"python-pip",
] ]
# Packages that most jenkins slaves (eg, unit test runners) need # 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", "pep8",
"psmisc", "psmisc",
"pylint", "pylint",
"python-all-dev",
"python-cheetah", "python-cheetah",
"python-libvirt", "python-libvirt",
"python-libxml2", "python-libxml2",
@ -89,7 +89,7 @@ class jenkins_slave($ssh_key, $sudo = false, $bare = false, $user = true) {
package { $pip_packages: package { $pip_packages:
ensure => latest, # we want the latest from these ensure => latest, # we want the latest from these
provider => pip, provider => pip,
require => Package[python-pip], require => Class[pip]
} }
file { 'profilerubygems': file { 'profilerubygems':

View File

@ -1,7 +1,6 @@
class lodgeit { class lodgeit {
$packages = [ "nginx", $packages = [ "nginx",
"python-imaging", "python-imaging",
"python-pip",
"python-jinja2", "python-jinja2",
"python-pybabel", "python-pybabel",
"python-werkzeug", "python-werkzeug",
@ -11,12 +10,14 @@ class lodgeit {
"drizzle", "drizzle",
"python-mysqldb" ] "python-mysqldb" ]
include pip
package { $packages: ensure => present } package { $packages: ensure => present }
package { 'SQLAlchemy': package { 'SQLAlchemy':
provider => pip, provider => pip,
ensure => present, ensure => present,
require => Package[python-pip] require => Class[pip]
} }
file { '/srv/lodgeit': file { '/srv/lodgeit':

View File

@ -0,0 +1,12 @@
class pip {
package { "python-all-dev":
ensure => present
}
package { "python-pip":
ensure => present,
require => Package[python-all-dev]
}
}

View File

@ -6,6 +6,8 @@ class pypimirror ( $base_url,
$projects = [] ) $projects = [] )
{ {
include pip
package { 'nginx': package { 'nginx':
ensure => present, ensure => present,
} }
@ -13,7 +15,7 @@ class pypimirror ( $base_url,
package { 'pip': package { 'pip':
ensure => latest, # okay to use latest for pip ensure => latest, # okay to use latest for pip
provider => 'pip', provider => 'pip',
require => Package['python-pip'], require => Class[pip]
} }
file { '/usr/local/mirror_scripts': file { '/usr/local/mirror_scripts':