From fabf5e90cb6ec5787fb0fad7a7e30d75e6ed6971 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Mon, 18 Jun 2012 10:09:06 +0300 Subject: [PATCH] Added support for collab auth in vsroom, templated config.json Class vsroom::collab installs auth_credentials.php in collab htdocs and sets the authUrl variable in config.json accordingly. --- vsroom/files/config.json | 4 --- vsroom/manifests/init.pp | 56 +++++++++++++++++++++++++++++--- vsroom/templates/config.json.erb | 4 +++ 3 files changed, 56 insertions(+), 8 deletions(-) delete mode 100644 vsroom/files/config.json create mode 100644 vsroom/templates/config.json.erb diff --git a/vsroom/files/config.json b/vsroom/files/config.json deleted file mode 100644 index 4ac2ae1..0000000 --- a/vsroom/files/config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "authUrl": "../common/auth_credentials.php", - "boshUrl": "/bosh/" -} diff --git a/vsroom/manifests/init.pp b/vsroom/manifests/init.pp index 48d9915..4895c82 100644 --- a/vsroom/manifests/init.pp +++ b/vsroom/manifests/init.pp @@ -1,7 +1,57 @@ -# Install vsroom. +# Install standalone vsroom. +# +# === Global variables +# +# $vsroom_authurl: +# Authentication path. Defaults to "../common/auth_credentials.php". +# +# $vsroom_boshurl: +# XMPP BOSH path. Defaults to "/bosh/". # class vsroom { + if !$vsroom_authurl { + $vsroom_authurl = "../common/auth_credentials.php" + } + if !$vsroom_boshurl { + $vsroom_boshurl = "/bosh/" + } + + include vsroom::common + +} + + +# Install vsroom with collab authentication. +# +class vsroom::collab { + + if !$vsroom_authurl { + $vsroom_authurl = "/collab/auth_credentials.php" + } + if !$vsroom_boshurl { + $vsroom_boshurl = "/bosh/" + } + + include vsroom::common + + file { "/srv/wikis/collab/htdocs/auth_credentials.php": + ensure => present, + mode => "0660", + owner => "collab", + group => "collab", + source => "/usr/share/vsroom/htdocs/common/auth_credentials.php", + require => [ File["/srv/wikis/collab/htdocs"], + Python::Setup::Install["/usr/local/src/vsroom"], ], + } + +} + + +# Install common vsroom components. +# +class vsroom::common { + case $operatingsystem { centos: { case $operatingsystemrelease { @@ -75,9 +125,7 @@ class vsroom { mode => "0644", owner => "root", group => "root", - source => [ "puppet:///files/vsroom/config.json.${fqdn}", - "puppet:///files/vsroom/config.json", - "puppet:///modules/vsroom/config.json", ], + content => template("vsroom/config.json.erb"), require => Python::Setup::Install["/usr/local/src/vsroom"], } diff --git a/vsroom/templates/config.json.erb b/vsroom/templates/config.json.erb new file mode 100644 index 0000000..034724a --- /dev/null +++ b/vsroom/templates/config.json.erb @@ -0,0 +1,4 @@ +{ + "authUrl": "<%= vsroom_authurl %>", + "boshUrl": "<%= vsroom_boshurl %>" +}