Cherry-pick commits from release-0.4

*Update requirements and package version
Closes-Bug: #1269769

*Add new setup scripts
	Removed old setup scripts

* Make modify_horizon_config is up-to-date
	modify-horizon-config.sh helper script, this script
	used only for RPMBUILD and would be removed during code refractory procedure

* Show floating ip in details
	blueprint auto-assign-floating-ip

* Show floating IP checkbox only for 'routed'
	Set floatingIp to the unit level
	blueprint auto-assign-floating-ip

* Add hint for fixed IP address (as placeholder)
	Fixes-Bug: #1272361

* Check title in mark image form
	Title should be unique
	To prevent extra api call to glance hidden fiels was used
	Closes-Bug: 1259522

* Remove error code from inform messages
	Closes-Bug: 1268929

Change-Id: Id3ad4581cd9ce40a569ac580d0aee8db0178553c
This commit is contained in:
Ekaterina Fedorova 2014-01-17 12:42:01 +04:00
parent 69372d0a14
commit 42db5892f6
13 changed files with 473 additions and 679 deletions

View File

@ -2,6 +2,10 @@ Murano Dashboard README
=====================
Dashboard is a conponent that provides Web UI to Murano Project.
INSTALL FROM SOURCE
=====================
Please, use setup.sh script with root user privileges for install/uninstall of the software.
SEE ALSO
--------
* `Murano <http://Murano.mirantis.com>`__

View File

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (c) 2013 Mirantis, Inc.
# 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
@ -13,82 +13,107 @@
# License for the specific language governing permissions and limitations
# under the License.
#
# CentOS script.
# helper script.
LOGLVL=1
LOG_DIR="/var/log/murano"
APPLICATION_NAME="murano-dashboard"
APPLICATION_LOG_DIR="/var/log/murano"
APPLICATION_CACHE_DIR="/var/cache/$APPLICATION_NAME"
# Functions
# Loger function
log()
{
MSG=$1
if [ $LOGLVL -gt 0 ]; then
echo "LOG:> $MSG"
fi
MSG=$1
if [ $LOGLVL -gt 0 ]; then
echo "LOG:> $MSG"
fi
}
# patching horizon configuration
modify_horizon_config() {
REMOVE=$2
if [ -f $1 ]; then
lines=$(sed -ne '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ =' $1)
modify_horizon_config()
{
INFILE=$1
REMOVE=$2
PATTERN='from openstack_dashboard import policy'
TMPFILE="/tmp/tmpfile"
if [ -f $INFILE ]; then
lines=$(sed -ne '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ =' $INFILE)
if [ -n "$lines" ]; then
if [ ! -z $REMOVE ]; then
log "Removing our data from \"$1\"..."
sed -e '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ d' -i $1
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
exit
fi
if [ ! -z $REMOVE ]; then
log "Removing $APPLICATION_NAME data from \"$INFILE\"..."
sed -e '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ d' -i $INFILE
if [ $? -ne 0 ];then
log "...can't modify \"$INFILE\", check permissions or something else, exiting!!!"
exit 1
else
log "\"$1\" already has our data, you can change it manually and restart apache2 service"
log "...success"
fi
else
log "\"$INFILE\" already has $APPLICATION_NAME data, you can change it manually and restart apache2/httpd service"
fi
else
if [ -z $REMOVE ];then
log "Adding our data into \"$1\"..."
cat >> $1 << EOF
if [ -z "$REMOVE" ]; then
log "Adding $APPLICATION_NAME data to \"$INFILE\"..."
rm -f $TMPFILE
cat >> $TMPFILE << EOF
#START_MURANO_DASHBOARD
#TODO: should remove the next line once https://bugs.launchpad.net/ubuntu/+source/horizon/+bug/1243187 is fixed
LOGOUT_URL = '/horizon/auth/logout/'
METADATA_CACHE_DIR = '$APPLICATION_CACHE_DIR'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join('$APPLICATION_DB_DIR', 'openstack-dashboard.sqlite')
}
}
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
HORIZON_CONFIG['dashboards'] += ('murano',)
INSTALLED_APPS += ('muranodashboard','floppyforms',)
MIDDLEWARE_CLASSES += ('muranodashboard.middleware.ExceptionMiddleware',)
verbose_formatter = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
if 'formatters' in LOGGING: LOGGING['formatters'].update(verbose_formatter)
else: LOGGING['formatters'] = verbose_formatter
LOGGING['handlers']['murano-file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '$LOG_DIR/murano-dashboard.log'}
LOGGING['handlers']['murano-file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '$APPLICATION_LOG_DIR/murano-dashboard.log'}
LOGGING['loggers']['muranodashboard'] = {'handlers': ['murano-file'], 'level': 'DEBUG'}
LOGGING['loggers']['muranoclient'] = {'handlers': ['murano-file'], 'level': 'ERROR'}
ADVANCED_NETWORKING_CONFIG = {'max_environments': 100, 'max_hosts': 250, 'env_ip_template': '10.0.0.0'}
NETWORK_TOPOLOGY = 'routed'
#MURANO_API_URL = "http://localhost:8082"
#MURANO_METADATA_URL = "http://localhost:8084"
#MURANO_METADATA_URL = "http://localhost:8084/v1"
#if murano-api set up with ssl uncomment next strings
#MURANO_API_INSECURE = True
#END_MURANO_DASHBOARD
EOF
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
fi
fi
fi
else
echo "File \"$1\" not found, exiting!!!"
exit 1
sed -ne "/$PATTERN/r $TMPFILE" -e 1x -e '2,${x;p}' -e '${x;p}' -i $INFILE
if [ $? -ne 0 ];then
log "Can't modify \"$INFILE\", check permissions or something else, exiting!!!"
else
rm -f $TMPFILE
log "...success"
fi
fi
fi
else
echo "File \"$1\" not found, exiting!!!"
exit 1
fi
}
# Command line args'
COMMAND="$1"
cfg_file="/usr/share/openstack-dashboard/openstack_dashboard/settings.py"
case $COMMAND in
install )
modify_horizon_config $cfg_file
;;
install )
modify_horizon_config $cfg_file
;;
uninstall )
modify_horizon_config $cfg_file remove
;;
uninstall )
modify_horizon_config $cfg_file remove
;;
* )
exit 1
;;
*)
exit 1
;;
esac

