Skip to content

Commit

Permalink
add selenium::install class with simple download support
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Oct 1, 2013
1 parent eb724de commit b08a9b9
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ fixtures:
"stdlib":
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "3.0.0"
"wget":
repo: "git://github.com/maestrodev/puppet-wget.git"
ref: "v1.2.2"
symlinks:
"selenium": "#{source_dir}"
1 change: 1 addition & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ source 'https://github.com/jhoblitt/puppet-selenium.git'
summary 'module skeleton'
description 'module skeleton'
dependency 'puppetlabs/stdlib', '>= 3.0.0'
dependency 'maestrodev/wget', '>= 0.0.1'
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-lint/tasks/puppet-lint'

PuppetSyntax.exclude_paths = ["spec/fixtures/**/*"]
#PuppetLint.configuration.send("disable_class_inherits_from_params_class")
PuppetLint.configuration.send("disable_class_inherits_from_params_class")
#PuppetLint.configuration.send("disable_variable_scope")
PuppetLint.configuration.ignore_paths = ['pkg/**/*.pp', 'spec/**/*.pp', 'tests/**/*.pp']

Expand Down
62 changes: 62 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# == Class: megaraid::lsiget
#
# installs the `lsiget` utility for LSI MegaRAID controllers
#
# See: http://mycusthelp.info/LSI/_cs/AnswerDetail.aspx?inc=8264
#
#
# === Parameters
#
# Accepts no parameters.
#
#
# === Examples
#
# class{ 'megaraid::lsiget': }
#
#
# === Authors
#
# Joshua Hoblitt <jhoblitt@cpan.org>
#
#
class selenium::install(
$version = '2.35.0',
$url = undef,
) inherits selenium::server {
validate_string($version)
validate_string($url)

include wget

$jar_name = "selenium-server-standalone-${version}.jar"

if $url {
$jar_url = $url
} else {
$jar_url = "https://selenium.googlecode.com/files/${jar_name}"
}

File {
owner => $selenium::server::user,
group => $selenium::server::group,
}

file { $selenium::server::install_path:
ensure => directory,
}

$jar_path = "${selenium::server::install_path}/jars"

file { $jar_path:
ensure => directory,
}

wget::fetch { 'selenium-server-standalone':
source => $jar_url,
destination => "${selenium::server::jar_path}/${jar_name}",
timeout => 30,
require => File[$jar_path],
}

}
5 changes: 3 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#
#
class selenium::params {
$user = 'selenium'
$group = $user
$user = 'selenium'
$group = $user
$install_path = '/opt/selenium'

case $::osfamily {
'redhat': {}
Expand Down
6 changes: 3 additions & 3 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
# include selenium::server
#
class selenium::server(
$user = $selenium::params::user,
$group = $selenium::params::group,
$user = $selenium::params::user,
$group = $selenium::params::group,
$install_path = $selenium::params::install_path,
) inherits selenium::params {
validate_string($user)
validate_string($group)

user { $user:
managehome => true,
gid => [$group],
}
group { $group: }
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/selenium_install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe 'selenium::install' do
let(:title) { 'redhat' }
let(:facts) {{ :osfamily=> 'RedHat' }}

it do
should include_class('wget')
should contain_class('selenium::install').with_version('2.35.0')
should contain_file('/opt/selenium').with_ensure('directory')
should contain_wget__fetch('selenium-server-standalone')
end

end

0 comments on commit b08a9b9

Please sign in to comment.