Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
reorganized pythonbrew using puppet standards
  • Loading branch information
ashwoods committed Feb 23, 2012
1 parent 2aef5e9 commit d21096d
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 17 deletions.
8 changes: 0 additions & 8 deletions manifests/dependencies.pp

This file was deleted.

54 changes: 48 additions & 6 deletions manifests/init.pp
@@ -1,11 +1,53 @@
# Class: pythonbrew
#
# This module manages pythonbrew python's.
#
# Parameters:
#
# There are no default parameters for this class. All module parameters are managed
# via the nginx::params class
#
# Actions:
#
# Requires:
# puppetlabs-stdlib - https://github.com/puppetlabs/puppetlabs-stdlib
#
# stdlib
# - puppetlabs-stdlib module >= 0.1.6
# - plugin sync enabled to obtain the anchor type
#
# Sample Usage:
#
# The module works with sensible defaults:
#
# node default {
# include pythonbrew
# }
class pythonbrew {

class pythonbrew($user='root') {
anchor {'pythonbrew::begin'}
anchor {'pythonbrew::end'}
class { 'stdlib': }

class { 'pythonbrew::package':
notify => Exec['pythonbrew::install'],
}

class { 'pythonbrew::params':
require => Class['pythonbrew::package'],
notify => Exec['pythonbrew::install'],
}

exec {'pythonbrew::install':
command => "curl -kL http://xrl.us/pythonbrewinstall | bash",
require => Class['pythonbrew::dependencies'],
user => $user,
}
require => Class['pythonbrew::package'],
user => $pythonbrew::params::user,
}

anchor {'pythonbrew::begin':
before => Class['pythonbrew::package'],
notify => Exec['pythonbrew::install']
}
anchor {'pythonbrew::end':
require => Exec['pythonbrew::install'],
}

}
31 changes: 31 additions & 0 deletions manifests/package.pp
@@ -0,0 +1,31 @@
# Class: pythonbrew::dependencies
#
# Takes care of system dependencies
# Currently only works for ubuntu/debian
# patches for centos and suse welcome

class pythonbrew::package {
anchor { 'pythonbrew::package::begin': }
anchor { 'pythonbrew::package::end': }

case $::operatingsystem {
centos,fedora,rhel: {
class { 'pythonbrew::package::redhat':
require => Anchor['pythonbrew::package::begin'],
before => Anchor['pythonbrew::package::end'],
}
}
debian,ubuntu: {
class { 'pythonbrew::package::debian':
require => Anchor['pythonbrew::package::begin'],
before => Anchor['pythonbrew::package::end'],
}
}
opensuse,suse: {
class { 'pythonbrew::package::suse':
require => Anchor['pythonbrew::package::begin'],
before => Anchor['pythonbrew::package::end'],
}
}
}
}
@@ -1,4 +1,4 @@
class pythonbrew::dependencies::ubuntu {
class pythonbrew::package::debian {

if ! defined(Package['curl']) { package { 'curl': ensure => installed } }
if ! defined(Package['build-essential']) { package { 'build-essential': ensure => installed } }
Expand Down
Empty file added manifests/package/redhat.pp
Empty file.
Empty file added manifests/package/suse.pp
Empty file.
19 changes: 19 additions & 0 deletions manifests/params.pp
@@ -0,0 +1,19 @@
# Class: nginx::params
#
# This module manages pythonbrew paramaters
#
# Parameters:
#
# There are no default parameters for this class.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# This class file is not called directly
class pythonbrew::params {
$user = 'root'
$build_opt = ''
}
2 changes: 0 additions & 2 deletions manifests/version.pp
Expand Up @@ -4,8 +4,6 @@
$test => 'false',
) {

require => Anchor['pythonbrew::end']

if $ensure == 'present' {
exec { "install-python-${name}":
command => "pythonbrew install ${name} -n",
Expand Down

0 comments on commit d21096d

Please sign in to comment.