This is the initial commit of the savanna puppet module.

Installs the OpenStack savanna UI and backend. Example of
use can be seen in example/example.pp

Change-Id: I3b994f70690078d37a42308f9985712e2f398924
Implements: blueprint puppet-savanna
This commit is contained in:
Andy Edmonds
2013-11-23 17:37:47 +01:00
parent 9d67e8ba8f
commit d6f9e60ad2
18 changed files with 1072 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.project

26
Modulefile Normal file
View File

@@ -0,0 +1,26 @@
# Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
name 'puppet-savanna'
version '0.0.1'
source 'https://github.com/stackforge/puppet-savanna'
author 'andy@edmonds.be'
license 'Apache License, Version 2.0'
summary 'Installs the savanna backend'
description 'Installs the savanna backend and can also install the savanna UI in OpenStack horizon'
project_page 'https://github.com/stackforge/puppet-savanna'
## Add dependencies, if any:
# dependency 'username/name', '>= 1.2.0'

11
README.md Normal file
View File

@@ -0,0 +1,11 @@
# puppet-savanna
Installs the OpenStack [savanna UI and backend](https://launchpad.net/savanna)
If you want an example of how it's used see example/example.pp.
Pull requests and suggestions gladly received!
If you wish to participate in the Savanna project please
[see the Savanna OpenStack wiki page](http://docs.openstack.org/developer/savanna/devref/how_to_participate.html)
for more information.

24
example/example.pp Normal file
View File

@@ -0,0 +1,24 @@
class { 'savanna::db::mysql': password => 'savanna', }
class { 'savanna::keystone::auth':
password => 'savanna',
public_address => '127.0.0.1',
admin_address => '127.0.0.1',
internal_address => '127.0.0.1',
}
class { 'savanna':
savanna_host => '127.0.0.1',
db_host => '127.0.0.1',
savanna_db_password => 'savanna',
keystone_auth_host => '127.0.0.1',
keystone_password => 'savanna',
savanna_verbose => true,
}
class { 'savanna::dashboard':
savanna_host => '127.0.0.1',
use_neutron => true,
require => Class['Openstack::Horizon']
}

82
manifests/dashboard.pp Normal file
View File

@@ -0,0 +1,82 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Used to install savanna's horizon component
#
class savanna::dashboard (
$savanna_host = '127.0.0.1',
$savanna_port = '8386',
$use_neutron = false,
) {
include savanna::params
if use_neutron {
$neutron = 'True'
} else {
$neutron = 'False'
}
if !defined(Package['python-pip']) {
package { 'python-pip': ensure => latest, }
}
if $savanna::params::development {
info('Installing the developement version of savanna dashboard')
exec { 'savannadashboard':
command => "pip install ${::savanna::params::development_dashboard_build_url}",
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
unless => 'stat /usr/local/lib/python2.7/dist-packages/savannadashboard',
require => Package['python-pip'],
}
} else {
package { 'savanna-dashboard':
ensure => installed,
provider => pip,
require => Package['python-pip'],
}
}
exec { 'savanna-horizon-config':
command => "echo \"HORIZON_CONFIG['dashboards'] += ('savanna',)\" >> ${savanna::params::horizon_settings}",
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
unless => "grep \"HORIZON_CONFIG\['dashboards'\] +=\" ${savanna::params::horizon_settings}",
require => Package['savanna-dashboard'],
}
exec { 'savanna-installed-apps':
command => "echo \"INSTALLED_APPS += ('savannadashboard',)\" >> ${savanna::params::horizon_settings}",
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
unless => "grep \"INSTALLED_APPS +=\" ${savanna::params::horizon_settings}",
require => Package['savanna-dashboard'],
}
exec { 'savanna-use-neutron':
command => "echo 'SAVANNA_USE_NEUTRON = ${neutron}' >> ${savanna::params::horizon_local_settings}",
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
unless => "grep \"SAVANNA_USE_NEUTRON\" ${savanna::params::horizon_local_settings}",
require => Package['savanna-dashboard'],
}
exec { 'savanna-url':
command => "echo \"SAVANNA_URL = 'http://${savanna_host}:${savanna_port}/v1.1'\" >> ${savanna::params::horizon_local_settings}",
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
unless => "grep \"SAVANNA_URL\" ${savanna::params::horizon_local_settings}",
require => Package['savanna-dashboard'],
}
}

53
manifests/db/mysql.pp Normal file
View File

@@ -0,0 +1,53 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Used to create the savanna db
#
class savanna::db::mysql (
$password = 'savanna',
$dbname = 'savanna',
$user = 'savanna',
$host = '127.0.0.1',
$allowed_hosts = undef, # ['127.0.0.1'],
$charset = 'latin1',) {
Class['mysql::server'] -> Class['savanna::db::mysql']
require mysql::python
mysql::db { $dbname:
user => $user,
password => $password,
host => $host,
charset => $charset,
require => Class['mysql::config'],
}
# Check allowed_hosts to avoid duplicate resource declarations
if is_array($allowed_hosts) and delete($allowed_hosts, $host) != [] {
$real_allowed_hosts = delete($allowed_hosts, $host)
} elsif is_string($allowed_hosts) and ($allowed_hosts != $host) {
$real_allowed_hosts = $allowed_hosts
}
if $real_allowed_hosts {
savanna::db::mysql::host_access { $real_allowed_hosts:
user => $user,
password => $password,
database => $dbname,
}
}
}

View File

@@ -0,0 +1,33 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Used to grant access to the savanna mysql DB
#
define savanna::db::mysql::host_access ($user, $password, $database) {
database_user { "${user}@${name}":
password_hash => mysql_password($password),
provider => 'mysql',
require => Database[$database],
}
database_grant { "${user}@${name}/${database}":
# TODO figure out which privileges to grant.
privileges => 'all',
provider => 'mysql',
require => Database_user["${user}@${name}"]
}
}

109
manifests/init.pp Normal file
View File

@@ -0,0 +1,109 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# == Class: savanna
#
# Installs the savanna backend.
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*savanna_host*]
# The host on which the savanna process (API) runs. Defaults to '127.0.0.1'
# [*savanna_port*]
# The port on which the savanna process (API) runs on. Defaults to 3836
# [*db_host*]
# The host where the database is running. Savanna will use this to persist
# information about clusters. Defaults to '127.0.0.1'
# [*savanna_db_name*]
# [*savanna_db_password*]
# [*keystone_auth_protocol*]
# Defaults to 'http',
# [*keystone_auth_host*]
# Defaults to '127.0.0.1'
# [*keystone_auth_port*]
# Defaults to '35357'
# [*keystone_user*]
# Defaults to 'savanna'
# [*keystone_password*]
# Defaults to 'savanna'
# [*keystone_tenant*]
# Defaults to undef
# [*savanna_verbose*]
# Defaults to false
# [*savanna_debug*]
# Defaults to false
# === Examples
#
# class{'savanna':
# savanna_host => '127.0.0.1',
# db_host => '127.0.0.1',
# savanna_db_password => 'savanna',
# keystone_auth_host => '127.0.0.1',
# keystone_password => 'admin',
# savanna_verbose => True,
#}
#
# === Authors
#
# Andy Edmonds <andy@edmonds.be>
#
#
# TODOs
# - need to install disk builder and create image
# or generate and install
# - use a puppet type for configuration file
# - clean up documentation
class savanna (
$savanna_host = '127.0.0.1',
$savanna_port = '8386',
$savanna_verbose = false,
$savanna_debug = false,
# db
$db_host = '127.0.0.1',
$savanna_db_name = 'savanna',
$savanna_db_user = 'savanna',
$savanna_db_password = 'savanna',
# keystone
$keystone_auth_protocol = 'http',
$keystone_auth_host = '127.0.0.1',
$keystone_auth_port = '35357',
$keystone_user = 'savanna',
$keystone_password = 'savanna',
$keystone_tenant = undef,) {
include savanna::params
# move keystone and db classes here?
if !$keystone_tenant {
$int_keystone_tenant = $keystone_user
} else {
$int_keystone_tenant = $keystone_tenant
}
class { '::savanna::install':
} ->
class { '::savanna::service': }
}

124
manifests/install.pp Normal file
View File

@@ -0,0 +1,124 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class savanna::install {
include savanna::params
# this is here until this fix is released
# https://bugs.launchpad.net/ubuntu/+source/python-pbr/+bug/1245676
if !defined(Package['git']) {
package { 'python-pip': ensure => latest, }
}
if !defined(Package['python-pip']) {
package { 'python-pip':
ensure => latest,
require => Package['git']
}
}
if !defined(Package['python-dev']) {
package { 'python-dev':
ensure => latest,
require => Package['python-pip']
}
}
if $savanna::params::development {
info("Installing and using the savanna development version. URL:
${savanna::params::development_build_url}")
exec { 'savanna':
command => "pip install ${savanna::params::development_build_url}",
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
unless => 'stat /usr/local/lib/python2.7/dist-packages/savanna',
require => Package['python-pip'],
}
} else {
package { 'savanna':
ensure => installed,
provider => pip,
require => Package['python-pip'],
}
}
group { 'savanna':
ensure => present,
system => true,
} ->
user { 'savanna':
ensure => present,
gid => 'savanna',
system => true,
home => '/var/lib/savanna',
shell => '/bin/false'
} ->
file { '/var/lib/savanna':
ensure => 'directory',
owner => 'savanna',
group => 'savanna',
mode => '0750',
} ->
file { '/var/log/savanna':
ensure => 'directory',
owner => 'savanna',
group => 'savanna',
mode => '0750',
} ->
file { '/var/log/savanna/savanna.log':
ensure => 'file',
owner => 'savanna',
group => 'savanna',
mode => '0640',
} ->
file { '/etc/savanna':
ensure => 'directory',
owner => 'savanna',
group => 'savanna',
mode => '0750',
} ->
file { '/etc/savanna/savanna.conf':
ensure => file,
path => '/etc/savanna/savanna.conf',
content => template('savanna/savanna.conf.erb'),
owner => 'savanna',
group => 'savanna',
mode => '0640',
}
if $::osfamily == 'Debian' {
file { '/etc/init.d/savanna-api':
ensure => file,
path => '/etc/init.d/savanna-api',
content => template('savanna/savanna-api.erb'),
mode => '0750',
owner => 'root',
group => 'root',
} ->
file { '/etc/savanna/savanna-api.conf':
ensure => file,
path => '/etc/init/savanna-api.conf',
content => template('savanna/savanna-api.conf.erb'),
mode => '0750',
owner => 'root',
group => 'root',
notify => Service['savanna-api'],
}
} else {
error('Savanna cannot be installed on this operating system.
It does not have the supported initscripts. There is only
support for Debian-based systems.')
}
}

View File

@@ -0,0 +1,73 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Used to setup the savanna keystone user
#
class savanna::keystone::auth (
$password = 'savanna',
$auth_name = 'savanna',
$email = 'savanna@localhost',
$tenant = 'services',
$configure_endpoint = true,
$service_type = 'mapreduce',
$public_address = '127.0.0.1',
$admin_address = '127.0.0.1',
$internal_address = '127.0.0.1',
$port = '8386',
$public_port = undef,
$region = 'RegionOne',
$public_protocol = 'http',
$internal_protocol = 'http',
) {
Keystone_user_role["${auth_name}@${tenant}"] ~>
Service <| name == 'savanna-api' |>
if !$public_port {
$real_public_port = $port
} else {
$real_public_port = $public_port
}
keystone_user { $auth_name:
ensure => present,
password => $password,
email => $email,
tenant => $tenant,
}
keystone_user_role { "${auth_name}@${tenant}":
ensure => present,
roles => 'admin',
}
keystone_service { $auth_name:
ensure => present,
type => $service_type,
description => 'Savanna MapReduce Service',
}
if $configure_endpoint {
keystone_endpoint { "${region}/${auth_name}":
ensure => present,
public_url =>
"${public_protocol}://${public_address}:${real_public_port}/",
internal_url => "${internal_protocol}://${internal_address}:${port}/",
admin_url => "${internal_protocol}://${admin_address}:${port}/",
}
}
}

38
manifests/params.pp Normal file
View File

@@ -0,0 +1,38 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class savanna::params {
$sys_rundir = '/var/run'
$savanna_service = 'savanna-api'
$savanna_logdir = '/var/log/savanna'
$savanna_rundir = '/var/run/savanna'
$savanna_lockdir = '/var/lock/savanna'
$savanna_conf_file = '/etc/savanna/savanna.conf'
$savanna_syslog = false
$savanna_usefips = false
$savanna_node_domain = 'novalocal'
# installs source version from github builds
$development = false
$development_build_url =
'http://tarballs.openstack.org/savanna/savanna-master.tar.gz'
$development_dashboard_build_url =
'http://tarballs.openstack.org/savanna-dashboard/savanna-dashboard-master.tar.gz'
# these two paths are OS specific - on redhat they're diff
$horizon_settings =
'/usr/share/openstack-dashboard/openstack_dashboard/settings.py'
$horizon_local_settings =
'/usr/share/openstack-dashboard/openstack_dashboard/local/local_settings.py'
}

23
manifests/service.pp Normal file
View File

@@ -0,0 +1,23 @@
# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class savanna::service ($enable = true,) {
service { 'savanna-api':
ensure => running,
enable => $enable,
hasrestart => true,
hasstatus => true,
}
}

13
metadata.json Normal file
View File

@@ -0,0 +1,13 @@
{
"name": "puppet-savanna",
"version": "0.0.1",
"summary": "Installs the savanna backend",
"author": "andy@edmonds.be",
"description": "Installs the savanna backend and can also install the savanna UI in OpenStack horizon",
"dependencies": [],
"types": [],
"checksums": {},
"source": "https://github.com/stackforge/puppet-savanna",
"project_page": "https://github.com/stackforge/puppet-savanna",
"license": "Apache License, Version 2.0"
}

32
spec/spec_helper.rb Normal file
View File

@@ -0,0 +1,32 @@
# Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
dir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift File.join(dir, 'lib')
require 'mocha'
require 'puppet'
require 'rspec'
require 'spec/autorun'
Spec::Runner.configure do |config|
config.mock_with :mocha
end
# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
class Object
alias :must :should
end

View File

@@ -0,0 +1,18 @@
description "Savanna API Server upstart job"
author "Andy Edmonds <andy@edmonds.be>"
start on runlevel [2345]
stop on runlevel [!2345]
chdir <%= scope.lookupvar("savanna::params::sys_rundir") %>
pre-start script
mkdir -p <%= scope.lookupvar("savanna::params::savanna_rundir") %>
chown savanna:root <%= scope.lookupvar("savanna::params::savanna_rundir") %>
mkdir -p <%= scope.lookupvar("savanna::params::savanna_lockdir") %>
chown savanna:root <%= scope.lookupvar("savanna::params::savanna_lockdir") %>
end script
exec start-stop-daemon --start --chuid savanna --exec /usr/local/bin/<%= scope.lookupvar("savanna::params::savanna_service") %> -- --config-file=<%= scope.lookupvar("savanna::params::savanna_conf_file") %>

119
templates/savanna-api.erb Normal file
View File

@@ -0,0 +1,119 @@
#!/bin/sh -e
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
UPSTART_JOB_CONF="/etc/default/upstart-job"
INITSCRIPT="$(basename "$0")"
JOB="${INITSCRIPT%.sh}"
if [ "$JOB" = "upstart-job" ]; then
if [ -z "$1" ]; then
echo "Usage: upstart-job JOB COMMAND" 1>&2
exit 1
fi
JOB="$1"
INITSCRIPT="$1"
shift
else
if [ -z "$1" ]; then
echo "Usage: $0 COMMAND" 1>&2
exit 1
fi
fi
COMMAND="$1"
shift
ECHO=echo
ECHO_ERROR=echo
if [ -e "$UPSTART_JOB_CONF" ]; then
. "$UPSTART_JOB_CONF"
fi
if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then
ECHO=:
ECHO_ERROR=:
fi
$ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)"
$ECHO "utility, e.g. service $INITSCRIPT $COMMAND"
# Only check if jobs are disabled if the currently _running_ version of
# Upstart (which may be older than the latest _installed_ version)
# supports such a query.
#
# This check is necessary to handle the scenario when upgrading from a
# release without the 'show-config' command (introduced in
# Upstart for Ubuntu version 0.9.7) since without this check, all
# installed packages with associated Upstart jobs would be considered
# disabled.
#
# Once Upstart can maintain state on re-exec, this change can be
# dropped (since the currently running version of Upstart will always
# match the latest installed version).
UPSTART_VERSION_RUNNING=$(initctl version|awk '{print $3}'|tr -d ')')
if dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 0.9.7
then
initctl show-config -e "$JOB"|grep -q '^ start on' || DISABLED=1
fi
case $COMMAND in
status)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB"
$COMMAND "$JOB"
;;
start|stop)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB"
if status "$JOB" 2>/dev/null | grep -q ' start/'; then
RUNNING=1
fi
if [ -z "$RUNNING" ] && [ "$COMMAND" = "stop" ]; then
exit 0
elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then
exit 0
elif [ -n "$DISABLED" ] && [ "$COMMAND" = "start" ]; then
exit 0
fi
$COMMAND "$JOB"
;;
restart)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities,"
$ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available."
if status "$JOB" 2>/dev/null | grep -q ' start/'; then
RUNNING=1
fi
if [ -n "$RUNNING" ] ; then
stop "$JOB"
fi
# If the job is disabled and is not currently running, the job is
# not restarted. However, if the job is disabled but has been forced into the
# running state, we *do* stop and restart it since this is expected behaviour
# for the admin who forced the start.
if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then
exit 0
fi
start "$JOB"
;;
reload|force-reload)
$ECHO
$ECHO "Since the script you are attempting to invoke has been converted to an"
$ECHO "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB"
reload "$JOB"
;;
*)
$ECHO_ERROR
$ECHO_ERROR "The script you are attempting to invoke has been converted to an Upstart" 1>&2
$ECHO_ERROR "job, but $COMMAND is not supported for Upstart jobs." 1>&2
exit 1
esac