View File

@ -17,7 +17,7 @@ function log {
if [ "$DEBUGLVL" -gt 0 ]; then
chars=$(echo "@$" | wc -c)
case $DEBUGLVL in
1 )
1)
echo -e "LOG:>$@"
;;
2)

View File

@ -574,6 +574,15 @@ class BooleanField(forms.BooleanField, CustomPropertiesField):
super(BooleanField, self).__init__(*args, **kwargs)
class FloatingIpBooleanField(BooleanField):
@with_request
def update(self, request, environment_id, **kwargs):
env = api.environment_get(request, environment_id)
network_topology = env.networking.get('topology')
if network_topology != 'routed':
self.widget.is_hidden = True
class ClusterIPField(CharField):
existing_subnet = None
network_topology = None
@ -643,6 +652,7 @@ class ClusterIPField(CharField):
self.help_text = _('Specify valid fixed IP')
self.validators = [self.make_nova_validator(request, ip_ranges)]
elif self.network_topology == 'routed':
self.widget.attrs['placeholder'] = self.existing_subnet
self.validators = [self.make_neutron_validator()]
else: # 'flat' topology
raise NotImplementedError('Flat topology is not implemented yet')

View File

@ -38,7 +38,8 @@ TYPES = {
'keypair': fields.KeyPairChoiceField,
'image': fields.ImageChoiceField,
'azone': fields.AZoneChoiceField,
'text': (fields.CharField, forms.Textarea)
'text': (fields.CharField, forms.Textarea),
'floatingip': fields.FloatingIpBooleanField
}

View File

@ -73,6 +73,9 @@ class OverviewTab(tabs.Tab):
if hasattr(service_data, 'uri'):
detail_info['Load Balancer URI'] = service_data.uri
if hasattr(service_data, 'floatingip'):
detail_info['Floating IP'] = service_data.floatingip
#check for deployed services so additional information can be added
units = []
for unit in service_data.units:
@ -109,11 +112,12 @@ class OverviewTab(tabs.Tab):
}
break
unit_detail['Floating IP'] = unit.get('floatingip')
if len(service_data.units) > 1:
units.append(unit_detail)
else:
detail_info.update(unit_detail)
return {'service': detail_info, 'units': units}

View File

