Cherry-pick the following commits from release-0.4
* Add forgotten return statements
Closes-bug: #1268934
* Fix error code when there is no input json
* Return correct http code
During toggle enabled 500 was sent in case service is not defined
Fix return code to 404
Closes-Bug: #1268976
* Remove need to specify IP for load balancer
Implements:
https://blueprints.launchpad.net/murano/+spec/auto-assign-virtual-ip
Address blueprint auto-assign-virtual-ip
Fix errors in infrastructure
1) Update path to config file
2) Update sample config - remove non-existing directory
3) Add 0.4.1 version
Fixes-Bug: 1270734
* Add new setup and SysV scripts
* Removed SysV EL6 standalone file, removed old setup scripts
* Add correct error message when no config specified
Closes-Bug: 1271092
* Security rules updated
* incorrect port ranges for ADDS fixed according to
http://technet.microsoft.com/en-us/library/dd772723%28v=WS.10%29.aspx
* security template for Windows Server Failover Cluster added according to
http://support.microsoft.com/kb/832017#method5
* security rules for SQL Server updated according to
http://technet.microsoft.com/en-us/library/cc646023.aspx
Relates-Bug: 1264088
* Typo fixed
* Revert change
This reverts commit d87bc2309f
.
* Path flattening is reverted, but opening ports for WinRM 2.0 is kept.
Related-Bug: #1271578
* Fix paths to scripts used by MS SQL Cluster templates.
Partial-Bug: #1271578
* Fix returning list of files in nested dirs - don't cut first symbol.
* And fix a minor PyCharm warning about var not being initialized.
Closes-Bug: #1274851
* Add checkbox to enable floating IP auto assignment
* Implements blueprint auto-assign-floating-ip
* Fixed typo in conductor workflow
Closes-Bug: 1264250
* Add service version during service creation
Closes-Bug: 1269360
* Resolve issue with KeyPair assignment
nvironment with a service with Key Pair assigned
could not be deployed due to invalid match in workflows
causing invalid Heat template to be produced by Conductor.
Closes-bug: #1274011
* Correct inform message during floating ip creation
* Fix name for syslog_log_facility param
Change-Id: Id3ad4581cd9ce40a569ac580d0aee8db017855c4
This commit is contained in:
parent
1fcfbce635
commit
d353dacf8e
@ -5,6 +5,10 @@ Repository with murano metadata
|
|||||||
|
|
||||||
Murano project on launchpad https://launchpad.net/murano
|
Murano project on launchpad https://launchpad.net/murano
|
||||||
|
|
||||||
|
INSTALL FROM SOURCE
|
||||||
|
=====================
|
||||||
|
Please, use setup.sh script with root user privileges for install/uninstall of the software.
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
Copyright (c) 2013 Mirantis Inc.
|
Copyright (c) 2013 Mirantis Inc.
|
||||||
|
379
common.inc
Normal file
379
common.inc
Normal file
@ -0,0 +1,379 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Common functions file
|
||||||
|
#
|
||||||
|
DEBUGLVL=2
|
||||||
|
RUN_DIR=${RUN_DIR:-$(cd $(dirname "$0") && pwd)}
|
||||||
|
LOGFILE="$RUN_DIR/install.log"
|
||||||
|
PIPAPPS="pip python-pip pip-python"
|
||||||
|
PIPCMD=""
|
||||||
|
PIPARGS=""
|
||||||
|
TRBL_FILE=""
|
||||||
|
|
||||||
|
if [ "$DEBUGLVL" -eq 4 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
function log {
|
||||||
|
if [ "$DEBUGLVL" -gt 0 ]; then
|
||||||
|
chars=$(echo "@$" | wc -c)
|
||||||
|
case $DEBUGLVL in
|
||||||
|
1)
|
||||||
|
echo -e "LOG:>$@"
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
echo -e "$(date +"%m-%d-%Y %H:%M") LOG:>$@" | tee --append $LOGFILE
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
echo -e "$(date +"%m-%d-%Y %H:%M") LOG:>$@" >> $LOGFILE
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
echo -e "$(date +"%m-%d-%Y %H:%M") LOG:>$@" | tee --append $LOGFILE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function lowercase(){
|
||||||
|
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
|
||||||
|
}
|
||||||
|
function get_os(){
|
||||||
|
KERNEL=$(uname -r)
|
||||||
|
MACH=$(uname -m)
|
||||||
|
OS=$(uname)
|
||||||
|
if [ "${OS}" = "Linux" ] ; then
|
||||||
|
if [ -f /etc/redhat-release ] ; then
|
||||||
|
DISTRO_BASED_ON='RedHat'
|
||||||
|
PACKAGER='yum'
|
||||||
|
PKG_MGR='rpm'
|
||||||
|
DIST=$(cat /etc/redhat-release |sed s/\ release.*//)
|
||||||
|
PSUEDONAME=$(cat /etc/redhat-release | sed s/.*\(// | sed s/\)//)
|
||||||
|
REV=$(cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//)
|
||||||
|
elif [ -f /etc/SuSE-release ] ; then
|
||||||
|
DISTRO_BASED_ON='SuSe'
|
||||||
|
PACKAGER='zypper'
|
||||||
|
PKG_MGR='rpm'
|
||||||
|
PSUEDONAME=$(cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//)
|
||||||
|
REV=$(cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //)
|
||||||
|
elif [ -f /etc/debian_version ] ; then
|
||||||
|
DISTRO_BASED_ON='Debian'
|
||||||
|
PACKAGER='apt-get'
|
||||||
|
PKG_MGR='dpkg'
|
||||||
|
DIST=$(cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }')
|
||||||
|
PSUEDONAME=$(cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }')
|
||||||
|
REV=$(cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }')
|
||||||
|
fi
|
||||||
|
if [ -f /etc/UnitedLinux-release ] ; then
|
||||||
|
DIST="${DIST}[$(cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//)]"
|
||||||
|
fi
|
||||||
|
OS=$(lowercase $OS)
|
||||||
|
DISTRO_BASED_ON=$(lowercase $DISTRO_BASED_ON)
|
||||||
|
readonly OS
|
||||||
|
readonly DIST
|
||||||
|
readonly DISTRO_BASED_ON
|
||||||
|
readonly PSUEDONAME
|
||||||
|
readonly REV
|
||||||
|
readonly KERNEL
|
||||||
|
readonly MACH
|
||||||
|
#readonly PACKAGER
|
||||||
|
else
|
||||||
|
OS=unknown
|
||||||
|
readonly OS
|
||||||
|
log "Unsupported OS:\"$OS\", sorry, exiting!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function find_or_install()
|
||||||
|
{
|
||||||
|
_searching_for=$1
|
||||||
|
_pkg_mrg_cmd=''
|
||||||
|
_pkgr_cmd=''
|
||||||
|
retval=0
|
||||||
|
case $(lowercase $DISTRO_BASED_ON) in
|
||||||
|
"debian")
|
||||||
|
_pkg_mrg_cmd="$PKG_MGR -s $_searching_for"
|
||||||
|
_pkgr_cmd="$PACKAGER install $_searching_for --yes"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_pkg_mrg_cmd="$PKG_MGR -q $_searching_for"
|
||||||
|
_pkgr_cmd="$PACKAGER install $_searching_for -y"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
$_pkg_mrg_cmd > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "Package \"$_searching_for\" already installed"
|
||||||
|
retval=2
|
||||||
|
else
|
||||||
|
log "Installing \"$_searching_for\"..."
|
||||||
|
$_pkgr_cmd > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ];then
|
||||||
|
log "...installation fails, exiting!"
|
||||||
|
retval=1
|
||||||
|
else
|
||||||
|
log "...success"
|
||||||
|
retval=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
function is_py_package_installed()
|
||||||
|
{
|
||||||
|
retval=0
|
||||||
|
py_pkg=$1
|
||||||
|
found_pkg=$($PIPCMD freeze | grep -E "^$py_pkg")
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
retval=1
|
||||||
|
fi
|
||||||
|
echo $found_pkg
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
function genpass()
|
||||||
|
{
|
||||||
|
echo $(date | md5sum |head -c${5:-13})
|
||||||
|
}
|
||||||
|
function shslash()
|
||||||
|
{
|
||||||
|
echo $1 | sed 's/\//\\\//g'
|
||||||
|
}
|
||||||
|
function split()
|
||||||
|
{
|
||||||
|
# Prefix local names with the function name to try to avoid conflicts
|
||||||
|
# local split_wordlist
|
||||||
|
split_wordlist="$1"
|
||||||
|
shift
|
||||||
|
read "$@" <<EOF-split-end-of-arguments
|
||||||
|
${split_wordlist}
|
||||||
|
EOF-split-end-of-arguments
|
||||||
|
}
|
||||||
|
# Returns true if v1 >= v2, false if v1 < v2
|
||||||
|
function version_ge()
|
||||||
|
{
|
||||||
|
# Prefix local names with the function name to try to avoid conflicts
|
||||||
|
# local version_ge_1 version_ge_2 version_ge_a version_ge_b
|
||||||
|
# local version_ge_save_ifs
|
||||||
|
version_ge_v1="$1"
|
||||||
|
version_ge_v2="$2"
|
||||||
|
version_ge_save_ifs="$IFS"
|
||||||
|
while test -n "${version_ge_v1}${version_ge_v2}"; do
|
||||||
|
IFS="."
|
||||||
|
split "$version_ge_v1" version_ge_a version_ge_v1
|
||||||
|
split "$version_ge_v2" version_ge_b version_ge_v2
|
||||||
|
IFS="$version_ge_save_ifs"
|
||||||
|
#echo " compare $version_ge_a $version_ge_b"
|
||||||
|
test "0$version_ge_a" -gt "0$version_ge_b" && return 0 # v1>v2: true
|
||||||
|
test "0$version_ge_a" -lt "0$version_ge_b" && return 1 # v1<v2:false
|
||||||
|
done
|
||||||
|
# version strings are both empty & no differences found - must be equal.
|
||||||
|
return 0 # v1==v2: true
|
||||||
|
}
|
||||||
|
function find_pip()
|
||||||
|
{
|
||||||
|
_pipargs=""
|
||||||
|
pip_min_ver="1.4"
|
||||||
|
for cmd in $PIPAPPS
|
||||||
|
do
|
||||||
|
_cmd=$(which $cmd 2>/dev/null)
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -z "$_cmd" ];then
|
||||||
|
echo "Can't find \"pip\" in system, please install it first, exiting!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
_pip_ver=$($_cmd --version | grep -oE "[0-9]\.[0-9]" | head -n1)
|
||||||
|
if [ -n "$_pip_ver" ]; then
|
||||||
|
version_ge $_pip_ver $pip_min_ver
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Upgrading pip ..."
|
||||||
|
$_cmd install --upgrade pip==$pip_min_ver
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "...pip upgrade fails, exiting!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
log "...success"
|
||||||
|
sleep 2
|
||||||
|
for cmd in $PIPAPPS
|
||||||
|
do
|
||||||
|
_cmd=$(which $cmd 2>/dev/null)
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
_pip_ver=$($_cmd --version | grep -oE "[0-9]\.[0-9]" | head -n1)
|
||||||
|
version_ge $_pip_ver "1.5"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "For future use, sorry, use pip v$pip_min_ver, exiting!"
|
||||||
|
exit 1
|
||||||
|
##_pipargs="--allow-unverified --allow-external"
|
||||||
|
#_pipargs="--allow-all-external"
|
||||||
|
#mk_dir "/root/.pip"
|
||||||
|
#_pipcfg="/root/.pip/pip.conf"
|
||||||
|
#if [ ! -f "$_pipcfg" ]; then
|
||||||
|
# touch $_pipcfg
|
||||||
|
#fi
|
||||||
|
#iniset 'install' 'allow-all-external' 'true' "$_pipcfg"
|
||||||
|
#iniset 'install' 'allow-all-unverified' 'true' "$_pipcfg"
|
||||||
|
#log "Setuptools upgrade required..."
|
||||||
|
#$cmd install setuptools --no-use-wheel --upgrade >> $LOGFILE 2>&1
|
||||||
|
#if [ $? -ne 0 ]; then
|
||||||
|
# log "...upgrade fails, exiting"
|
||||||
|
# exit 1
|
||||||
|
#else
|
||||||
|
# log "...success"
|
||||||
|
#fi
|
||||||
|
fi
|
||||||
|
log "Found pip version - $_pip_ver"
|
||||||
|
fi
|
||||||
|
PIPARGS=$_pipargs
|
||||||
|
PIPCMD=$_cmd
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function add_daemon_credentials()
|
||||||
|
{
|
||||||
|
retval=0
|
||||||
|
daemonuser=${1:-murano}
|
||||||
|
daemongroup=${2:-murano}
|
||||||
|
daemonhomedir=${3:-/home/$daemonuser}
|
||||||
|
getent group $daemongroup > /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Creating group \"$daemongroup\"..."
|
||||||
|
groupadd -r $daemongroup
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "...success"
|
||||||
|
else
|
||||||
|
log "Can't create \"$daemongroup\", exiting!"
|
||||||
|
retval=1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "Group \"$daemongroup\" exists"
|
||||||
|
fi
|
||||||
|
getent passwd $daemonuser > /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Creating user \"$daemonuser\"..."
|
||||||
|
useradd -r -g $daemongroup -G $daemongroup -d $daemonhomedir -s $(which nologin) -c "Murano Daemons" $daemonuser
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "...success"
|
||||||
|
else
|
||||||
|
log "Can't create \"$daemonuser\", exiting!"
|
||||||
|
retval=1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "User \"$daemonuser\" exists"
|
||||||
|
fi
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
function remove_daemon_credentials()
|
||||||
|
{
|
||||||
|
retval=0
|
||||||
|
daemonuser=${1:-murano}
|
||||||
|
daemongroup=${2:-murano}
|
||||||
|
daemonhomedir=${3:-/home/$daemonuser}
|
||||||
|
getent passwd $daemonuser > /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "Deleting user \"$daemonuser\"..."
|
||||||
|
userdel -f $daemonuser
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
if [ -d "$daemonhomedir" ]; then
|
||||||
|
rm -rf $daemonhomedir
|
||||||
|
fi
|
||||||
|
log "...success"
|
||||||
|
else
|
||||||
|
log "Can't delete \"$daemonuser\", exiting!"
|
||||||
|
retval=1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
getent group $daemongroup > /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "Deleting group \"$daemongroup\"..."
|
||||||
|
groupdel $daemongroup
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "...success"
|
||||||
|
else
|
||||||
|
log "Can't delete \"$daemongroup\", exiting!"
|
||||||
|
retval=1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
function iniset()
|
||||||
|
{
|
||||||
|
local section=$1
|
||||||
|
local option=$2
|
||||||
|
local value=$3
|
||||||
|
local file=$4
|
||||||
|
local line
|
||||||
|
|
||||||
|
if [ -z "$section" ] ; then
|
||||||
|
# No section name specified
|
||||||
|
sed -i -e "s/^\($option[ \t]*=[ \t]*\).*$/\1$value/" "$file"
|
||||||
|
else
|
||||||
|
# Check if section already exists
|
||||||
|
if ! grep -q "^\[$section\]" "$file" ; then
|
||||||
|
# Add section at the end
|
||||||
|
echo -e "\n[$section]" >>"$file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if parameter in the section exists
|
||||||
|
line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
|
||||||
|
if [ -z "$line" ] ; then
|
||||||
|
# Add parameter if it is not exists
|
||||||
|
sed -i -e "/^\[$section\]/ a\\
|
||||||
|
$option = $value
|
||||||
|
" "$file"
|
||||||
|
else
|
||||||
|
# Replace existing parameter
|
||||||
|
sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" "$file"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function mk_dir()
|
||||||
|
{
|
||||||
|
retval=0
|
||||||
|
path_to_check=$1
|
||||||
|
if [ -d "$path_to_check" ]; then
|
||||||
|
log "Path \"$path_to_check\" already exists."
|
||||||
|
elif [ -f "$path_to_check" ]; then
|
||||||
|
log "Path \"path_to_check\" is an existing file, exiting!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mkdir -p "$path_to_check"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Can't create \"$path_to_check\", exiting!"
|
||||||
|
retval=1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ $# -eq 3 ]; then
|
||||||
|
owner_user=$2
|
||||||
|
owner_group=$3
|
||||||
|
chown -R $owner_user:$owner_group $path_to_check
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Can't set ownership to \"$owner_user:$owner_group\" for \"$path_to_check\", exiting!"
|
||||||
|
retval=1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
function get_service_exec_path()
|
||||||
|
{
|
||||||
|
retval=0
|
||||||
|
if [ -z "$SERVICE_EXEC_PATH" ]; then
|
||||||
|
SERVICE_EXEC_PATH=$(which $DAEMON_NAME)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Can't find \"$DAEMON_NAME\", please install the \"$SERVICE_SRV_NAME\" by running \"$(basename "$0") install\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!"
|
||||||
|
retval=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ ! -x "$SERVICE_EXEC_PATH" ]; then
|
||||||
|
log "\"$SERVICE_EXEC_PATH\" in not executable, please install the \"$DAEMON_NAME\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!"
|
||||||
|
retval=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return $retval
|
||||||
|
}
|
4
etc/init.d/README.rst
Normal file
4
etc/init.d/README.rst
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
SysV init scripts
|
||||||
|
=====================
|
||||||
|
murano-repository-redhat - for RedHat based Linux distibution
|
||||||
|
murano-repository-debian - for Debian based Linux distibution
|
104
etc/init.d/murano-repository-debian
Normal file
104
etc/init.d/murano-repository-debian
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright (c) 2014 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
# Author: Igor Yozhikov <iyozhikov@mirantis.com>
|
||||||
|
#
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: murano-repository
|
||||||
|
# Required-Start: $network $local_fs $remote_fs $syslog
|
||||||
|
# Required-Stop: $remote_fs
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: OpenStack Murano Respository Service
|
||||||
|
# Description: This startup script launches murano-repository service daemon.
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||||
|
DESC="murano-repository"
|
||||||
|
NAME=murano-repository
|
||||||
|
DAEMON=$(which murano-repository)
|
||||||
|
PIDFILE=/var/run/murano/$NAME.pid
|
||||||
|
SCRIPTNAME=/etc/init.d/openstack-$NAME
|
||||||
|
SYSTEM_USER=murano
|
||||||
|
CONFIG_FILE=/etc/murano/murano-repository.conf
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x $DAEMON ] || exit 5
|
||||||
|
|
||||||
|
# source function library
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
do_start()
|
||||||
|
{
|
||||||
|
if [ ! -d "/var/run/murano" ]; then
|
||||||
|
mkdir -p /var/run/murano
|
||||||
|
chown -R $SYSTEM_USER /var/run/murano
|
||||||
|
fi
|
||||||
|
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test -- --config-file=$CONFIG_FILE > /dev/null || return 1
|
||||||
|
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- --config-file=$CONFIG_FILE || return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
do_stop()
|
||||||
|
{
|
||||||
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||||
|
RETVAL="$?"
|
||||||
|
rm -f $PIDFILE
|
||||||
|
return "$RETVAL"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0|1) log_end_msg 0 ;;
|
||||||
|
2) log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1) log_end_msg 0 ;;
|
||||||
|
2) log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1)
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0) log_end_msg 0 ;;
|
||||||
|
1) log_end_msg 1 ;; # Old process is still running
|
||||||
|
*) log_end_msg 1 ;; # Failed to start
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Failed to stop
|
||||||
|
log_end_msg 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
102
etc/init.d/murano-repository-redhat
Normal file
102
etc/init.d/murano-repository-redhat
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright (c) 2014 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
# Author: Igor Yozhikov <iyozhikov@mirantis.com>
|
||||||
|
#
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: murano-repository
|
||||||
|
# Required-Start: $network $local_fs $remote_fs $syslog
|
||||||
|
# Required-Stop: $remote_fs
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: OpenStack Murano Respository Service
|
||||||
|
# Description: This startup script launches murano-repository service daemon.
|
||||||
|
### END INIT INFO
|
||||||
|
# chkconfig: 3 90 10
|
||||||
|
# description: This startup script launches murano-repository service daemon.
|
||||||
|
# config: /etc/murano/murano-repository.conf
|
||||||
|
#
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||||
|
DESC="murano-repository"
|
||||||
|
NAME=murano-repository
|
||||||
|
DAEMON=$(which murano-repository)
|
||||||
|
PIDFILE=/var/run/murano/$NAME.pid
|
||||||
|
SCRIPTNAME=/etc/init.d/openstack-$NAME
|
||||||
|
SYSTEM_USER=murano
|
||||||
|
CONFIG_FILE=/etc/murano/murano-repository.conf
|
||||||
|
LOCKFILE=/var/lock/subsys/$NAME
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x $DAEMON ] || exit 5
|
||||||
|
|
||||||
|
# source function library
|
||||||
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
RETVAL=0
|
||||||
|
|
||||||
|
|
||||||
|
start() {
|
||||||
|
if [ ! -d "/var/run/murano" ]; then
|
||||||
|
mkdir -p /var/run/murano
|
||||||
|
chown -R $SYSTEM_USER /var/run/murano
|
||||||
|
fi
|
||||||
|
echo -n "Starting $NAME: "
|
||||||
|
daemon --user $SYSTEM_USER "$DAEMON --config-file=$CONFIG_FILE &>/dev/null & echo \$! > $PIDFILE"
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
echo -n "Stopping $NAME: "
|
||||||
|
#killproc $DAEMON -TERM
|
||||||
|
killproc -p $PIDFILE $DAEMON
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
rh_status() {
|
||||||
|
# run checks to determine if the service is running or use generic status
|
||||||
|
status $DAEMON
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
|
||||||
|
restart)
|
||||||
|
restart
|
||||||
|
;;
|
||||||
|
|
||||||
|
status)
|
||||||
|
rh_status
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start|stop|status|restart}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
exit $?
|
@ -13,8 +13,10 @@ verbose = True
|
|||||||
# Show debugging output in logs (sets DEBUG log level output)
|
# Show debugging output in logs (sets DEBUG log level output)
|
||||||
debug = True
|
debug = True
|
||||||
|
|
||||||
# Log to this file. Make sure the user has permissions to write to this file!
|
# Set up logging. To use syslog just set use_syslog parameter value to 'True'.
|
||||||
log_file = /tmp/murano-repository.log
|
log_file = /tmp/murano-repository.log
|
||||||
|
use_syslog = False
|
||||||
|
syslog_log_facility = LOG_LOCAL0
|
||||||
|
|
||||||
# Provide information about data types
|
# Provide information about data types
|
||||||
# absolute or relative path to manifest location(root directory)
|
# absolute or relative path to manifest location(root directory)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
"ImportCoreFunctions.ps1",
|
"/ImportCoreFunctions.ps1",
|
||||||
"SQLServerForAOAG.ps1"
|
"SQLServerForAOAG.ps1"
|
||||||
],
|
],
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
"ImportCoreFunctions.ps1",
|
"/ImportCoreFunctions.ps1",
|
||||||
"Start-PowerShellProcess.ps1",
|
"/Start-PowerShellProcess.ps1",
|
||||||
"Failover-Cluster.ps1"
|
"Failover-Cluster.ps1"
|
||||||
],
|
],
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
"ImportCoreFunctions.ps1",
|
"/ImportCoreFunctions.ps1",
|
||||||
"Update-ServiceConfig.ps1",
|
"/Update-ServiceConfig.ps1",
|
||||||
"SQLServerForAOAG.ps1",
|
"SQLServerForAOAG.ps1",
|
||||||
"Failover-Cluster.ps1"
|
"Failover-Cluster.ps1"
|
||||||
],
|
],
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
"ImportCoreFunctions.ps1",
|
"/ImportCoreFunctions.ps1",
|
||||||
"OptionParser.ps1",
|
"/OptionParser.ps1",
|
||||||
"SQLServer/SQLServerOptionParsers.ps1",
|
"/SQLServer/SQLServerOptionParsers.ps1",
|
||||||
"SQLServer/SQLServerInstaller.ps1",
|
"/SQLServer/SQLServerInstaller.ps1",
|
||||||
"Export-Function.ps1",
|
"/Export-Function.ps1",
|
||||||
"Start-PowerShellProcess.ps1",
|
"/Start-PowerShellProcess.ps1",
|
||||||
"SQLServerForAOAG.ps1"
|
"SQLServerForAOAG.ps1"
|
||||||
],
|
],
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
"ImportCoreFunctions.ps1",
|
"/ImportCoreFunctions.ps1",
|
||||||
"OptionParser.ps1",
|
"/OptionParser.ps1",
|
||||||
"SQLServer/SQLServerOptionParsers.ps1",
|
"/SQLServer/SQLServerOptionParsers.ps1",
|
||||||
"SQLServer/SQLServerInstaller.ps1",
|
"/SQLServer/SQLServerInstaller.ps1",
|
||||||
"Export-Function.ps1",
|
"/Export-Function.ps1",
|
||||||
"Start-PowerShellProcess.ps1",
|
"/Start-PowerShellProcess.ps1",
|
||||||
"SQLServerForAOAG.ps1"
|
"SQLServerForAOAG.ps1"
|
||||||
],
|
],
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
"ImportCoreFunctions.ps1",
|
"/ImportCoreFunctions.ps1",
|
||||||
"OptionParser.ps1",
|
"/OptionParser.ps1",
|
||||||
"SQLServer/SQLServerOptionParsers.ps1",
|
"/SQLServer/SQLServerOptionParsers.ps1",
|
||||||
"SQLServer/SQLServerInstaller.ps1",
|
"/SQLServer/SQLServerInstaller.ps1",
|
||||||
"Export-Function.ps1",
|
"/Export-Function.ps1",
|
||||||
"Start-PowerShellProcess.ps1",
|
"/Start-PowerShellProcess.ps1",
|
||||||
"SQLServerForAOAG.ps1"
|
"SQLServerForAOAG.ps1"
|
||||||
],
|
],
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
"ImportCoreFunctions.ps1",
|
"/ImportCoreFunctions.ps1",
|
||||||
"OptionParser.ps1",
|
"/OptionParser.ps1",
|
||||||
"SQLServer/SQLServerOptionParsers.ps1",
|
"/SQLServer/SQLServerOptionParsers.ps1",
|
||||||
"SQLServer/SQLServerInstaller.ps1",
|
"/SQLServer/SQLServerInstaller.ps1",
|
||||||
"SQLServerForAOAG.ps1"
|
"SQLServerForAOAG.ps1"
|
||||||
],
|
],
|
||||||
"Commands": [
|
"Commands": [
|
||||||
|
@ -30,6 +30,7 @@ heat:
|
|||||||
- DefaultSecurity.template
|
- DefaultSecurity.template
|
||||||
- WindowsSecurity.template
|
- WindowsSecurity.template
|
||||||
- WebServerSecurity.template
|
- WebServerSecurity.template
|
||||||
|
- FloatingIP.template
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
- SetPassword.template
|
- SetPassword.template
|
||||||
|
@ -31,6 +31,7 @@ heat:
|
|||||||
- DefaultSecurity.template
|
- DefaultSecurity.template
|
||||||
- WindowsSecurity.template
|
- WindowsSecurity.template
|
||||||
- WebServerSecurity.template
|
- WebServerSecurity.template
|
||||||
|
- FloatingIPwithLB.template
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
- SetPassword.template
|
- SetPassword.template
|
||||||
|
@ -5,93 +5,135 @@
|
|||||||
"Properties": {
|
"Properties": {
|
||||||
"SecurityGroupIngress": [
|
"SecurityGroupIngress": [
|
||||||
{
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "25",
|
||||||
|
"ToPort": "25",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "53",
|
||||||
|
"ToPort": "53",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "53",
|
||||||
|
"ToPort": "53",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "88",
|
||||||
|
"ToPort": "88",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "88",
|
||||||
|
"ToPort": "88",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "123",
|
||||||
"ToPort": "123",
|
"ToPort": "123",
|
||||||
"IpProtocol": "udp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
"CidrIp": "$cidr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "135",
|
||||||
"ToPort": "135",
|
"ToPort": "135",
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
"CidrIp": "$cidr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ToPort": "464",
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "464",
|
|
||||||
"IpProtocol": "udp",
|
"IpProtocol": "udp",
|
||||||
"FromPort": "53",
|
"FromPort": "137",
|
||||||
|
"ToPort": "137",
|
||||||
"CidrIp": "$cidr"
|
"CidrIp": "$cidr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ToPort": "389",
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "389",
|
|
||||||
"IpProtocol": "udp",
|
"IpProtocol": "udp",
|
||||||
"FromPort": "53",
|
"FromPort": "138",
|
||||||
|
"ToPort": "138",
|
||||||
"CidrIp": "$cidr"
|
"CidrIp": "$cidr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ToPort": "636",
|
|
||||||
"IpProtocol": "tcp",
|
"IpProtocol": "tcp",
|
||||||
"FromPort": "53",
|
"FromPort": "445",
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "3268",
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "3269",
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "53",
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "53",
|
|
||||||
"IpProtocol": "udp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "88",
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "88",
|
|
||||||
"IpProtocol": "udp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "445",
|
"ToPort": "445",
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "53",
|
|
||||||
"CidrIp": "$cidr"
|
"CidrIp": "$cidr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ToPort": "65535",
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "445",
|
||||||
|
"ToPort": "445",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "464",
|
||||||
|
"ToPort": "464",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "464",
|
||||||
|
"ToPort": "464",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "389",
|
||||||
|
"ToPort": "389",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "389",
|
||||||
|
"ToPort": "389",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "636",
|
||||||
|
"ToPort": "636",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "3268",
|
||||||
|
"ToPort": "3268",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "3269",
|
||||||
|
"ToPort": "3269",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "5722",
|
||||||
|
"ToPort": "5722",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "9389",
|
||||||
|
"ToPort": "9389",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
"IpProtocol": "tcp",
|
"IpProtocol": "tcp",
|
||||||
"FromPort": "49152",
|
"FromPort": "49152",
|
||||||
|
"ToPort": "65535",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "49152",
|
||||||
|
"ToPort": "65535",
|
||||||
"CidrIp": "$cidr"
|
"CidrIp": "$cidr"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
24
muranorepository/Services/heat_templates/FloatingIP.template
Normal file
24
muranorepository/Services/heat_templates/FloatingIP.template
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"Resources": {
|
||||||
|
"${instanceName}-FloatingIP": {
|
||||||
|
"Type": "OS::Neutron::FloatingIP",
|
||||||
|
"Properties": {
|
||||||
|
"floating_network_id": "$externalNetworkId"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"${instanceName}-FloatingIpAssoc": {
|
||||||
|
"Type": "OS::Neutron::FloatingIPAssociation",
|
||||||
|
"Properties": {
|
||||||
|
"floatingip_id": { "Ref" : "${instanceName}-FloatingIP" },
|
||||||
|
"port_id": { "Ref" : "$instancePort" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Outputs": {
|
||||||
|
"${instanceName}-FloatingIPaddress": {
|
||||||
|
"Value": {"Fn::GetAtt": ["${instanceName}-FloatingIP", "floating_ip_address"]},
|
||||||
|
"Description": "Floating IP assigned"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"Resources": {
|
||||||
|
"${instanceName}-FloatingIP": {
|
||||||
|
"Type": "OS::Neutron::FloatingIP",
|
||||||
|
"Properties": {
|
||||||
|
"floating_network_id": "$externalNetworkId"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"${instanceName}-FloatingIpAssoc": {
|
||||||
|
"Type": "OS::Neutron::FloatingIPAssociation",
|
||||||
|
"Properties": {
|
||||||
|
"floatingip_id": { "Ref" : "${instanceName}-FloatingIP" },
|
||||||
|
"port_id": {"Fn::Select": ["port_id", {"Fn::GetAtt": ["${lbName}-Pool", "vip"]}]}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Outputs": {
|
||||||
|
"${instanceName}-FloatingIPaddress": {
|
||||||
|
"Value": {"Fn::GetAtt": ["${instanceName}-FloatingIP", "floating_ip_address"]},
|
||||||
|
"Description": "Floating IP assigned"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,7 +21,6 @@
|
|||||||
"name": "${lbName}-Pool",
|
"name": "${lbName}-Pool",
|
||||||
"vip": {
|
"vip": {
|
||||||
"name": "${lbName}-Pool-VIP",
|
"name": "${lbName}-Pool-VIP",
|
||||||
"address": "$lbIp",
|
|
||||||
"protocol_port": "$lbPort"
|
"protocol_port": "$lbPort"
|
||||||
},
|
},
|
||||||
"monitors": [{"Ref": "${lbName}-HealthMonitor"}]
|
"monitors": [{"Ref": "${lbName}-HealthMonitor"}]
|
||||||
@ -35,5 +34,11 @@
|
|||||||
"members": [{"Ref": "$instanceName"}]
|
"members": [{"Ref": "$instanceName"}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Outputs": {
|
||||||
|
"${lbName}-loadBalancerIp": {
|
||||||
|
"Value": {"Fn::Select": ["address", {"Fn::GetAtt": ["${lbName}-Pool", "vip"]}]},
|
||||||
|
"Description": "IP assigned to VIP"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,22 +5,34 @@
|
|||||||
"Properties": {
|
"Properties": {
|
||||||
"SecurityGroupIngress": [
|
"SecurityGroupIngress": [
|
||||||
{
|
{
|
||||||
"ToPort": "4022",
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "4022",
|
|
||||||
"CidrIp": "$cidr"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ToPort": "135",
|
|
||||||
"IpProtocol": "tcp",
|
"IpProtocol": "tcp",
|
||||||
"FromPort": "135",
|
"FromPort": "135",
|
||||||
|
"ToPort": "135",
|
||||||
"CidrIp": "$cidr"
|
"CidrIp": "$cidr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ToPort": "1433",
|
|
||||||
"IpProtocol": "tcp",
|
"IpProtocol": "tcp",
|
||||||
"FromPort": "1433",
|
"FromPort": "1433",
|
||||||
|
"ToPort": "1433",
|
||||||
"CidrIp": "0.0.0.0/0"
|
"CidrIp": "0.0.0.0/0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "1434",
|
||||||
|
"ToPort": "1434",
|
||||||
|
"CidrIp": "0.0.0.0/0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "4022",
|
||||||
|
"ToPort": "4022",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "49152",
|
||||||
|
"ToPort": "65535",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"Resources": {
|
||||||
|
"$MuranoSecurityGroup-{envName}": {
|
||||||
|
"Type": "AWS::EC2::SecurityGroup",
|
||||||
|
"Properties": {
|
||||||
|
"SecurityGroupIngress": [
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "135",
|
||||||
|
"ToPort": "135",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "137",
|
||||||
|
"ToPort": "137",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "tcp",
|
||||||
|
"FromPort": "3343",
|
||||||
|
"ToPort": "3343",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "3343",
|
||||||
|
"ToPort": "3343",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"IpProtocol": "udp",
|
||||||
|
"FromPort": "49152",
|
||||||
|
"ToPort": "65535",
|
||||||
|
"CidrIp": "$cidr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ heat:
|
|||||||
- WebServerSecurity.template
|
- WebServerSecurity.template
|
||||||
- LinuxSecurity.template
|
- LinuxSecurity.template
|
||||||
- Keypair.template
|
- Keypair.template
|
||||||
|
- FloatingIP.template
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
- DeployApache.template
|
- DeployApache.template
|
||||||
|
@ -30,6 +30,7 @@ heat:
|
|||||||
- LinuxSecurity.template
|
- LinuxSecurity.template
|
||||||
- TelnetSecurity.template
|
- TelnetSecurity.template
|
||||||
- Keypair.template
|
- Keypair.template
|
||||||
|
- FloatingIP.template
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
- DeployTelnet.template
|
- DeployTelnet.template
|
||||||
|
@ -31,6 +31,7 @@ heat:
|
|||||||
- DefaultSecurity.template
|
- DefaultSecurity.template
|
||||||
- WindowsSecurity.template
|
- WindowsSecurity.template
|
||||||
- SQL-security.template
|
- SQL-security.template
|
||||||
|
- WSFCSecurity.template
|
||||||
|
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
@ -48,8 +49,8 @@ scripts:
|
|||||||
- ImportCoreFunctions.ps1
|
- ImportCoreFunctions.ps1
|
||||||
- Set-LocalUserPassword.ps1
|
- Set-LocalUserPassword.ps1
|
||||||
- Update-ServiceConfig.ps1
|
- Update-ServiceConfig.ps1
|
||||||
- SQLServerForAOAG.ps1
|
- SqlServerCluster/SQLServerForAOAG.ps1
|
||||||
- Failover-Cluster.ps1
|
- SqlServerCluster/Failover-Cluster.ps1
|
||||||
- Start-PowerShellProcess.ps1
|
- Start-PowerShellProcess.ps1
|
||||||
- OptionParser.ps1
|
- OptionParser.ps1
|
||||||
- SQLServer/SQLServerOptionParsers.ps1
|
- SQLServer/SQLServerOptionParsers.ps1
|
||||||
|
@ -31,6 +31,7 @@ heat:
|
|||||||
- DefaultSecurity.template
|
- DefaultSecurity.template
|
||||||
- WindowsSecurity.template
|
- WindowsSecurity.template
|
||||||
- SQL-security.template
|
- SQL-security.template
|
||||||
|
- FloatingIP.template
|
||||||
|
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
|
@ -82,6 +82,16 @@ forms:
|
|||||||
type: password
|
type: password
|
||||||
label: Recovery password
|
label: Recovery password
|
||||||
attributeNames: false
|
attributeNames: false
|
||||||
|
- name: assignFloatingIP
|
||||||
|
required: false
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically to Primary DC
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname template
|
label: Hostname template
|
||||||
|
@ -53,6 +53,16 @@ forms:
|
|||||||
errorMessages:
|
errorMessages:
|
||||||
invalid: Enter correct git repository url
|
invalid: Enter correct git repository url
|
||||||
helpText: Enter a valid git repository URL
|
helpText: Enter a valid git repository URL
|
||||||
|
- name: assignFloatingIP
|
||||||
|
required: false
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname template
|
label: Hostname template
|
||||||
|
@ -66,11 +66,6 @@ forms:
|
|||||||
maxValue: 100
|
maxValue: 100
|
||||||
initial: 2
|
initial: 2
|
||||||
helpText: Enter an integer value between 2 and 100
|
helpText: Enter an integer value between 2 and 100
|
||||||
- name: loadBalancerIp
|
|
||||||
type: clusterip
|
|
||||||
label: Load Balancer VIP
|
|
||||||
description: Specify IP number where Load Balancer will be running
|
|
||||||
helpText: Enter an free IP address from the subnet where instances will be created
|
|
||||||
- name: loadBalancerPort
|
- name: loadBalancerPort
|
||||||
type: integer
|
type: integer
|
||||||
label: Load Balancer port
|
label: Load Balancer port
|
||||||
@ -79,6 +74,15 @@ forms:
|
|||||||
initial: 80
|
initial: 80
|
||||||
description: Specify port number where Load Balancer will be running
|
description: Specify port number where Load Balancer will be running
|
||||||
helpText: Enter an integer value from 1 to 65536
|
helpText: Enter an integer value from 1 to 65536
|
||||||
|
- name: assignFloatingIP
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname template
|
label: Hostname template
|
||||||
|
@ -27,6 +27,15 @@ forms:
|
|||||||
label: Instance Count
|
label: Instance Count
|
||||||
description: Several instances with Apache web Service can be created at one time.
|
description: Several instances with Apache web Service can be created at one time.
|
||||||
helpText: Enter an integer value between 1 and 10
|
helpText: Enter an integer value between 1 and 10
|
||||||
|
- name: assignFloatingIP
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname
|
label: Hostname
|
||||||
|
@ -27,6 +27,15 @@ forms:
|
|||||||
hidden: true
|
hidden: true
|
||||||
attributeNames: units
|
attributeNames: units
|
||||||
initial: 1
|
initial: 1
|
||||||
|
- name: assignFloatingIP
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname
|
label: Hostname
|
||||||
|
@ -94,6 +94,10 @@ forms:
|
|||||||
type: clusterip
|
type: clusterip
|
||||||
label: Cluster Static IP
|
label: Cluster Static IP
|
||||||
description: Specify a valid IPv4 fixed IP.
|
description: Specify a valid IPv4 fixed IP.
|
||||||
|
# temporaryHack
|
||||||
|
widgetMedia:
|
||||||
|
js: [muranodashboard/js/support_placeholder.js]
|
||||||
|
css: {all: [muranodashboard/css/support_placeholder.css]}
|
||||||
- name: clusterName
|
- name: clusterName
|
||||||
type: string
|
type: string
|
||||||
label: Cluster Name
|
label: Cluster Name
|
||||||
@ -127,6 +131,10 @@ forms:
|
|||||||
errorMessages:
|
errorMessages:
|
||||||
invalid: Just letters, numbers, underscores and hyphens are allowed.
|
invalid: Just letters, numbers, underscores and hyphens are allowed.
|
||||||
description: User name that will be created to manage cluster instances.
|
description: User name that will be created to manage cluster instances.
|
||||||
|
# temporaryHack
|
||||||
|
widgetMedia:
|
||||||
|
js: [muranodashboard/js/support_placeholder.js]
|
||||||
|
css: {all: [muranodashboard/css/support_placeholder.css]}
|
||||||
- name: sqlServicePassword
|
- name: sqlServicePassword
|
||||||
type: password
|
type: password
|
||||||
label: SQL User Password
|
label: SQL User Password
|
||||||
@ -140,6 +148,15 @@ forms:
|
|||||||
attributeNames: false
|
attributeNames: false
|
||||||
helpText: Enter an integer value between 2 and 5
|
helpText: Enter an integer value between 2 and 5
|
||||||
description: Microsoft SQL Failover Cluster includes up to 5 instances.
|
description: Microsoft SQL Failover Cluster includes up to 5 instances.
|
||||||
|
- name: assignFloatingIP
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname template
|
label: Hostname template
|
||||||
|
@ -64,6 +64,15 @@ forms:
|
|||||||
description: Set system administrator password for the MS SQL Server.
|
description: Set system administrator password for the MS SQL Server.
|
||||||
helpText: SQL server System Administrator account
|
helpText: SQL server System Administrator account
|
||||||
required: {YAQL: $.serviceConfiguration.mixedModeAuth}
|
required: {YAQL: $.serviceConfiguration.mixedModeAuth}
|
||||||
|
- name: assignFloatingIP
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname template
|
label: Hostname template
|
||||||
|
@ -44,6 +44,15 @@ forms:
|
|||||||
Service can be joined to the Active Directory domain. If you want to
|
Service can be joined to the Active Directory domain. If you want to
|
||||||
create an AD domain create the AD Service first.
|
create an AD domain create the AD Service first.
|
||||||
helpText: Optional field for a domain to which service can be joined
|
helpText: Optional field for a domain to which service can be joined
|
||||||
|
- name: assignFloatingIP
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
required: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname template
|
label: Hostname template
|
||||||
|
@ -54,11 +54,6 @@ forms:
|
|||||||
label: Instance Count
|
label: Instance Count
|
||||||
description: Several instances with IIS Service can be created at one time.
|
description: Several instances with IIS Service can be created at one time.
|
||||||
helpText: Enter an integer value between 2 and 100
|
helpText: Enter an integer value between 2 and 100
|
||||||
- name: loadBalancerIp
|
|
||||||
type: clusterip
|
|
||||||
label: Load Balancer VIP
|
|
||||||
description: Specify IP number where Load Balancer will be running
|
|
||||||
helpText: Enter an free IP address from the subnet where instances will be created
|
|
||||||
- name: loadBalancerPort
|
- name: loadBalancerPort
|
||||||
type: integer
|
type: integer
|
||||||
label: Load Balancer port
|
label: Load Balancer port
|
||||||
@ -67,6 +62,15 @@ forms:
|
|||||||
initial: 80
|
initial: 80
|
||||||
description: Specify port number where Load Balancer will be running
|
description: Specify port number where Load Balancer will be running
|
||||||
helpText: Enter an integer value from 1 to 65536
|
helpText: Enter an integer value from 1 to 65536
|
||||||
|
- name: assignFloatingIP
|
||||||
|
required: false
|
||||||
|
type: floatingip
|
||||||
|
label: Assign Floating IP
|
||||||
|
description: >-
|
||||||
|
Select to true to assign floating IP automatically
|
||||||
|
initial: false
|
||||||
|
widgetMedia:
|
||||||
|
css: {all: [muranodashboard/css/checkbox.css]}
|
||||||
- name: unitNamingPattern
|
- name: unitNamingPattern
|
||||||
type: string
|
type: string
|
||||||
label: Hostname template
|
label: Hostname template
|
||||||
|
@ -30,6 +30,7 @@ heat:
|
|||||||
- DefaultSecurity.template
|
- DefaultSecurity.template
|
||||||
- WindowsSecurity.template
|
- WindowsSecurity.template
|
||||||
- WebServerSecurity.template
|
- WebServerSecurity.template
|
||||||
|
- FloatingIP.template
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
- SetPassword.template
|
- SetPassword.template
|
||||||
|
@ -30,6 +30,7 @@ heat:
|
|||||||
- DefaultSecurity.template
|
- DefaultSecurity.template
|
||||||
- WindowsSecurity.template
|
- WindowsSecurity.template
|
||||||
- WebServerSecurity.template
|
- WebServerSecurity.template
|
||||||
|
- FloatingIPwithLB.template
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
- SetPassword.template
|
- SetPassword.template
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<workflow>
|
<workflow>
|
||||||
|
|
||||||
<rule match="$[?(@.networking.state.ready_for_cf)].services[?(@.type == 'linuxApacheService' and @.keyPair)].units[?(not @.temp.KeyPairMapping)]"
|
<rule match="$[?(@.networking.state.ready_for_cf)].services[?(@.type == 'linuxApacheService' and @.keyPair)].units[?(@.state.hostname and not @.temp.KeyPairMapping)]"
|
||||||
desc="This rule allows to set Key Pair for all VMs with this service">
|
desc="This rule allows to set Key Pair for all VMs with this service">
|
||||||
<update-cf-stack template="Keypair" result="outputs" error="exception">
|
<update-cf-stack template="Keypair" error="exception">
|
||||||
<parameter name="mappings">
|
<parameter name="mappings">
|
||||||
<map>
|
<map>
|
||||||
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
||||||
@ -116,7 +116,7 @@
|
|||||||
<select path="id"/>
|
<select path="id"/>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="text">
|
<parameter name="text">
|
||||||
insatalling Apache on unit <select path="state.hostname"/> (<select path="name"/>)
|
Installing Apache on unit <select path="state.hostname"/> (<select path="name"/>)
|
||||||
</parameter>
|
</parameter>
|
||||||
</report>
|
</report>
|
||||||
<!-- Commands sequence -->
|
<!-- Commands sequence -->
|
||||||
|
@ -22,4 +22,36 @@
|
|||||||
</rule>
|
</rule>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<rule match="$[?(@.networking.state.ready_for_cf and @.networking.topology == 'routed')].services[?(@.type not in ('webServerFarm', 'aspNetAppFarm') and @.assignFloatingIP)].units[?(not @.temp.floatingIpAssigned)]"
|
||||||
|
desc="Units of non-farms services which have no floating assigned yet">
|
||||||
|
<report entity="unit">
|
||||||
|
<parameter name="id"><select path="id"/></parameter>
|
||||||
|
<parameter name="text">Assigning Floating IP to the <select path="state.hostname"/> instance</parameter>
|
||||||
|
</report>
|
||||||
|
<update-cf-stack template="FloatingIP" result="outputs" error="exception">
|
||||||
|
<parameter name="mappings">
|
||||||
|
<map>
|
||||||
|
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
||||||
|
<mapping name="externalNetworkId"><select path="/networking.floatingId"/></mapping>
|
||||||
|
<mapping name="instancePort">port-<select path="state.hostname"/></mapping>
|
||||||
|
</map>
|
||||||
|
</parameter>
|
||||||
|
<success>
|
||||||
|
<set path="temp.floatingIpAssigned"><true/></set>
|
||||||
|
<set path="floatingip"><select source="outputs"><parameter name="path"><select path="state.hostname"/>-FloatingIPaddress</parameter></select></set>
|
||||||
|
<report entity="unit">
|
||||||
|
<parameter name="id"><select path="id"/></parameter>
|
||||||
|
<parameter name="text">Floating IP has been assigned to <select path="state.hostname"/></parameter>
|
||||||
|
</report>
|
||||||
|
</success>
|
||||||
|
<failure>
|
||||||
|
<report entity="unit" level="error">
|
||||||
|
<parameter name="id"><select path="id"/></parameter>
|
||||||
|
<parameter name="text">Unable to assign floating IP to instance <select path="state.hostname"/> (<select path="name"/>) due to <format-error error="exception"/></parameter>
|
||||||
|
</report>
|
||||||
|
<stop/>
|
||||||
|
</failure>
|
||||||
|
</update-cf-stack>
|
||||||
|
</rule>
|
||||||
|
|
||||||
</workflow>
|
</workflow>
|
@ -8,9 +8,9 @@
|
|||||||
</set>
|
</set>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule match="$[?(@.networking.state.ready_for_cf)].services[?(@.type == 'linuxTelnetService' and @.keyPair)].units[?(not @.temp.KeyPairMapping)]"
|
<rule match="$[?(@.networking.state.ready_for_cf)].services[?(@.type == 'linuxTelnetService' and @.keyPair)].units[?(@.state.hostname and not @.temp.KeyPairMapping)]"
|
||||||
desc="This rule allows to set Key Pair for all VMs with this service">
|
desc="This rule allows to set Key Pair for all VMs with this service">
|
||||||
<update-cf-stack template="Keypair" result="outputs" error="exception">
|
<update-cf-stack template="Keypair" error="exception">
|
||||||
<parameter name="mappings">
|
<parameter name="mappings">
|
||||||
<map>
|
<map>
|
||||||
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
<list>
|
<list>
|
||||||
<text>SQL-security</text>
|
<text>SQL-security</text>
|
||||||
<text>WindowsSecurity</text>
|
<text>WindowsSecurity</text>
|
||||||
|
<text>WSFCSecurity</text>
|
||||||
|
<text>SQLClusterSecurity</text>
|
||||||
</list>
|
</list>
|
||||||
</set>
|
</set>
|
||||||
</rule>
|
</rule>
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
<set path="networking.routerId">
|
<set path="networking.routerId">
|
||||||
<select source="result" path="routerId"/>
|
<select source="result" path="routerId"/>
|
||||||
</set>
|
</set>
|
||||||
|
<set path="networking.floatingId">
|
||||||
|
<select source="result" path="floatingId"/>
|
||||||
|
</set>
|
||||||
|
|
||||||
<rule match="$[?(@.networking.routerId == 'NOT_FOUND')]"
|
<rule match="$[?(@.networking.routerId == 'NOT_FOUND')]"
|
||||||
desc="Router could not be found">
|
desc="Router could not be found">
|
||||||
|
@ -63,14 +63,13 @@
|
|||||||
<parameter name="mappings">
|
<parameter name="mappings">
|
||||||
<map>
|
<map>
|
||||||
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
||||||
<mapping name="lbIp"><select path="::loadBalancerIp"/></mapping>
|
|
||||||
<mapping name="lbPort"><select path="::loadBalancerPort"/></mapping>
|
<mapping name="lbPort"><select path="::loadBalancerPort"/></mapping>
|
||||||
<mapping name="lbName"><select path="::name"/></mapping>
|
<mapping name="lbName"><select path="::name"/></mapping>
|
||||||
</map>
|
</map>
|
||||||
</parameter>
|
</parameter>
|
||||||
<success>
|
<success>
|
||||||
<set path="temp.registeredWithLB"><true/></set>
|
<set path="temp.registeredWithLB"><true/></set>
|
||||||
<set path="::uri">http://<select path="::loadBalancerIp"/>:<select path="::loadBalancerPort"/></set>
|
<set path="::uri">http://<select source="outputs"><parameter name="path"><select path="::name"/>-loadBalancerIp</parameter></select>:<select path="::loadBalancerPort"/></set>
|
||||||
</success>
|
</success>
|
||||||
<failure>
|
<failure>
|
||||||
<report entity="unit" level="error">
|
<report entity="unit" level="error">
|
||||||
@ -82,6 +81,35 @@
|
|||||||
</update-cf-stack>
|
</update-cf-stack>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<rule match="$[?(@.networking.state.ready_for_cf and @.networking.topology == 'routed')].services[?(@.type in ('webServerFarm', 'aspNetAppFarm') and @.assignFloatingIP and not @.floatingip)]"
|
||||||
|
desc="Web-farms services which have no floating assigned yet">
|
||||||
|
<report entity="unit">
|
||||||
|
<parameter name="id"><select path="id"/></parameter>
|
||||||
|
<parameter name="text">Assigning Floating IP to the to LB</parameter>
|
||||||
|
</report>
|
||||||
|
<update-cf-stack template="FloatingIPwithLB" result="outputs" error="exception">
|
||||||
|
<parameter name="mappings">
|
||||||
|
<map>
|
||||||
|
<mapping name="lbName"><select path="name"/></mapping>
|
||||||
|
<mapping name="externalNetworkId"><select path="/networking.floatingId"/></mapping>
|
||||||
|
</map>
|
||||||
|
</parameter>
|
||||||
|
<success>
|
||||||
|
<set path="floatingip"><select source="outputs"><parameter name="path"><select path="name"/>-FloatingIPaddress</parameter></select></set>
|
||||||
|
<report entity="unit">
|
||||||
|
<parameter name="id"><select path="id"/></parameter>
|
||||||
|
<parameter name="text">Floating IP has been assigned to LB</parameter>
|
||||||
|
</report>
|
||||||
|
</success>
|
||||||
|
<failure>
|
||||||
|
<report entity="unit" level="error">
|
||||||
|
<parameter name="id"><select path="id"/></parameter>
|
||||||
|
<parameter name="text">Unable to assign floating IP to <select path="name"/> due to <format-error error="exception"/></parameter>
|
||||||
|
</report>
|
||||||
|
</failure>
|
||||||
|
</update-cf-stack>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm') and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
|
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm') and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
|
||||||
desc="Units of web services which have got an instance deployed but has not got a correct admin password ">
|
desc="Units of web services which have got an instance deployed but has not got a correct admin password ">
|
||||||
<send-command template="SetPassword" error='exception'>
|
<send-command template="SetPassword" error='exception'>
|
||||||
|
@ -77,7 +77,9 @@ def get_locations(data_type, result_path):
|
|||||||
# add keep path relative to result_path
|
# add keep path relative to result_path
|
||||||
base, diff = path.rsplit(result_path, 2)
|
base, diff = path.rsplit(result_path, 2)
|
||||||
# split base path and remove slash
|
# split base path and remove slash
|
||||||
name = os.path.join(diff[1:], name)
|
if diff.startswith('/'):
|
||||||
|
diff = diff[1:]
|
||||||
|
name = os.path.join(diff, name)
|
||||||
locations.append(name)
|
locations.append(name)
|
||||||
return jsonify({data_type: locations})
|
return jsonify({data_type: locations})
|
||||||
|
|
||||||
@ -226,7 +228,7 @@ def create_or_update_service(service_id, data):
|
|||||||
'version': 0.1,
|
'version': 0.1,
|
||||||
'description': '',
|
'description': '',
|
||||||
'author': '',
|
'author': '',
|
||||||
'service_version': ''}
|
'service_version': 1}
|
||||||
|
|
||||||
for parameter in required:
|
for parameter in required:
|
||||||
if not data.get(parameter):
|
if not data.get(parameter):
|
||||||
|
@ -63,6 +63,7 @@ def download_service_archive(service_name):
|
|||||||
except:
|
except:
|
||||||
log.exception(_('Unable to create service archive'))
|
log.exception(_('Unable to create service archive'))
|
||||||
abort(500)
|
abort(500)
|
||||||
|
else:
|
||||||
return send_file(file, mimetype='application/octet-stream')
|
return send_file(file, mimetype='application/octet-stream')
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ import sys
|
|||||||
import eventlet
|
import eventlet
|
||||||
import tempfile
|
import tempfile
|
||||||
from eventlet import wsgi
|
from eventlet import wsgi
|
||||||
from oslo.config import cfg
|
|
||||||
import gettext
|
import gettext
|
||||||
|
from muranorepository.openstack.common.gettextutils import _ # noqa
|
||||||
# If ../murano_service/__init__.py exists, add ../ to Python search path,
|
# If ../murano_service/__init__.py exists, add ../ to Python search path,
|
||||||
# so that it will override what happens to be installed in
|
# so that it will override what happens to be installed in
|
||||||
# /usr/(local/)lib/python...
|
# /usr/(local/)lib/python...
|
||||||
@ -37,7 +37,7 @@ if os.path.exists(os.path.join(possible_topdir,
|
|||||||
|
|
||||||
gettext.install('muranorepository', unicode=1)
|
gettext.install('muranorepository', unicode=1)
|
||||||
|
|
||||||
from muranorepository import config
|
from muranorepository import config as cfg
|
||||||
import muranorepository.main as server
|
import muranorepository.main as server
|
||||||
from muranorepository.openstack.common import log
|
from muranorepository.openstack.common import log
|
||||||
|
|
||||||
@ -48,12 +48,17 @@ LOG = log.getLogger(__name__)
|
|||||||
def main():
|
def main():
|
||||||
dev_conf = os.path.join(possible_topdir,
|
dev_conf = os.path.join(possible_topdir,
|
||||||
'etc',
|
'etc',
|
||||||
|
'murano',
|
||||||
'murano-repository.conf')
|
'murano-repository.conf')
|
||||||
config_files = None
|
config_files = None
|
||||||
if os.path.exists(dev_conf):
|
if os.path.exists(dev_conf):
|
||||||
config_files = [dev_conf]
|
config_files = [dev_conf]
|
||||||
|
|
||||||
config.parse_configs(sys.argv[1:], config_files)
|
if not sys.argv[1:] and not config_files:
|
||||||
|
msg = _('Unable to locate config file for murano-repository.')
|
||||||
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
|
cfg.parse_configs(sys.argv[1:], config_files)
|
||||||
log.setup('muranorepository')
|
log.setup('muranorepository')
|
||||||
|
|
||||||
#configuring and initializing cache directory
|
#configuring and initializing cache directory
|
||||||
@ -75,10 +80,10 @@ def main():
|
|||||||
'admin_tenant_name': cfg.CONF.keystone.admin_tenant_name,
|
'admin_tenant_name': cfg.CONF.keystone.admin_tenant_name,
|
||||||
'signing_dir': cfg.CONF.keystone.signing_dir
|
'signing_dir': cfg.CONF.keystone.signing_dir
|
||||||
})
|
})
|
||||||
if not os.path.isabs(config.CONF.manifests):
|
if not os.path.isabs(cfg.CONF.manifests):
|
||||||
config.CONF.manifests = os.path.join(possible_topdir,
|
cfg.CONF.manifests = os.path.join(possible_topdir,
|
||||||
'muranorepository',
|
'muranorepository',
|
||||||
config.CONF.manifests)
|
cfg.CONF.manifests)
|
||||||
wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port),
|
wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port),
|
||||||
backlog=500),
|
backlog=500),
|
||||||
app)
|
app)
|
||||||
|
@ -60,7 +60,7 @@ def parse_configs(argv=None, conf_files=None):
|
|||||||
global ARGV
|
global ARGV
|
||||||
ARGV = argv
|
ARGV = argv
|
||||||
try:
|
try:
|
||||||
CONF(ARGV, project='murano_service', version="0.1",
|
CONF(ARGV, project='murano-repository', version='0.4.1',
|
||||||
default_config_files=conf_files)
|
default_config_files=conf_files)
|
||||||
except cfg.RequiredOptError as roe:
|
except cfg.RequiredOptError as roe:
|
||||||
raise RuntimeError("Option '%s' is required for config group "
|
raise RuntimeError("Option '%s' is required for config group "
|
||||||
|
@ -22,7 +22,6 @@ PIPAPPS="pip python-pip pip-python"
|
|||||||
PIPCMD=""
|
PIPCMD=""
|
||||||
SERVICE_SRV_NAME="murano-repository"
|
SERVICE_SRV_NAME="murano-repository"
|
||||||
GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
|
GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
|
||||||
#ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME"
|
|
||||||
ETC_CFG_DIR="/etc/murano"
|
ETC_CFG_DIR="/etc/murano"
|
||||||
LOG_DIR="/var/log/murano/"
|
LOG_DIR="/var/log/murano/"
|
||||||
SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-repository.conf"
|
SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-repository.conf"
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
name = murano-repository
|
name = murano-repository
|
||||||
version = 0.4
|
version = 0.4.1
|
||||||
summary = Murano Metadata Repository
|
summary = Murano Metadata Repository
|
||||||
description-file = README.rst
|
description-file = README.rst
|
||||||
license = Apache Software License
|
license = Apache Software License
|
||||||
|
387
setup.sh
Normal file → Executable file
387
setup.sh
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# Copyright (c) 2013 Mirantis, Inc.
|
# Copyright (c) 2014 Mirantis, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -13,245 +13,236 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
# Ubuntu script.
|
RUN_DIR=$(cd $(dirname "$0") && pwd)
|
||||||
|
INC_FILE="$RUN_DIR/common.inc"
|
||||||
LOGLVL=1
|
if [ -f "$INC_FILE" ]; then
|
||||||
SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd`
|
source "$INC_FILE"
|
||||||
PREREQ_PKGS="wget make git python-pip python-dev python-mysqldb libxml2-dev libxslt-dev libffi-dev"
|
|
||||||
SERVICE_SRV_NAME="murano-repository"
|
|
||||||
GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
|
|
||||||
#ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME"
|
|
||||||
ETC_CFG_DIR="/etc/murano"
|
|
||||||
LOG_DIR="/var/log/murano/"
|
|
||||||
SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-repository.conf"
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
# Loger function
|
|
||||||
log()
|
|
||||||
{
|
|
||||||
MSG=$1
|
|
||||||
if [ $LOGLVL -gt 0 ]; then
|
|
||||||
echo "LOG:> $MSG"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check or install package
|
|
||||||
in_sys_pkg()
|
|
||||||
{
|
|
||||||
PKG=$1
|
|
||||||
dpkg -s $PKG > /dev/null 2>&1
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
log "Package \"$PKG\" already installed"
|
|
||||||
else
|
else
|
||||||
log "Installing \"$PKG\"..."
|
echo "Can't load \"$INC_FILE\" or file not found, exiting!"
|
||||||
apt-get install $PKG --yes > /dev/null 2>&1
|
exit 1
|
||||||
if [ $? -ne 0 ];then
|
|
||||||
log "installation fails, exiting!!!"
|
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
fi
|
#
|
||||||
}
|
DAEMON_NAME="murano-repository"
|
||||||
|
DAEMON_USER="murano"
|
||||||
|
DAEMON_GROUP="murano"
|
||||||
|
DAEMON_CFG_DIR="/etc/murano"
|
||||||
|
DAEMON_CACHE_DIR="/var/cache/murano"
|
||||||
|
DAEMON_LOG_DIR="/var/log/murano"
|
||||||
|
LOGFILE="/tmp/${DAEMON_NAME}_install.log"
|
||||||
|
DAEMON_DB_CONSTR="sqlite:///$DAEMON_CFG_DIR/$DAEMON_NAME.sqlite"
|
||||||
|
common_pkgs="wget git make gcc python-pip python-setuptools"
|
||||||
|
# Distro-specific package namings
|
||||||
|
debian_pkgs="python-dev python-mysqldb libxml2-dev libxslt1-dev libffi-dev"
|
||||||
|
redhat_pkgs="python-devel MySQL-python libxml2-devel libxslt-devel libffi-devel"
|
||||||
|
#
|
||||||
|
get_os
|
||||||
|
eval req_pkgs="\$$(lowercase $DISTRO_BASED_ON)_pkgs"
|
||||||
|
REQ_PKGS="$common_pkgs $req_pkgs"
|
||||||
|
|
||||||
# git clone
|
function install_prerequisites()
|
||||||
gitclone()
|
|
||||||
{
|
{
|
||||||
FROM=$1
|
retval=0
|
||||||
CLONEROOT=$2
|
_dist=$(lowercase $DISTRO_BASED_ON)
|
||||||
log "Cloning from \"$FROM\" repo to \"$CLONEROOT\""
|
if [ $_dist = "redhat" ]; then
|
||||||
cd $CLONEROOT && git clone $FROM > /dev/null 2>&1
|
yum repolist | grep -qoE "epel"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log "cloning from \"$FROM\" fails, exiting!!!"
|
log "Enabling EPEL6..."
|
||||||
exit
|
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm >> $LOGFILE 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "... can't enable EPEL6, exiting!"
|
||||||
|
retval=1
|
||||||
|
return $retval
|
||||||
fi
|
fi
|
||||||
}
|
fi
|
||||||
|
yum --quiet makecache
|
||||||
# install
|
fi
|
||||||
inst()
|
for pack in $REQ_PKGS
|
||||||
{
|
|
||||||
CLONE_FROM_GIT=$1
|
|
||||||
# Checking packages
|
|
||||||
for PKG in $PREREQ_PKGS
|
|
||||||
do
|
do
|
||||||
in_sys_pkg $PKG
|
find_or_install "$pack"
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
retval=1
|
||||||
|
break
|
||||||
|
else
|
||||||
|
retval=0
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
return $retval
|
||||||
# If clone from git set
|
}
|
||||||
if [ ! -z $CLONE_FROM_GIT ]; then
|
function make_tarball()
|
||||||
# Preparing clone root directory
|
{
|
||||||
if [ ! -d $GIT_CLONE_DIR ];then
|
retval=0
|
||||||
log "Creting $GIT_CLONE_DIR directory..."
|
log "Preparing tarball package..."
|
||||||
mkdir -p $GIT_CLONE_DIR
|
setuppy="$RUN_DIR/setup.py"
|
||||||
|
if [ -e "$setuppy" ]; then
|
||||||
|
chmod +x $setuppy
|
||||||
|
rm -rf $RUN_DIR/*.egg-info
|
||||||
|
cd $RUN_DIR && python $setuppy egg_info > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
log "Can't create $GIT_CLONE_DIR, exiting!!!"
|
log "...\"$setuppy\" egg info creation fails, exiting!!!"
|
||||||
exit
|
retval=1
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Cloning from GIT
|
|
||||||
GIT_WEBPATH_PRFX="https://github.com/stackforge/"
|
|
||||||
gitclone "$GIT_WEBPATH_PRFX$SERVICE_SRV_NAME.git" $GIT_CLONE_DIR
|
|
||||||
# End clone from git section
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setupping...
|
|
||||||
log "Running setup.py"
|
|
||||||
MRN_CND_SPY=$SERVICE_CONTENT_DIRECTORY/setup.py
|
|
||||||
if [ -e $MRN_CND_SPY ]; then
|
|
||||||
chmod +x $MRN_CND_SPY
|
|
||||||
log "$MRN_CND_SPY output:_____________________________________________________________"
|
|
||||||
## Setup through pip
|
|
||||||
# Creating tarball
|
|
||||||
rm -rf $SERVICE_CONTENT_DIRECTORY/*.egg-info
|
|
||||||
cd $SERVICE_CONTENT_DIRECTORY && python $MRN_CND_SPY egg_info
|
|
||||||
if [ $? -ne 0 ];then
|
|
||||||
log "\"$MRN_CND_SPY\" egg info creation FAILS, exiting!!!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rm -rf $SERVICE_CONTENT_DIRECTORY/dist/*
|
rm -rf $RUN_DIR/dist/*
|
||||||
cd $SERVICE_CONTENT_DIRECTORY && $MRN_CND_SPY sdist
|
log "...\"setup.py sdist\" output will be recorded in \"$LOGFILE\""
|
||||||
|
cd $RUN_DIR && $setuppy sdist >> $LOGFILE 2>&1
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
log "\"$MRN_CND_SPY\" tarball creation FAILS, exiting!!!"
|
log "...\"$setuppy\" tarball creation fails, exiting!!!"
|
||||||
|
retval=1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Running tarball install
|
#TRBL_FILE=$(basename $(ls $RUN_DIR/dist/*.tar.gz | head -n 1))
|
||||||
TRBL_FILE=$(basename `ls $SERVICE_CONTENT_DIRECTORY/dist/*.tar.gz`)
|
TRBL_FILE=$(ls $RUN_DIR/dist/*.tar.gz | head -n 1)
|
||||||
pip install $SERVICE_CONTENT_DIRECTORY/dist/$TRBL_FILE
|
if [ ! -e "$TRBL_FILE" ]; then
|
||||||
if [ $? -ne 0 ];then
|
log "...tarball not found, exiting!"
|
||||||
log "pip install \"$TRBL_FILE\" FAILS, exiting!!!"
|
retval=1
|
||||||
exit 1
|
else
|
||||||
|
log "...success, tarball created as \"$TRBL_FILE\""
|
||||||
|
retval=0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "$MRN_CND_SPY not found!"
|
log "...\"$setuppy\" not found, exiting!"
|
||||||
|
retval=1
|
||||||
fi
|
fi
|
||||||
# Creating etc directory for config files
|
return $retval
|
||||||
if [ ! -d $ETC_CFG_DIR ];then
|
}
|
||||||
log "Creating $ETC_CFG_DIR directory..."
|
function run_pip_install()
|
||||||
mkdir -p $ETC_CFG_DIR
|
{
|
||||||
|
find_pip
|
||||||
|
retval=0
|
||||||
|
tarball_file=${1:-$TRBL_FILE}
|
||||||
|
log "Running \"$PIPCMD install $PIPARGS $tarball_file\" output will be recorded in \"$LOGFILE\""
|
||||||
|
$PIPCMD install $PIPARGS $tarball_file >> $LOGFILE 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log "Can't create $ETC_CFG_DIR, exiting!!!"
|
log "...pip install fails, exiting!"
|
||||||
|
retval=1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
return $retval
|
||||||
# Creating log directory for the murano
|
|
||||||
if [ ! -d $LOG_DIR ];then
|
|
||||||
log "Creating $LOG_DIR direcory..."
|
|
||||||
mkdir -p $LOG_DIR
|
|
||||||
if [ $? -ne 0 ];then
|
|
||||||
log "Can't create $LOG_DIR, exiting!!!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
chmod -R a+rw $LOG_DIR
|
|
||||||
fi
|
|
||||||
# making sample configs
|
|
||||||
log "Making sample configuration files at \"$ETC_CFG_DIR\""
|
|
||||||
for file in `ls $SERVICE_CONTENT_DIRECTORY/etc`
|
|
||||||
do
|
|
||||||
cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file"
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# searching for service executable in path
|
function inject_init()
|
||||||
get_service_exec_path()
|
|
||||||
{
|
{
|
||||||
if [ -z "$SERVICE_EXEC_PATH" ]; then
|
retval=0
|
||||||
SERVICE_EXEC_PATH=`which $SERVICE_SRV_NAME`
|
_dist=$(lowercase $DISTRO_BASED_ON)
|
||||||
|
eval src_init_sctipt="$DAEMON_NAME-$_dist"
|
||||||
|
_initscript="openstack-$DAEMON_NAME"
|
||||||
|
cp -f "$RUN_DIR/etc/init.d/$src_init_sctipt" "/etc/init.d/$_initscript" || retval=$?
|
||||||
|
chmod +x "/etc/init.d/$_initscript" || retval=$?
|
||||||
|
iniset '' 'SYSTEM_USER' "$DAEMON_USER" "/etc/init.d/$_initscript"
|
||||||
|
iniset '' 'DAEMON' "$(shslash $SERVICE_EXEC_PATH)" "/etc/init.d/$_initscript"
|
||||||
|
case $_dist in
|
||||||
|
"debian")
|
||||||
|
update-rc.d $_initscript defaults || retval=$?
|
||||||
|
update-rc.d $_initscript enable || retval=$?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
chkconfig --add $_initscript || retval=$?
|
||||||
|
chkconfig $_initscript on || retval=$?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
function purge_init()
|
||||||
|
{
|
||||||
|
retval=0
|
||||||
|
_dist=$(lowercase $DISTRO_BASED_ON)
|
||||||
|
_initscript="openstack-$DAEMON_NAME"
|
||||||
|
service $_initscript stop
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log "Can't find \"$SERVICE_SRV_NAME\", please install the \"$SERVICE_SRV_NAME\" by running \"$(basename "$0") install\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!"
|
retval=1
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ ! -x "$SERVICE_EXEC_PATH" ]; then
|
|
||||||
log "\"$SERVICE_EXEC_PATH\" in not executable, please install the \"$SERVICE_SRV_NAME\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
case $_dist in
|
||||||
|
"debian")
|
||||||
|
update-rc.d $_initscript disable
|
||||||
|
update-rc.d -f $_initscript remove || retval=$?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
chkconfig $_initscript off || retval=$?
|
||||||
|
chkconfig --del $_initscript || retval=$?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
rm -f "/etc/init.d/$_initscript" || retval=$?
|
||||||
|
return $retval
|
||||||
}
|
}
|
||||||
|
function run_pip_uninstall()
|
||||||
# inject init
|
|
||||||
injectinit()
|
|
||||||
{
|
{
|
||||||
ln -s /lib/init/upstart-job /etc/init.d/$SERVICE_SRV_NAME
|
find_pip
|
||||||
if [ $? -ne 0 ]; then
|
retval=0
|
||||||
log "Can't create symlink, please run \"$(basename "$0") purge-init\" before \"$(basename "$0") inject-init\", exiting"
|
pack_to_del=$(is_py_package_installed "$DAEMON_NAME")
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "description \"$SERVICE_SRV_NAME service\"
|
|
||||||
author \"Igor Yozhikov <iyozhikov@mirantis.com>\"
|
|
||||||
start on runlevel [2345]
|
|
||||||
stop on runlevel [!2345]
|
|
||||||
respawn
|
|
||||||
exec start-stop-daemon --start --chuid root --user root --name $SERVICE_SRV_NAME --exec $SERVICE_EXEC_PATH -- --config-file=$SERVICE_CONFIG_FILE_PATH" > "/etc/init/$SERVICE_SRV_NAME.conf"
|
|
||||||
log "Reloading initctl"
|
|
||||||
initctl reload-configuration
|
|
||||||
}
|
|
||||||
|
|
||||||
# purge init
|
|
||||||
purgeinit()
|
|
||||||
{
|
|
||||||
rm -f /etc/init.d/$SERVICE_SRV_NAME
|
|
||||||
rm -f /etc/init/$SERVICE_SRV_NAME.conf
|
|
||||||
log "Reloading initctl"
|
|
||||||
initctl reload-configuration
|
|
||||||
}
|
|
||||||
|
|
||||||
# uninstall
|
|
||||||
uninst()
|
|
||||||
{
|
|
||||||
# Uninstall trough pip
|
|
||||||
# looking up for python package installed
|
|
||||||
PYPKG=`echo $SERVICE_SRV_NAME | tr -d '-'`
|
|
||||||
pip freeze | grep $PYPKG
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
log "Removing package \"$PYPKG\" with pip"
|
log "Running \"$PIPCMD uninstall $PIPARGS $DAEMON_NAME\" output will be recorded in \"$LOGFILE\""
|
||||||
pip uninstall $PYPKG --yes
|
$PIPCMD uninstall $pack_to_del --yes >> $LOGFILE 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "...can't uninstall $DAEMON_NAME with $PIPCMD"
|
||||||
|
retval=1
|
||||||
else
|
else
|
||||||
log "Python package \"$PYPKG\" not found"
|
log "...success"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
log "Python package for \"$DAEMON_NAME\" not found"
|
||||||
|
fi
|
||||||
|
return $retval
|
||||||
}
|
}
|
||||||
|
function install_daemon()
|
||||||
# postinstall
|
|
||||||
postinst()
|
|
||||||
{
|
{
|
||||||
log "Please, make proper configuration,located at \"$ETC_CFG_DIR\", before starting the \"$SERVICE_SRV_NAME\" daemon!"
|
install_prerequisites || exit 1
|
||||||
|
make_tarball || exit $?
|
||||||
|
run_pip_install || exit $?
|
||||||
|
add_daemon_credentials "$DAEMON_USER" "$DAEMON_GROUP" || exit $?
|
||||||
|
log "Creating required directories..."
|
||||||
|
mk_dir "$DAEMON_CFG_DIR" "$DAEMON_USER" "$DAEMON_GROUP" || exit 1
|
||||||
|
mk_dir "$DAEMON_CACHE_DIR" "$DAEMON_USER" "$DAEMON_GROUP" || exit 1
|
||||||
|
mk_dir "$DAEMON_LOG_DIR" "$DAEMON_USER" "$DAEMON_GROUP" || exit 1
|
||||||
|
log "Making sample configuration files at \"$DAEMON_CFG_DIR\""
|
||||||
|
_src_conf_dir="$RUN_DIR/etc/murano"
|
||||||
|
for file in $(ls $_src_conf_dir)
|
||||||
|
do
|
||||||
|
#cp -f "$_src_conf_dir/$file" "$DAEMON_CFG_DIR/$file.sample"
|
||||||
|
cp -f "$_src_conf_dir/$file" "$DAEMON_CFG_DIR/$file"
|
||||||
|
config_file=$(echo $file | sed -e 's/.sample$//')
|
||||||
|
#if [ ! -e "$DAEMON_CFG_DIR/$file" ]; then
|
||||||
|
if [ ! -e "$DAEMON_CFG_DIR/$config_file" ]; then
|
||||||
|
cp -f "$_src_conf_dir/$file" "$DAEMON_CFG_DIR/$config_file"
|
||||||
|
else
|
||||||
|
log "\"$DAEMON_CFG_DIR/$config_file\" exists, skipping copy."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
log "Setting log file and sqlite db placement..."
|
||||||
|
iniset 'DEFAULT' 'log_file' "$(shslash $DAEMON_LOG_DIR/$DAEMON_NAME.log)" "$DAEMON_CFG_DIR/$DAEMON_NAME.conf"
|
||||||
|
iniset 'DEFAULT' 'verbose' 'True' "$DAEMON_CFG_DIR/$DAEMON_NAME.conf"
|
||||||
|
iniset 'DEFAULT' 'debug' 'True' "$DAEMON_CFG_DIR/$DAEMON_NAME.conf"
|
||||||
|
iniset 'DEFAULT' 'data_dir' "$(shslash $DAEMON_CACHE_DIR/muranorepository-data)" "$DAEMON_CFG_DIR/$DAEMON_NAME.conf"
|
||||||
|
log "Searching daemon in \$PATH..."
|
||||||
|
get_service_exec_path || exit $?
|
||||||
|
log "...found at \"$SERVICE_EXEC_PATH\""
|
||||||
|
log "Installing SysV init script."
|
||||||
|
inject_init || exit $?
|
||||||
|
log "Everything done, please, verify \"$DAEMON_CFG_DIR/$DAEMON_NAME.conf\", service created as \"openstack-${DAEMON_NAME}\"."
|
||||||
|
}
|
||||||
|
function uninstall_daemon()
|
||||||
|
{
|
||||||
|
log "Removing SysV init script..."
|
||||||
|
purge_init || exit $?
|
||||||
|
remove_daemon_credentials "$DAEMON_USER" "$DAEMON_GROUP" || exit $?
|
||||||
|
run_pip_uninstall || exit $?
|
||||||
|
log "Software uninstalled, daemon configuration files and logs located at \"$DAEMON_CFG_DIR\" and \"$DAEMON_LOG_DIR\"."
|
||||||
}
|
}
|
||||||
# Command line args'
|
# Command line args'
|
||||||
COMMAND="$1"
|
COMMAND="$1"
|
||||||
case $COMMAND in
|
case $COMMAND in
|
||||||
inject-init )
|
|
||||||
get_service_exec_path
|
|
||||||
log "Injecting \"$SERVICE_SRV_NAME\" to init..."
|
|
||||||
injectinit
|
|
||||||
postinst
|
|
||||||
;;
|
|
||||||
|
|
||||||
install)
|
install)
|
||||||
inst
|
rm -rf $LOGFILE
|
||||||
get_service_exec_path
|
log "Installing \"$DAEMON_NAME\" to system..."
|
||||||
injectinit
|
install_daemon
|
||||||
postinst
|
|
||||||
;;
|
|
||||||
|
|
||||||
installfromgit )
|
|
||||||
inst "yes"
|
|
||||||
get_service_exec_path
|
|
||||||
injectinit
|
|
||||||
postinst
|
|
||||||
;;
|
|
||||||
|
|
||||||
purge-init )
|
|
||||||
log "Purging \"$SERVICE_SRV_NAME\" from init..."
|
|
||||||
stop $SERVICE_SRV_NAME
|
|
||||||
purgeinit
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
uninstall )
|
uninstall )
|
||||||
log "Uninstalling \"$SERVICE_SRV_NAME\" from system..."
|
log "Uninstalling \"$DAEMON_NAME\" from system..."
|
||||||
stop $SERVICE_SRV_NAME
|
uninstall_daemon
|
||||||
purgeinit
|
|
||||||
uninst
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
* )
|
* )
|
||||||
echo "Usage: $(basename "$0") command \nCommands:\n\tinstall - Install $SERVICE_SRV_NAME software\n\tuninstall - Uninstall $SERVICE_SRV_NAME software\n\tinject-init - Add $SERVICE_SRV_NAME to the system start-up\n\tpurge-init - Remove $SERVICE_SRV_NAME from the system start-up"
|
echo -e "Usage: $(basename "$0") [command] \nCommands:\n\tinstall - Install \"$DAEMON_NAME\" software\n\tuninstall - Uninstall \"$DAEMON_NAME\" software"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user