Parameterized working directories.

The install directories into which the storyboard api and client
are downloaded and processed are now parameterized.

Change-Id: Ic67a0730246bc7fcf38cc98e460381994ab9d736
This commit is contained in:
Michael Krotscheck 2015-02-19 10:46:31 -08:00 committed by Monty Taylor
parent 9cff9d2142
commit a26207e35d

View File

@ -21,6 +21,8 @@
class storyboard::application ( class storyboard::application (
# Installation parameters # Installation parameters
$src_root_api = '/opt/storyboard',
$src_root_webclient = '/opt/storyboard-webclient',
$install_root = '/var/lib/storyboard', $install_root = '/var/lib/storyboard',
$www_root = '/var/lib/storyboard/www', $www_root = '/var/lib/storyboard/www',
$working_root = '/var/lib/storyboard/spool', $working_root = '/var/lib/storyboard/spool',
@ -110,7 +112,7 @@ class storyboard::application (
} }
# Download the latest StoryBoard Source # Download the latest StoryBoard Source
vcsrepo { '/opt/storyboard': vcsrepo { $src_root_api:
ensure => latest, ensure => latest,
provider => git, provider => git,
revision => 'master', revision => 'master',
@ -120,10 +122,10 @@ class storyboard::application (
# Run pip # Run pip
exec { 'install-storyboard' : exec { 'install-storyboard' :
command => 'pip install /opt/storyboard', command => "pip install ${src_root_api}",
path => '/usr/local/bin:/usr/bin:/bin/', path => '/usr/local/bin:/usr/bin:/bin/',
refreshonly => true, refreshonly => true,
subscribe => Vcsrepo['/opt/storyboard'], subscribe => Vcsrepo[$src_root_api],
notify => Service['httpd'], notify => Service['httpd'],
require => [ require => [
Class['apache::params'], Class['apache::params'],
@ -154,7 +156,7 @@ class storyboard::application (
# Install the wsgi app # Install the wsgi app
file { "${install_root}/storyboard.wsgi": file { "${install_root}/storyboard.wsgi":
source => '/opt/storyboard/storyboard/api/app.wsgi', source => "${src_root_api}/storyboard/api/app.wsgi",
owner => $storyboard::params::user, owner => $storyboard::params::user,
group => $storyboard::params::group, group => $storyboard::params::group,
require => [ require => [
@ -180,7 +182,7 @@ class storyboard::application (
notify => Service['httpd'], notify => Service['httpd'],
} }
file { '/opt/storyboard-webclient': file { $src_root_webclient:
ensure => directory, ensure => directory,
owner => $storyboard::params::user, owner => $storyboard::params::user,
group => $storyboard::params::group, group => $storyboard::params::group,
@ -190,8 +192,8 @@ class storyboard::application (
exec { 'get-webclient': exec { 'get-webclient':
command => "curl ${webclient_url} -z ./${webclient_filename} -o ${webclient_filename}", command => "curl ${webclient_url} -z ./${webclient_filename} -o ${webclient_filename}",
path => '/bin:/usr/bin', path => '/bin:/usr/bin',
cwd => '/opt/storyboard-webclient', cwd => $src_root_webclient,
require => File['/opt/storyboard-webclient'], require => File[$src_root_webclient],
onlyif => "curl -I ${webclient_url} -z ./${webclient_filename} | grep '200 OK'", onlyif => "curl -I ${webclient_url} -z ./${webclient_filename} | grep '200 OK'",
} }
@ -200,13 +202,13 @@ class storyboard::application (
command => "tar -xzf ./${webclient_filename}", command => "tar -xzf ./${webclient_filename}",
path => '/bin:/usr/bin', path => '/bin:/usr/bin',
refreshonly => true, refreshonly => true,
cwd => '/opt/storyboard-webclient', cwd => $src_root_webclient,
require => Exec['get-webclient'], require => Exec['get-webclient'],
subscribe => Exec['get-webclient'], subscribe => Exec['get-webclient'],
} }
# Create config.json # Create config.json
file { '/opt/storyboard-webclient/dist/config.json': file { "${src_root_webclient}/dist/config.json":
ensure => file, ensure => file,
content => '{}', content => '{}',
require => Exec['unpack-webclient'], require => Exec['unpack-webclient'],
@ -217,8 +219,8 @@ class storyboard::application (
ensure => directory, ensure => directory,
owner => $storyboard::params::user, owner => $storyboard::params::user,
group => $storyboard::params::group, group => $storyboard::params::group,
require => File['/opt/storyboard-webclient/dist/config.json'], require => File["${src_root_webclient}/dist/config.json"],
source => '/opt/storyboard-webclient/dist', source => "${src_root_webclient}/dist",
recurse => true, recurse => true,
purge => true, purge => true,
force => true, force => true,