@ -13,17 +13,37 @@
# under the License.
import logging
import json
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.forms import ValidationError
from horizon.forms import SelfHandlingForm
from horizon import messages, exceptions
from openstack_dashboard.api import glance
import json
log = logging.getLogger(__name__)
def filter_murano_images(images, request=None):
marked_images = []
for image in images:
metadata = image.properties.get('murano_image_info')
if metadata:
try:
metadata = json.loads(metadata)
except ValueError:
msg = _('Invalid metadata for image: {0}'.format(image.id))
log.warn(msg)
if request:
exceptions.handle(request, msg)
else:
image.title = metadata.get('title', 'No Title')
image.type = metadata.get('type', 'No Type')
marked_images.append(image)
return marked_images
class MarkImageForm(SelfHandlingForm):
_metadata = {
'windows.2012': ' Windows Server 2012',
@ -34,6 +54,7 @@ class MarkImageForm(SelfHandlingForm):
image = forms.ChoiceField(label='Image')
title = forms.CharField(max_length="255", label=_("Title"))
type = forms.ChoiceField(label="Type", choices=_metadata.items())
existing_titles = forms.CharField(widget=forms.HiddenInput)
def __init__(self, request, *args, **kwargs):
super(MarkImageForm, self).__init__(request, *args, **kwargs)
@ -46,6 +67,8 @@ class MarkImageForm(SelfHandlingForm):
exceptions.handle(request, _('Unable to retrieve list of images'))
self.fields['image'].choices = [(i.id, i.name) for i in images]
self.fields['existing_titles'].initial = \
[image.title for image in filter_murano_images(images)]
def handle(self, request, data):
log.debug('Marking image with specified metadata: {0}'.format(data))
@ -65,3 +88,13 @@ class MarkImageForm(SelfHandlingForm):
except Exception:
exceptions.handle(request, _('Unable to mark image'),
redirect='horizon:murano:images:index')
def clean_title(self):
cleaned_data = super(MarkImageForm, self).clean()
title = cleaned_data.get('title')
existing_titles = self.fields['existing_titles'].initial
if title in existing_titles:
raise ValidationError(_('Specified title already in use.'
' Please choose another one.'))
return title

View File

@ -13,21 +13,15 @@
# under the License.
import logging
import json
from django.core.urlresolvers import reverse, reverse_lazy
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard.api import glance
from horizon import exceptions
from horizon import tables
from horizon import messages
from horizon.forms.views import ModalFormView
from .tables import MarkedImagesTable
from .forms import MarkImageForm
LOG = logging.getLogger(__name__)
from .forms import MarkImageForm, filter_murano_images
class MarkedImagesView(tables.DataTableView):
@ -43,23 +37,7 @@ class MarkedImagesView(tables.DataTableView):
uri = reverse('horizon:murano:images:index')
exceptions.handle(self.request, msg, redirect=uri)
marked_images = []
for image in images:
metadata = image.properties.get('murano_image_info')
if metadata:
try:
metadata = json.loads(metadata)
except ValueError:
msg = _('Invalid metadata for image: {0}'.format(image.id))
LOG.warn(msg)
messages.error(self.request, msg)
else:
image.title = metadata.get('title', 'No Title')
image.type = metadata.get('type', 'No Type')
marked_images.append(image)
return marked_images
return filter_murano_images(images, request=self.request)
class MarkImageView(ModalFormView):

View File

@ -39,8 +39,7 @@ class UploadServiceForm(SelfHandlingForm):
log.exception(_('Uploading service failed'))
redirect = reverse('horizon:murano:service_catalog:index')
exceptions.handle(request,
_('Unable to upload service. '
'Error code: {0}'.format(e.code)),
_('Unable to upload service'),
redirect=redirect)
@ -76,10 +75,8 @@ class UploadFileToService(SelfHandlingForm):
redirect = reverse('horizon:murano:service_catalog:manage_service',
args=(self.service_id,))
log.exception(_('Uploading file failed'))
msg = _("Unable to upload {0} file of '{1}' type."
" Error code: {2}".format(filename,
self.data_type,
e.code))
msg = _("Unable to upload {0} file of "
"'{1}' type".format(filename, self.data_type))
exceptions.handle(request, msg, redirect=redirect)
def clean_file(self):
@ -118,8 +115,6 @@ class UploadFileForm(UploadFileToService):
redirect = reverse('horizon:murano:service_catalog:manage_files')
log.exception(_('Uploading file or '
'modifying service manifest file failed'))
msg = _("Unable to upload {0} file of '{1}' type."
" Error code: {2}".format(filename,
self.data_type,
e.code))
msg = _("Unable to upload {0} file "
"of '{1}' type.".format(filename, self.data_type))
exceptions.handle(request, msg, redirect=redirect)

View File

@ -1,6 +1,5 @@
pbr>=0.5.21,<1.0
anyjson>=0.3.3
bunch
iso8601>=0.1.8
six>=1.4.1
@ -8,5 +7,5 @@ PyYAML>=3.1.0
django-floppyforms==1.1
ordereddict
yaql==0.2
http://tarballs.openstack.org/python-muranoclient/python-muranoclient-master.tar.gz#egg=muranoclient-0.4
http://tarballs.openstack.org/murano-metadataclient/murano-metadataclient-master.tar.gz#egg=metadataclient-0.4
python-muranoclient==0.4.1
murano-metadataclient==0.4.1

View File

@ -1,343 +0,0 @@
#!/bin/sh
# Copyright (c) 2013 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.
#
# CentOS script.
LOGLVL=1
SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd`
PREREQ_PKGS="wget make git python-pip mysql-connector-python python-devel unzip libffi-devel"
PIPAPPS="pip python-pip pip-python"
PIPCMD=""
SERVICE_SRV_NAME="murano-dashboard"
GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
HORIZON_CONFIGS="/opt/stack/horizon/openstack_dashboard/settings.py,/usr/share/openstack-dashboard/openstack_dashboard/settings.py"
APACHE_USER=apache
APACHE_GROUP=apache
LOG_DIR="/var/log/murano/"
# Functions
# Loger function
log()
{
MSG=$1
if [ $LOGLVL -gt 0 ]; then
echo "LOG:> $MSG"
fi
}
# Check or install package
in_sys_pkg()
{
PKG=$1
rpm -q $PKG > /dev/null 2>&1
if [ $? -eq 0 ]; then
log "Package \"$PKG\" already installed"
else
log "Installing \"$PKG\"..."
yum install $PKG --assumeyes > /dev/null 2>&1
if [ $? -ne 0 ];then
log "installation fails, exiting!!!"
exit
fi
fi
}
# find pip
find_pip()
{
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
PIPCMD=$_cmd
fi
}
# git clone
gitclone()
{
FROM=$1
CLONEROOT=$2
log "Cloning from \"$FROM\" repo to \"$CLONEROOT\""
cd $CLONEROOT && git clone $FROM > /dev/null 2>&1
if [ $? -ne 0 ];then
log "cloning from \"$FROM\" fails, exiting!!!"
exit
fi
}
# patching horizon configuration
modify_horizon_config() {
REMOVE=$2
if [ -f $1 ]; then
lines=$(sed -ne '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ =' $1)
if [ -n "$lines" ]; then
if [ ! -z $REMOVE ]; then
log "Removing our data from \"$1\"..."
sed -e '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ d' -i $1
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
exit
fi
else
log "\"$1\" already has our data, you can change it manualy and restart apache2 service"
fi
else
if [ -z $REMOVE ];then
log "Adding our data into \"$1\"..."
cat >> $1 << EOF
#START_MURANO_DASHBOARD
#TODO: should remove the next line once https://bugs.launchpad.net/ubuntu/+source/horizon/+bug/1243187 is fixed
LOGOUT_URL = '/dashboard/auth/logout/'
import tempfile
METADATA_CACHE_DIR = os.path.join(tempfile.gettempdir(), 'muranodashboard-cache')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(METADATA_CACHE_DIR, 'openstack-dashboard.sqlite')
}
}
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
HORIZON_CONFIG['dashboards'] += ('murano',)
INSTALLED_APPS += ('muranodashboard','floppyforms',)
MIDDLEWARE_CLASSES += ('muranodashboard.middleware.ExceptionMiddleware',)
verbose_formatter = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
if 'formatters' in LOGGING: LOGGING['formatters'].update(verbose_formatter)
else: LOGGING['formatters'] = verbose_formatter
LOGGING['handlers']['murano-file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '$LOG_DIR/murano-dashboard.log'}
LOGGING['loggers']['muranodashboard'] = {'handlers': ['murano-file'], 'level': 'DEBUG'}
LOGGING['loggers']['muranoclient'] = {'handlers': ['murano-file'], 'level': 'ERROR'}
#MURANO_API_URL = "http://localhost:8082"
#MURANO_METADATA_URL = "http://localhost:8084/v1"
#if murano-api set up with ssl uncomment next strings
#MURANO_API_INSECURE = True
ADVANCED_NETWORKING_CONFIG = {'max_environments': 100, 'max_hosts': 250, 'env_ip_template': '10.0.0.0'}
NETWORK_TOPOLOGY = 'routed'
#END_MURANO_DASHBOARD
EOF
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
fi
fi
fi
else
echo "File \"$1\" not found, exiting!!!"
exit 1
fi
}
# searching horizon configuration
find_horizon_config()
{
FOUND=0
for cfg_file in $(echo $HORIZON_CONFIGS | sed 's/,/ /g' )
do
if [ -e $cfg_file ];then
log "Horizon config found at \"$cfg_file\""
modify_horizon_config $cfg_file $1
FOUND=1
fi
done
if [ $FOUND -eq 0 ];then
log "Horizon config not found or openstack-dashboard does not installed, to override this set proper \"HORIZON_CONFIGS\" variable, exiting!!!"
exit 1
fi
}
# preinstall checks
preinst()
{
# check openstack-dashboard installed from system packages
_PKG=openstack-dashboard
rpm -q $_PKG > /dev/null 2>&1
if [ $? -ne 0 ]; then
log "Package \"$_PKG\" is not installed."
fi
}
# rebuild static
rebuildstatic()
{
horizon_manage=$(rpm -ql openstack-dashboard | grep -E "*manage.py$")
if [ $? -ne 0 ]; then
log "openstack-dashboard manage.py not found, exiting!!!"
exit 1
fi
_old_murano_static="$(dirname $horizon_manage)/openstack_dashboard/static/muranodashboard"
if [ -d "$_old_murano_static" ];then
log "Our static for \"muranodashboard\" found under \"HORIZON\" STATIC, deleting \"$_old_murano_static\"..."
rm -rf $_old_murano_static
if [ $? -ne 0 ]; then
log "Can't delete \"$_old_murano_static\, WARNING!!!"
fi
fi
log "Rebuilding STATIC...."
python $horizon_manage collectstatic --noinput
if [ $? -ne 0 ]; then
log "\"$horizon_manage\" collectstatic failed, exiting!!!"
exit 1
fi
log "Creating db for storing sessions..."
python $horizon_manage syncdb --noinput
if [ $? -ne 0 ]; then
log "\"$horizon_manage\" syncdb failed, exiting!!!"
exit 1
fi
}
# postinstall
postinst()
{
rebuildstatic
sleep 2
chown $APACHE_USER:$APACHE_GROUP $LOG_DIR/murano-dashboard.log
chown -R $APACHE_USER:$APACHE_GROUP /var/lib/openstack-dashboard
service httpd restart
}
# install
inst()
{
CLONE_FROM_GIT=$1
# Checking packages
for PKG in $PREREQ_PKGS
do
in_sys_pkg $PKG
done
# Find python pip
find_pip
preinst
# If clone from git set
if [ ! -z $CLONE_FROM_GIT ]; then
# Preparing clone root directory
if [ ! -d $GIT_CLONE_DIR ];then
log "Creating $GIT_CLONE_DIR direcory..."
mkdir -p $GIT_CLONE_DIR
if [ $? -ne 0 ];then
log "Can't create $GIT_CLONE_DIR, exiting!!!"
exit
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
fi
rm -rf $SERVICE_CONTENT_DIRECTORY/dist
cd $SERVICE_CONTENT_DIRECTORY && python $MRN_CND_SPY sdist
if [ $? -ne 0 ];then
log "\"$MRN_CND_SPY\" tarball creation FAILS, exiting!!!"
exit 1
fi
# Running tarball install
TRBL_FILE=$(basename `ls $SERVICE_CONTENT_DIRECTORY/dist/*.tar.gz`)
$PIPCMD install $SERVICE_CONTENT_DIRECTORY/dist/$TRBL_FILE
if [ $? -ne 0 ];then
log "$PIPCMD install \"$TRBL_FILE\" FAILS, exiting!!!"
exit 1
fi
# 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
else
log "$MRN_CND_SPY not found!"
fi
# add apache to autostart
chkconfig --add httpd
chkconfig httpd on
}
# uninstall
uninst()
{
# Uninstall trough pip
find_pip
# looking up for python package installed
PYPKG=`echo $SERVICE_SRV_NAME | tr -d '-'`
_pkg=$($PIPCMD freeze | grep $PYPKG)
if [ $? -eq 0 ]; then
log "Removing package \"$PYPKG\" with pip"
$PIPCMD uninstall $_pkg --yes
else
log "Python package \"$PYPKG\" not found"
fi
}
# Command line args'
COMMAND="$1"
case $COMMAND in
testinstall )
find_horizon_config
postinst
;;
testuninstall )
find_horizon_config remove
postinst
;;
install )
inst
find_horizon_config
postinst
;;
installfromgit )
inst "yes"
find_horizon_config
postinst
;;
uninstall )
log "Uninstalling \"$SERVICE_SRV_NAME\" from system..."
uninst
find_horizon_config remove
postinst
;;
* )
echo -e "Usage: $(basename "$0") command \nCommands:\n\tinstall - Install $SERVICE_SRV_NAME software\n\tuninstall - Uninstall $SERVICE_SRV_NAME software"
exit 1
;;
esac

View File

@ -15,7 +15,7 @@
[metadata]
name = murano-dashboard
version = 0.4
version = 0.4.1
summary = The Murano Dashboard
description-file =
README.rst

590
setup.sh Normal file → Executable file
View File

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (c) 2013 Mirantis, Inc.
#!/bin/bash
# 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
@ -13,87 +13,169 @@
# License for the specific language governing permissions and limitations
# under the License.
#
# Ubuntu script.
LOGLVL=1
SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd`
PREREQ_PKGS="wget make git python-pip python-dev python-mysqldb libxml2-dev libxslt-dev unzip libffi-dev"
SERVICE_SRV_NAME="murano-dashboard"
GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
RUN_DIR=$(cd $(dirname "$0") && pwd)
INC_FILE="$RUN_DIR/common.inc"
if [ -f "$INC_FILE" ]; then
source "$INC_FILE"
else
echo "Can't load \"$INC_FILE\" or file not found, exiting!"
exit 1
fi
#
WEB_SERVICE_SYSNAME=${WEB_SERVICE_SYSNAME:-httpd}
WEB_SERVICE_USER=${WEB_SERVICE_USER:-apache}
WEB_SERVICE_GROUP=${WEB_SERVICE_GROUP:-apache}
APPLICATION_NAME="murano-dashboard"
APPLICATION_LOG_DIR="/var/log/$APPLICATION_NAME"
APPLICATION_CACHE_DIR="/var/cache/$APPLICATION_NAME"
APPLICATION_DB_DIR="/var/lib/openstack-dashboard"
LOGFILE="/tmp/${APPLICATION_NAME}_install.log"
HORIZON_CONFIGS="/opt/stack/horizon/openstack_dashboard/settings.py,/usr/share/openstack-dashboard/openstack_dashboard/settings.py"
APACHE_USER=horizon
APACHE_GROUP=horizon
LOG_DIR="/var/log/murano/"
common_pkgs="wget git make gcc python-pip python-setuptools unzip"
# Distro-specific package namings
debian_pkgs="python-dev python-mysqldb libxml2-dev libxslt1-dev libffi-dev mysql-client memcached apache2 libapache2-mod-wsgi openstack-dashboard"
redhat_pkgs="python-devel MySQL-python libxml2-devel libxslt-devel libffi-devel mysql memcached httpd python-memcached mod_wsgi openstack-dashboard python-netaddr"
#
get_os
eval req_pkgs="\$$(lowercase $DISTRO_BASED_ON)_pkgs"
REQ_PKGS="$common_pkgs $req_pkgs"
# Functions
# Logger function
log()
function install_prerequisites()
{
MSG=$1
if [ $LOGLVL -gt 0 ]; then
echo "LOG:> $MSG"
fi
retval=0
_dist=$(lowercase $DISTRO_BASED_ON)
log "Adding Extra repos, updating..."
case $_dist in
"debian")
find_or_install "python-software-properties"
if [ $? -eq 1 ]; then
retval=1
return $retval
fi
find /var/lib/apt/lists/ -name "*cloud.archive*" | grep -q "havana_main"
if [ $? -ne 0 ]; then
add-apt-repository -y cloud-archive:havana >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
log "... can't enable \"cloud-archive:havana\", exiting !"
retval=1
return $retval
fi
apt-get update -y
apt-get upgrade -y
log "..success"
fi
;;
"redhat")
$(yum repolist | grep -qoE "epel") || rpm -ivh "http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm" >> $LOGFILE 2>&1
$(yum repolist | grep -qoE "openstack-havana") || rpm -ivh "http://rdo.fedorapeople.org/openstack-havana/rdo-release-havana.rpm" >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
log "... can't enable EPEL6 or RDO, exiting!"
retval=1
return $retval
fi
yum --quiet makecache
log "..success"
;;
esac
for pack in $REQ_PKGS
do
find_or_install "$pack"
if [ $? -eq 1 ]; then
retval=1
break
else
retval=0
fi
done
return $retval
}
# Check or install package
in_sys_pkg()
function make_tarball()
{
PKG=$1
dpkg -s $PKG > /dev/null 2>&1
if [ $? -eq 0 ]; then
log "Package \"$PKG\" already installed"
else
log "Installing \"$PKG\"..."
apt-get install $PKG --yes > /dev/null 2>&1
if [ $? -ne 0 ];then
log "installation fails, exiting!!!"
exit
fi
fi
retval=0
log "Preparing tarball package..."
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
log "...\"$setuppy\" egg info creation fails, exiting!!!"
retval=1
exit 1
fi
rm -rf $RUN_DIR/dist/*
log "...\"setup.py sdist\" output will be recorded in \"$LOGFILE\""
cd $RUN_DIR && $setuppy sdist >> $LOGFILE 2>&1
if [ $? -ne 0 ];then
log "...\"$setuppy\" tarball creation fails, exiting!!!"
retval=1
exit 1
fi
#TRBL_FILE=$(basename $(ls $RUN_DIR/dist/*.tar.gz | head -n 1))
TRBL_FILE=$(ls $RUN_DIR/dist/*.tar.gz | head -n 1)
if [ ! -e "$TRBL_FILE" ]; then
log "...tarball not found, exiting!"
retval=1
else
log "...success, tarball created as \"$TRBL_FILE\""
retval=0
fi
else
log "...\"$setuppy\" not found, exiting!"
retval=1
fi
return $retval
}
# git clone
gitclone()
function run_pip_install()
{
FROM=$1
CLONEROOT=$2
log "Cloning from \"$FROM\" repo to \"$CLONEROOT\""
cd $CLONEROOT && git clone $FROM > /dev/null 2>&1
if [ $? -ne 0 ];then
log "cloning from \"$FROM\" fails, exiting!!!"
exit
fi
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
log "...pip install fails, exiting!"
retval=1
exit 1
fi
return $retval
}
# patching horizon configuration
modify_horizon_config() {
REMOVE=$2
if [ -f $1 ]; then
lines=$(sed -ne '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ =' $1)
if [ -n "$lines" ]; then
if [ ! -z $REMOVE ]; then
log "Removing our data from \"$1\"..."
sed -e '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ d' -i $1
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
exit
fi
else
log "\"$1\" already has our data, you can change it manually and restart apache2 service"
fi
else
if [ -z $REMOVE ];then
log "Adding our data into \"$1\"..."
cat >> $1 << EOF
modify_horizon_config()
{
INFILE=$1
REMOVE=$2
PATTERN='from openstack_dashboard import policy'
TMPFILE="./tmpfile"
retval=0
if [ -f $INFILE ]; then
lines=$(sed -ne '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ =' $INFILE)
if [ -n "$lines" ]; then
if [ ! -z $REMOVE ]; then
log "Removing $APPLICATION_NAME data from \"$INFILE\"..."
sed -e '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ d' -i $INFILE
if [ $? -ne 0 ];then
log "...can't modify \"$INFILE\", check permissions or something else, exiting!!!"
retval=1
return $retval
else
log "...success"
fi
else
log "\"$INFILE\" already has $APPLICATION_NAME data, you can change it manually and restart apache2/httpd service"
fi
else
if [ -z "$REMOVE" ]; then
log "Adding $APPLICATION_NAME data to \"$INFILE\"..."
rm -f $TMPFILE
cat >> $TMPFILE << EOF
#START_MURANO_DASHBOARD
#TODO: should remove the next line once https://bugs.launchpad.net/ubuntu/+source/horizon/+bug/1243187 is fixed
LOGOUT_URL = '/horizon/auth/logout/'
import tempfile
METADATA_CACHE_DIR = os.path.join(tempfile.gettempdir(), 'muranodashboard-cache')
METADATA_CACHE_DIR = '$APPLICATION_CACHE_DIR'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(METADATA_CACHE_DIR, 'openstack-dashboard.sqlite')
'NAME': os.path.join('$APPLICATION_DB_DIR', 'openstack-dashboard.sqlite')
}
}
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
@ -103,207 +185,213 @@ MIDDLEWARE_CLASSES += ('muranodashboard.middleware.ExceptionMiddleware',)
verbose_formatter = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
if 'formatters' in LOGGING: LOGGING['formatters'].update(verbose_formatter)
else: LOGGING['formatters'] = verbose_formatter
LOGGING['handlers']['murano-file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '$LOG_DIR/murano-dashboard.log'}
LOGGING['handlers']['murano-file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '$APPLICATION_LOG_DIR/murano-dashboard.log'}
LOGGING['loggers']['muranodashboard'] = {'handlers': ['murano-file'], 'level': 'DEBUG'}
LOGGING['loggers']['muranoclient'] = {'handlers': ['murano-file'], 'level': 'ERROR'}
ADVANCED_NETWORKING_CONFIG = {'max_environments': 100, 'max_hosts': 250, 'env_ip_template': '10.0.0.0'}
NETWORK_TOPOLOGY = 'routed'
#MURANO_API_URL = "http://localhost:8082"
#MURANO_METADATA_URL = "http://localhost:8084/v1"
#if murano-api set up with ssl uncomment next strings
#MURANO_API_INSECURE = True
ADVANCED_NETWORKING_CONFIG = {'max_environments': 100, 'max_hosts': 250, 'env_ip_template': '10.0.0.0'}
NETWORK_TOPOLOGY = 'routed'
#END_MURANO_DASHBOARD
EOF
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
fi
fi
fi
else
echo "File \"$1\" not found, exiting!!!"
exit 1
fi
sed -ne "/$PATTERN/r $TMPFILE" -e 1x -e '2,${x;p}' -e '${x;p}' -i $INFILE
if [ $? -ne 0 ];then
log "Can't modify \"$INFILE\", check permissions or something else, exiting!!!"
else
rm -f $TMPFILE
log "...success"
fi
fi
fi
else
echo "File \"$1\" not found, exiting!!!"
retval=1
fi
return $retval
}
function find_horizon_config()
{
retval=0
for cfg_file in $(echo $HORIZON_CONFIGS | sed 's/,/ /')
do
if [ -e "$cfg_file" ]; then
log "Horizon config found at \"$cfg_file\""
modify_horizon_config $cfg_file $1
retval=0
break
else
retval=1
fi
done
if [ $retval -eq 1 ]; then
log "Horizon config not found or openstack-dashboard does not installed, to override this set proper \"HORIZON_CONFIGS\" variable, exiting!!!"
#exit 1
fi
return $retval
}
# searching horizon configuration
find_horizon_config()
function prepare_db()
{
FOUND=0
for cfg_file in $(echo $HORIZON_CONFIGS | sed 's/,/ /' )
do
if [ -e $cfg_file ];then
log "Horizon config found at \"$cfg_file\""
modify_horizon_config $cfg_file $1
FOUND=1
fi
done
if [ $FOUND -eq 0 ];then
log "Horizon config not found or openstack-dashboard does not installed, to override this set proper \"HORIZON_CONFIGS\" variable, exiting!!!"
exit 1
fi
horizon_manage=$1
retval=0
log "Creating db for storing sessions..."
#python $horizon_manage syncdb --noinput
su -c "python $horizon_manage syncdb --noinput >> $LOGFILE 2>&1" -s /bin/bash $WEB_SERVICE_USER
if [ $? -ne 0 ]; then
log "...\"$horizon_manage\" syncdb failed, exiting!!!"
retval=1
else
log "..success"
fi
return $retval
}
function rebuildstatic()
{
retval=0
_dist=$(lowercase $DISTRO_BASED_ON)
log "Running collectstatic..."
case $_dist in
"debian")
horizon_manage=$(dpkg-query -L openstack-dashboard | grep -E "*manage.py$")
;;
"redhat")
horizon_manage=$(rpm -ql openstack-dashboard | grep -E "*manage.py$")
;;
esac
if [ -z "$horizon_manage" ]; then
log "...openstack-dashboard manage.py not found, exiting!!!"
retval=1
return $retval
fi
_old_murano_static="$(dirname $horizon_manage)/openstack_dashboard/static/muranodashboard"
if [ -d "$_old_murano_static" ];then
log "...$APPLICATION_NAME static for \"muranodashboard\" found under \"HORIZON\" STATIC, deleting \"$_old_murano_static\"..."
rm -rf $_old_murano_static
if [ $? -ne 0 ]; then
log "...can't delete \"$_old_murano_static\, WARNING!!!"
fi
fi
log "Rebuilding STATIC output will be recorded in \"$LOGFILE\""
#python $horizon_manage collectstatic --noinput >> $LOGFILE 2>&1
chmod a+rw $LOGFILE
su -c "python $horizon_manage collectstatic --noinput >> $LOGFILE 2>&1" -s /bin/bash $WEB_SERVICE_USER
if [ $? -ne 0 ]; then
log "...\"$horizon_manage\" collectstatic failed, exiting!!!"
retval=1
else
log "...success"
fi
prepare_db "$horizon_manage" || retval=$?
return $retval
}
function run_pip_uninstall()
{
find_pip
retval=0
pack_to_del=$(is_py_package_installed "$APPLICATION_NAME")
if [ $? -eq 0 ]; then
log "Running \"$PIPCMD uninstall $PIPARGS $APPLICATION_NAME\" output will be recorded in \"$LOGFILE\""
$PIPCMD uninstall $pack_to_del --yes >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
log "...can't uninstall $APPLICATION_NAME with $PIPCMD"
retval=1
else
log "...success"
fi
else
log "Python package for \"$APPLICATION_NAME\" not found"
fi
return $retval
}
function install_application()
{
install_prerequisites || exit 1
make_tarball || exit $?
run_pip_install || exit $?
log "Configuring HORIZON..."
find_horizon_config || exit $?
_dist=$(lowercase $DISTRO_BASED_ON)
log "Configuring system..."
case $_dist in
"debian")
WEB_SERVICE_SYSNAME="apache2"
WEB_SERVICE_USER="horizon"
WEB_SERVICE_GROUP="horizon"
dpkg --purge openstack-dashboard-ubuntu-theme
;;
"redhat")
WEB_SERVICE_SYSNAME="httpd"
WEB_SERVICE_USER="apache"
WEB_SERVICE_GROUP="apache"
log "Disabling firewall and selinux..."
service iptables stop
chkconfig iptables off
setenforce 0
iniset '' 'SELINUX' 'permissive' '/etc/selinux/config'
chkconfig $WEB_SERVICE_SYSNAME on
;;
esac
log "Creating required directories..."
mk_dir "$APPLICATION_LOG_DIR" "$WEB_SERVICE_USER" "$WEB_SERVICE_GROUP" || exit $?
mk_dir "$APPLICATION_CACHE_DIR" "$WEB_SERVICE_USER" "$WEB_SERVICE_GROUP" || exit $?
horizon_etc_cfg=$(find /etc/openstack-dashboard -name "local_setting*" | head -n 1)
if [ $? -ne 0 ]; then
log "Can't find horizon config under \"/etc/openstack-dashboard...\""
retval=1
else
iniset '' 'ALLOWED_HOSTS' "'*'" $horizon_etc_cfg
iniset '' 'DEBUG' 'True' $horizon_etc_cfg
fi
return $retval
}
function uninstall_application()
{
run_pip_uninstall || exit $?
find_horizon_config remove || exit $?
}
# install
inst()
function postinst()
{
CLONE_FROM_GIT=$1
# Checking packages
for PKG in $PREREQ_PKGS
do
in_sys_pkg $PKG
done
# If clone from git set
if [ ! -z $CLONE_FROM_GIT ]; then
# Preparing clone root directory
if [ ! -d $GIT_CLONE_DIR ];then
log "Creating $GIT_CLONE_DIR direcory..."
mkdir -p $GIT_CLONE_DIR
if [ $? -ne 0 ];then
log "Can't create $GIT_CLONE_DIR, exiting!!!"
exit
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
# Installing...
log "Running setup.py"
#MRN_CND_SPY=$GIT_CLONE_DIR/$SERVICE_SRV_NAME/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
fi
rm -rf $SERVICE_CONTENT_DIRECTORY/dist
cd $SERVICE_CONTENT_DIRECTORY && python $MRN_CND_SPY sdist
if [ $? -ne 0 ];then
log "\"$MRN_CND_SPY\" tarball creation FAILS, exiting!!!"
exit 1
fi
# Running tarball install
TRBL_FILE=$(basename `ls $SERVICE_CONTENT_DIRECTORY/dist/*.tar.gz`)
pip install $SERVICE_CONTENT_DIRECTORY/dist/$TRBL_FILE
if [ $? -ne 0 ];then
log "pip install \"$TRBL_FILE\" FAILS, exiting!!!"
exit 1
fi
# 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
else
log "$MRN_CND_SPY not found!"
fi
rebuildstatic || exit $?
sleep 2
chown -R $WEB_SERVICE_USER:$WEB_SERVICE_GROUP /var/lib/openstack-dashboard
service $WEB_SERVICE_SYSNAME restart
}
# uninstall
uninst()
function postuninst()
{
# Uninstall trough pip
# looking up for python package installed
PYPKG=`echo $SERVICE_SRV_NAME | tr -d '-'`
pip freeze | grep $PYPKG
if [ $? -eq 0 ]; then
log "Removing package \"$PYPKG\" with pip"
pip uninstall $PYPKG --yes
else
log "Python package \"$PYPKG\" not found"
fi
}
# preinstall
preinst()
{
# check openstack-dashboard installed from system packages
_PKG=openstack-dashboard
dpkg -s $_PKG > /dev/null 2>&1
if [ $? -ne 0 ]; then
log "Package \"$_PKG\" is not installed."
fi
}
# rebuild static
rebuildstatic()
{
horizon_manage=$(dpkg-query -L openstack-dashboard | grep -E "*manage.py$")
if [ $? -ne 0 ]; then
log "openstack-dashboard manage.py not found, exiting!!!"
exit 1
fi
_old_murano_static="$(dirname $horizon_manage)/openstack_dashboard/static/muranodashboard"
if [ -d "$_old_murano_static" ];then
log "Our static for \"muranodashboard\" found under \"HORIZON\" STATIC, deleting \"$_old_murano_static\"..."
rm -rf $_old_murano_static
if [ $? -ne 0 ]; then
log "Can't delete \"$_old_murano_static\, WARNING!!!"
fi
fi
log "Rebuilding STATIC...."
python $horizon_manage collectstatic --noinput
if [ $? -ne 0 ]; then
log "\"$horizon_manage\" collectstatic failed, exiting!!!"
exit 1
fi
log "Creating db for storing sessions..."
python $horizon_manage syncdb --noinput
if [ $? -ne 0 ]; then
log "\"$horizon_manage\" syncdb failed, exiting!!!"
exit 1
fi
}
# postinstall
postinst()
{
rebuildstatic
sleep 2
chown $APACHE_USER:$APACHE_GROUP $LOG_DIR/murano-dashboard.log
chown -R $APACHE_USER:$APACHE_GROUP /var/lib/openstack-dashboard
service apache2 restart
_dist=$(lowercase $DISTRO_BASED_ON)
case $_dist in
"debian")
WEB_SERVICE_SYSNAME="apache2"
;;
"redhat")
WEB_SERVICE_SYSNAME="httpd"
;;
esac
service $WEB_SERVICE_SYSNAME restart
}
# Command line args'
COMMAND="$1"
case $COMMAND in
install )
preinst
inst
find_horizon_config
postinst
;;
install)
rm -rf $LOGFILE
log "Installing \"$APPLICATION_NAME\" to system..."
install_application || exit $?
postinst || exit $?
log "...success"
;;
installfromgit )
preinst
inst "yes"
find_horizon_config
postinst
;;
uninstall )
log "Uninstalling \"$SERVICE_SRV_NAME\" from system..."
uninst
find_horizon_config remove
service apache2 restart
;;
* )
echo "Usage: $(basename "$0") command \nCommands:\n\tinstall - Install $SERVICE_SRV_NAME software\n\tuninstall - Uninstall $SERVICE_SRV_NAME software"
exit 1
;;
esac
uninstall )
log "Uninstalling \"$APPLICATION_NAME\" from system..."
uninstall_application || exit $?
postuninst
log "Software uninstalled, application logs located at \"$APPLICATION_LOG_DIR\", cache files - at \"$APPLICATION_CACHE_DIR'\" ."
;;
* )
echo -e "Usage: $(basename "$0") [command] \nCommands:\n\tinstall - Install \"$APPLICATION_NAME\" software\n\tuninstall - Uninstall \"$APPLICATION_NAME\" software"
exit 1
;;
esac