267
templates/savanna.conf.erb Normal file
View File

@@ -0,0 +1,267 @@
[DEFAULT]
#
# Options defined in savanna.config
#
# set host (string value)
host=<%= @savanna_host %>
# set port (integer value)
port=<%= @savanna_port %>
#
# Options defined in savanna.main
#
# Protocol used to access OpenStack Identity service (string
# value)
os_auth_protocol=<%= @keystone_auth_protocol %>
# IP or hostname of machine on which OpenStack Identity
# service is located (string value)
os_auth_host=<%= @keystone_auth_host %>
# Port of OpenStack Identity service (string value)
os_auth_port=<%= @keystone_auth_port %>
# This OpenStack user is used to verify provided tokens. The
# user must have admin role in <os_admin_tenant_name> tenant
# (string value)
os_admin_username=<%= @keystone_user %>
# Password of the admin user (string value)
os_admin_password=<%= @keystone_password %>
# Name of tenant where the user is admin (string value)
os_admin_tenant_name=<%= scope.lookupvar("savanna::keystone::auth::tenant") %>
#
# Options defined in savanna.openstack.common.db.sqlalchemy.session
#
# the filename to use with sqlite (string value)
#sqlite_db=savanna.sqlite
# If true, use synchronous mode for sqlite (boolean value)
#sqlite_synchronous=true
#
# Options defined in savanna.openstack.common.lockutils
#
# Whether to disable inter-process locks (boolean value)
#disable_process_locking=false
# Directory to use for lock files. Default to a temp directory
# (string value)
lock_path=<%= scope.lookupvar("savanna::params::savanna_lockdir") %>
#
# Options defined in savanna.openstack.common.log
#
# Print debugging output (set logging level to DEBUG instead
# of default WARNING level). (boolean value)
debug=<%= @savanna_debug %>
# Print more verbose output (set logging level to INFO instead
# of default WARNING level). (boolean value)
verbose=<%= @savanna_verbose %>
# Log output to standard error (boolean value)
#use_stderr=true
# format string to use for log messages with context (string
# value)
#logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user)s %(tenant)s] %(instance)s%(message)s
# format string to use for log messages without context
# (string value)
#logging_default_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
# data to append to log format when level is DEBUG (string
# value)
#logging_debug_format_suffix=%(funcName)s %(pathname)s:%(lineno)d
# prefix each line of exception output with this format
# (string value)
#logging_exception_prefix=%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
# list of logger=LEVEL pairs (list value)
#default_log_levels=amqplib=WARN,sqlalchemy=WARN,boto=WARN,suds=INFO,keystone=INFO,eventlet.wsgi.server=WARN
# publish error events (boolean value)
#publish_errors=false
# make deprecations fatal (boolean value)
#fatal_deprecations=false
# If an instance is passed with the log message, format it
# like this (string value)
#instance_format="[instance: %(uuid)s] "
# If an instance UUID is passed with the log message, format
# it like this (string value)
#instance_uuid_format="[instance: %(uuid)s] "
# If this option is specified, the logging configuration file
# specified is used and overrides any other logging options
# specified. Please see the Python logging module
# documentation for details on logging configuration files.
# (string value)
#log_config=<None>
# A logging.Formatter log message format string which may use
# any of the available logging.LogRecord attributes. This
# option is deprecated. Please use
# logging_context_format_string and
# logging_default_format_string instead. (string value)
#log_format=<None>
# Format string for %%(asctime)s in log records. Default:
# %(default)s (string value)
#log_date_format=%Y-%m-%d %H:%M:%S
# (Optional) Name of log file to output to. If no default is
# set, logging will go to stdout. (string value)
log_file=<%= scope.lookupvar("savanna::params::savanna_logdir") %>/savanna.log
# (Optional) The base directory used for relative --log-file
# paths (string value)
# log_dir=<%= scope.lookupvar("savanna::params::savanna_logdir") %>
# Use syslog for logging. (boolean value)
use_syslog=<%= scope.lookupvar("savanna::params::savanna_syslog") %>
# syslog facility to receive log lines (string value)
#syslog_log_facility=LOG_USER
#
# Options defined in savanna.openstack.common.notifier.api
#
# Driver or drivers to handle sending notifications (multi
# valued)
#notification_driver=
# Default notification level for outgoing notifications
# (string value)
#default_notification_level=INFO
# Default publisher_id for outgoing notifications (string
# value)
#default_publisher_id=$host
#
# Options defined in savanna.plugins.base
#
# TODO(dizz): parameterise the following!
# List of plugins to be loaded. Savanna preserves the order of
# the list when returning it. (list value) - vanilla, hdp
plugins=vanilla
[plugin:vanilla]
plugin_class=savanna.plugins.vanilla.plugin:VanillaProvider
#[plugin:hdp]
#plugin_class=savanna.plugins.hdp.plugin:AmbariPlugin
#
# Options defined in savanna.service.networks
#
# When set to false, Savanna uses only internal IP of VMs.
# When set to true, Savanna expects OpenStack to auto-assign
# floating IPs to cluster nodes. Internal IPs will be used for
# inter-cluster communication, while floating ones will be
# used by Savanna to configure nodes. Also floating IPs will
# be exposed in service URLs. (boolean value)
use_floating_ips=<%= scope.lookupvar("savanna::params::savanna_usefips") %>
# The suffix of the node's FQDN. In nova-network that is
# dhcp_domain config parameter (string value)
node_domain=<%= scope.lookupvar("savanna::params::savanna_node_domain") %>
[database]
#
# Options defined in savanna.db.migration.cli
#
# URL to database (string value)
# connection=sqlite:////tmp/savanna-server.db
connection=mysql://<%= @savanna_db_user %>:<%= @savanna_db_password %>@<%= @db_host %>/<%= @savanna_db_name %>
#
# Options defined in savanna.openstack.common.db.api
#
# The backend to use for db (string value)
#backend=sqlalchemy
# Enable the experimental use of thread pooling for all DB API
# calls (boolean value)
#use_tpool=false
#
# Options defined in savanna.openstack.common.db.sqlalchemy.session
#
# The SQLAlchemy connection string used to connect to the
# database (string value)
#connection=sqlite:////savanna/openstack/common/db/$sqlite_db
# The SQLAlchemy connection string used to connect to the
# slave database (string value)
#slave_connection=
# timeout before idle sql connections are reaped (integer
# value)
#idle_timeout=3600
# Minimum number of SQL connections to keep open in a pool
# (integer value)
#min_pool_size=1
# Maximum number of SQL connections to keep open in a pool
# (integer value)
#max_pool_size=<None>
# maximum db connection retries during startup. (setting -1
# implies an infinite retry count) (integer value)
#max_retries=10
# interval between retries of opening a sql connection
# (integer value)
#retry_interval=10
# If set, use this value for max_overflow with sqlalchemy
# (integer value)
#max_overflow=<None>
# Verbosity of SQL debugging information. 0=None,
# 100=Everything (integer value)
#connection_debug=0
# Add python stack traces to SQL as comment strings (boolean
# value)
#connection_trace=false
# If set, use this value for pool_timeout with sqlalchemy
# (integer value)
#pool_timeout=<None>
# Total option count: 51

26
tests/init.pp Normal file
View File

@@ -0,0 +1,26 @@
# Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# The baseline for module testing used by Puppet Labs is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation errors
# and view a log of events) or by fully applying the test in a virtual environment
# (to compare the resulting system state to the desired state).
#
# Learn more about module testing here: http://docs.puppetlabs.com/guides/tests_smoke.html
#
include savanna