Cherry-pick all changes from release-0.1 branch

Change-Id: I6063182a406903a2ee8c76e79ad2fa4d267b68ee
This commit is contained in:
Stan Lagun 2013-05-30 17:04:05 +04:00 committed by Serg Melikyan
parent 1036bf72db
commit 0b77a7501e
20 changed files with 292 additions and 185 deletions

1
MANIFEST.in Normal file
View File

@ -0,0 +1 @@
include tools/pip-requires

View File

@ -15,16 +15,18 @@
# limitations under the License.
import sys
import os
from conductor import config
from conductor.openstack.common import log
from conductor.openstack.common import service
from conductor.app import ConductorWorkflowService
if __name__ == '__main__':
try:
config.parse_args()
os.chdir(config.CONF.data_dir)
log.setup('conductor')
launcher = service.ServiceLauncher()
launcher.launch_service(ConductorWorkflowService())

View File

@ -27,7 +27,7 @@ def update_cf_stack(engine, context, body, template, result=None, **kwargs):
def callback(result_value):
if result is not None:
context[result] = result_value['Result']
context[result] = result_value
success_handler = body.find('success')
if success_handler is not None:
engine.evaluate_content(success_handler, context)

View File

@ -171,28 +171,39 @@ class HeatExecutor(CommandBase):
return {}, {}
def _wait_state(self, state):
if isinstance(state, types.ListType):
states = state
else:
states = [state]
tries = 4
delay = 1
while tries > 0:
if isinstance(state, types.ListType):
states = state
else:
states = [state]
while True:
try:
stack_info = self._heat_client.stacks.get(
stack_id=self._stack)
status = stack_info.stack_status
except heatclient.exc.HTTPNotFound:
stack_info = None
status = ''
while True:
try:
stack_info = self._heat_client.stacks.get(
stack_id=self._stack)
status = stack_info.stack_status
tries = 4
delay = 1
except heatclient.exc.HTTPNotFound:
stack_info = None
status = ''
except Exception:
tries -= 1
delay *= 2
eventlet.sleep(delay)
break
if 'IN_PROGRESS' in status:
eventlet.sleep(1)
continue
if status not in states:
raise EnvironmentError()
if 'IN_PROGRESS' in status:
eventlet.sleep(1)
continue
if status not in states:
raise EnvironmentError()
try:
return dict([(t['output_key'], t['output_value'])
for t in stack_info.outputs])
except Exception:
return {}
try:
return dict([(t['output_key'], t['output_value'])
for t in stack_info.outputs])
except Exception:
return {}
return {}

View File

@ -51,6 +51,8 @@ CONF.register_opts(paste_deploy_opts, group='paste_deploy')
CONF.register_opts(rabbit_opts, group='rabbitmq')
CONF.register_opts(heat_opts, group='heat')
CONF.register_opt(cfg.StrOpt('file_server'))
CONF.register_cli_opt(cfg.StrOpt('data-dir', dest='data_dir', default='./'))
CONF.import_opt('verbose', 'conductor.openstack.common.log')
CONF.import_opt('debug', 'conductor.openstack.common.log')

View File

@ -26,7 +26,7 @@ Usual usage in an openstack.common module:
import gettext
t = gettext.translation('conductor', 'locale', fallback=True)
t = gettext.translation('openstack-common', 'locale', fallback=True)
def _(msg):

View File

@ -29,7 +29,6 @@ It also allows setting of formatting information through conf.
"""
import ConfigParser
import cStringIO
import inspect
import itertools
@ -88,11 +87,11 @@ logging_cli_opts = [
metavar='PATH',
deprecated_name='logfile',
help='(Optional) Name of log file to output to. '
'If no default is set, logging will go to stdout.'),
'If not set, logging will go to stdout.'),
cfg.StrOpt('log-dir',
deprecated_name='logdir',
help='(Optional) The base directory used for relative '
'--log-file paths'),
help='(Optional) The directory to keep log files in '
'(will be prepended to --log-file)'),
cfg.BoolOpt('use-syslog',
default=False,
help='Use syslog for logging.'),
@ -324,30 +323,10 @@ def _create_logging_excepthook(product_name):
return logging_excepthook
class LogConfigError(Exception):
message = _('Error loading logging config %(log_config)s: %(err_msg)s')
def __init__(self, log_config, err_msg):
self.log_config = log_config
self.err_msg = err_msg
def __str__(self):
return self.message % dict(log_config=self.log_config,
err_msg=self.err_msg)
def _load_log_config(log_config):
try:
logging.config.fileConfig(log_config)
except ConfigParser.Error, exc:
raise LogConfigError(log_config, str(exc))
def setup(product_name):
"""Setup logging."""
if CONF.log_config:
_load_log_config(CONF.log_config)
logging.config.fileConfig(CONF.log_config)
else:
_setup_logging_from_conf()
sys.excepthook = _create_logging_excepthook(product_name)

View File

@ -30,6 +30,7 @@ LOG = logging.getLogger(__name__)
notifier_opts = [
cfg.MultiStrOpt('notification_driver',
default=[],
deprecated_name='list_notifier_drivers',
help='Driver or drivers to handle sending notifications'),
cfg.StrOpt('default_notification_level',
default='INFO',

View File

@ -59,10 +59,10 @@ CONF.register_opts(socket_opts)
LOG = logging.getLogger(__name__)
def run_server(application, port, **kwargs):
def run_server(application, port):
"""Run a WSGI server with the given application."""
sock = eventlet.listen(('0.0.0.0', port))
eventlet.wsgi.server(sock, application, **kwargs)
eventlet.wsgi.server(sock, application)
class Service(service.Service):

View File

@ -19,7 +19,7 @@ from openstack.common import log as logging
log = logging.getLogger(__name__)
def send_command(engine, context, body, template, service, host, mappings=None,
def send_command(engine, context, body, template, service, unit, mappings=None,
result=None, **kwargs):
if not mappings:
mappings = {}
@ -28,7 +28,7 @@ def send_command(engine, context, body, template, service, host, mappings=None,
def callback(result_value):
log.info(
'Received result from {2} for {0}: {1}'.format(
template, result_value, host))
template, result_value, unit))
if result is not None:
context[result] = result_value['Result']
@ -38,7 +38,7 @@ def send_command(engine, context, body, template, service, host, mappings=None,
command_dispatcher.execute(
name='agent', template=template, mappings=mappings,
host=host, service=service, callback=callback)
unit=unit, service=service, callback=callback)
xml_code_engine.XmlCodeEngine.register_function(send_command, "send-command")

File diff suppressed because one or more lines are too long

View File

@ -1,26 +1,26 @@
{
"Scripts": [
{
"Scripts": [
"ZnVuY3Rpb24gQ29weS1QcmVyZXF1aXNpdGVzIHsNCglwYXJhbSAoDQoJCVtTdHJpbmddICRQYXRoID0gJycsDQoJCVtTdHJpbmddICREZXN0aW5hdGlvbiA9ICcnDQoJKQ0KDQoJV3JpdGUtTG9nICItLT4gQ29weS1QcmVyZXF1aXNpdGVzIg0KDQogICAgaWYgKCREZXN0aW5hdGlvbiAtZXEgJycpIHsNCiAgICAgICAgdGhyb3coIkNvcHktUHJlcmVxdWlzaXRlczogRGVzdGluYXRpb24gcGF0aCBub3Qgc3BlY2lmaWVkISIpDQogICAgfQ0KDQogICAgaWYgKCRQYXRoIC1lcSAnJykgew0KICAgICAgICAkUGF0aCA9IFtFbnZpcm9ubWVudF06OkdldEVudmlyb25tZW50VmFyaWF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CXRocm93KCJJbnN0YWxsYXRpb24gb2YgJ1dlYkFwcGxpY2F0aW9ucy5leGUnIGZhaWxlZC4gUHJvY2VzcyBleGl0IGNvZGUgJyQoJEV4ZWMuRXhpdENvZGUpJyIpDQoJfQ0KDQoJV3JpdGUtTG9nICI8LS0gSW5zdGFsbC1XZWJTZXJ2ZXJDb21wb25lbnRzIg0KfQ0KDQo="
],
"Commands": [
{
"Name": "Import-Module",
"Arguments": {
"Name": "CoreFunctions"
}
},
{
"Name": "Copy-Prerequisites",
"Arguments": {
"Destination": "C:\\Prerequisites"
}
},
{
"Name": "Install-WebServer",
"Arguments": {
"PrerequisitesPath": "C:\\Prerequisites"
}
}
],
"RebootOnCompletion": 0
}
],
"Commands": [
{
"Name": "Import-Module",
"Arguments": {
"Name": "CoreFunctions"
}
},
{
"Name": "Copy-Prerequisites",
"Arguments": {
"Destination": "C:\\Prerequisites"
}
},
{
"Name": "Install-WebServerComponents",
"Arguments": {
"PrerequisitesPath": "C:\\Prerequisites"
}
}
],
"RebootOnCompletion": 0
}

View File

@ -3,6 +3,7 @@
"$lbName" : {
"Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties" : {
"AvailabilityZones" : { "Fn::GetAZs" : "" },
"Instances" : [{"Ref": "$instanceName"}],
"Listeners" : [ {
"LoadBalancerPort" : "$lbPort",

View File

@ -1,57 +1,29 @@
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing Amazon EC2 key pair for RDP access",
"Description" : "Key Pair name for Load Balancer",
"Type" : "String",
"Default" : "murano-keys"
"Default" : "murano-lb-key"
},
"InstanceType" : {
"Description" : "Amazon EC2 instance type",
"Type" : "String",
"Default" : "m1.medium",
"AllowedValues" : [ "m1.small", "m1.medium", "m1.large" ]
"Default" : "m1.medium"
},
"ImageName" : {
"Description" : "Image name",
"Type" : "String",
"Default" : "ws-2012-full-agent",
"AllowedValues" : [ "ws-2012-full", "ws-2012-core", "ws-2012-full-agent" ]
"Type" : "String"
}
},
"Resources" : {
"IAMUser" : {
"Type" : "AWS::IAM::User",
"Properties" : {
"Path": "/",
"Policies": [{
"PolicyName": "root",
"PolicyDocument": { "Statement":[{
"Effect": "Allow",
"Action": "CloudFormation:DescribeStackResource",
"Resource": "*"
}]}
}]
}
},
"IAMUserAccessKey" : {
"Type" : "AWS::IAM::AccessKey",
"Properties" : {
"UserName" : {"Ref": "IAMUser"}
}
},
"$instanceName": {
"Type" : "AWS::EC2::Instance",
"Properties": {
"InstanceType" : { "Ref" : "InstanceType" },
"ImageId" : { "Ref" : "ImageName" },
"KeyName" : { "Ref" : "KeyName" },
"UserData": "$userData"
}
}
@ -59,4 +31,4 @@
"Outputs" : {
}
}
}

View File

@ -8,7 +8,7 @@
<rule match="$.services.activeDirectories[*].units[?(@.state.hostname and not @.state.instanceName)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="name"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<update-cf-stack template="Windows">
<parameter name="mappings">
@ -25,7 +25,6 @@
</parameter>
<parameter name="arguments">
<map>
<argument name="KeyName">murano-keys</argument>
<argument name="InstanceType">m1.medium</argument>
<argument name="ImageName">ws-2012-full</argument>
</map>
@ -35,7 +34,7 @@
<set path="state.instanceName"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Instance <select path="name"/> created</parameter>
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created</parameter>
</report>
</success>
</update-cf-stack>
@ -90,7 +89,7 @@
<rule match="$.services.activeDirectories[?(@.state.primaryDc is None)].units[?(@.state.instanceName and @.isMaster)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating Primary Domain Controller on unit <select path="name"/></parameter>
<parameter name="text">Creating Primary Domain Controller on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="CreatePrimaryDC">
<parameter name="unit">
@ -172,7 +171,7 @@
</set>
<report entity="unit">
<parameter name="id"><select path="id" source="unit"/></parameter>
<parameter name="text">Unit <select path="name" source="unit"/> has joined domain <select path="domain"/></parameter>
<parameter name="text">Unit <select path="state.hostname" source="unit"/> <select path="name" source="unit"/> has joined domain <select path="domain"/></parameter>
</report>
</success>
</send-command>
@ -183,7 +182,7 @@
<rule match="$.services.activeDirectories[*].units[?(@.state.domain and not @.isMaster and not @.state.installed)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating Secondary Domain Controller on unit <select path="name"/></parameter>
<parameter name="text">Creating Secondary Domain Controller on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="CreateSecondaryDC">
<parameter name="unit">

View File

@ -8,7 +8,7 @@
<rule match="$.services.webServers,aspNetApps,webServerFarms,aspNetAppFarms[*].units[?(@.state.hostname and not @.state.instanceName)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="name"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<update-cf-stack template="Windows">
<parameter name="mappings">
@ -25,7 +25,6 @@
</parameter>
<parameter name="arguments">
<map>
<argument name="KeyName">murano-keys</argument>
<argument name="InstanceType">m1.medium</argument>
<argument name="ImageName">ws-2012-full</argument>
</map>
@ -35,7 +34,7 @@
<set path="state.instanceName"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Instance <select path="name"/> created</parameter>
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created</parameter>
</report>
</success>
</update-cf-stack>
@ -52,9 +51,7 @@
</parameter>
<success>
<set path="state.registeredWithLB"><true/></set>
<set path="::LoadBalancerIP">
<select source="outputs" path="LoadBalancerIP"/>
</set>
<set path="::uri">http://<select source="outputs" path="LoadBalancerIP"/>:<select path="::loadBalancerPort"/></set>
</success>
</update-cf-stack>
</rule>
@ -86,7 +83,7 @@
<rule match="$.services.webServers,aspNetApps,webServerFarms,aspNetAppFarms[*].units[?(@.state.instanceName and not @.state.iisInstalled)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating IIS Web Server on unit <select path="name"/></parameter>
<parameter name="text">Creating IIS Web Server on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="InstallIIS">
<parameter name="unit">
@ -99,7 +96,7 @@
<set path="state.iisInstalled"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">IIS <select path="name"/> has started</parameter>
<parameter name="text">IIS <select path="state.hostname"/> (<select path="name"/>) has started</parameter>
</report>
</success>
</send-command>
@ -108,7 +105,7 @@
<rule match="$.services.aspNetApps,aspNetAppFarms[*].units[?(@.state.iisInstalled and not @.state.webAppDeployed)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Deploying Web App on unit <select path="name"/></parameter>
<parameter name="text">Deploying WebApp <select path="::name"/> on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="DeployWebApp">
<parameter name="unit">
@ -128,7 +125,7 @@
<set path="state.webAppDeployed"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">WebApp <select path="name"/> has been deployed.</parameter>
<parameter name="text">WebApp <select path="::name"/> has been deployed on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
</success>
</send-command>

View File

@ -49,20 +49,48 @@ Configure
2. Configure according to you environment::
[DEFAULT]
log_file = logs/conductor.log
# Path where log will be written
log_file = /tmp/conductor.log
# Log verbosity
debug=True
verbose=True
# Directory where conductor's data directory located.
# "data" must be subdirectory to this.
data_dir = /etc/murano-conductor
[heat]
# URL of OpenStack KeyStone service REST API.
# Typically only hostname (or IP) needs to be changed
auth_url = http://localhost:5000/v2.0
[rabbitmq]
# this must be IP or hostname accessible from instances (VMs)
host = YOUR.REAL.IP.HERE
# Connection parameters to RabbitMQ service
# Hostname or IP address where RabbitMQ is located.
# !!! Change localhost to your real IP or hostname as this
# address must be reachable from VMs !!!
host = localhost
# RabbitMQ port (5672 is a default)
port = 5672
virtual_host = murano
login = murano
password = murano
# RabbitMQ credentials. Fresh RabbitMQ installation has "guest"
# account with "guest" password.
# It is recommended to create dedicated user account for Murano using
# RabbitMQ web console or command line utility
login = guest
password = guest
# RabbitMQ virtual host (vhost). Fresh RabbitMQ installation
# has "/" vhost preconfigured.
# It is recommended to create dedicated vhost for Murano using
# RabbitMQ web console or command line utility
virtual_host = /
Run
----

View File

@ -1,14 +1,38 @@
[DEFAULT]
log_file = logs/conductor.log
# Path where log will be written
log_file = /tmp/conductor.log
# Log verbosity
debug=True
verbose=True
# Directory where conductor's data directory located.
# "data" must be subdirectory to this.
data_dir = /etc/murano-conductor
[heat]
auth_url = http://172.18.79.71:5000/v2.0
# URL of OpenStack KeyStone service REST API.
# Typically only hostname (or IP) needs to be changed
auth_url = http://localhost:5000/v2.0
[rabbitmq]
# Connection parameters to RabbitMQ service
# Hostname or IP address where RabbitMQ is located.
# !!! Change localhost to your real IP or hostname as this address must be reachable from VMs !!!
host = localhost
# RabbitMQ port (5672 is a default)
port = 5672
virtual_host = murano
login = murano
password = murano
# RabbitMQ credentials. Fresh RabbitMQ installation has "guest" account with "guest" password.
# It is recommended to create dedicated user account for Murano using RabbitMQ web console or command line utility
login = guest
password = guest
# RabbitMQ virtual host (vhost). Fresh RabbitMQ installation has "/" vhost preconfigured.
# It is recommended to create dedicated vhost for Murano using RabbitMQ web console or command line utility
virtual_host = /

View File

@ -14,6 +14,7 @@
# under the License.
#
# CentOS script
LOGLVL=1
SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd`
PREREQ_PKGS="upstart wget git make python-pip python-devel mysql-connector-python"
@ -22,9 +23,6 @@ GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME"
SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/conductor.conf"
if [ -z "$SERVICE_EXEC_PATH" ];then
SERVICE_EXEC_PATH="/usr/bin/conductor"
fi
# Functions
# Loger function
log()
@ -95,14 +93,30 @@ CLONE_FROM_GIT=$1
# Setupping...
log "Running setup.py"
MRN_CND_SPY=$GIT_CLONE_DIR/$SERVICE_SRV_NAME/setup.py
log $MRN_CND_SPY
if [ -e $MRN_CND_SPY ];then
chmod +x $MRN_CND_SPY
log "$MRN_CND_SPY output:_____________________________________________________________"
cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY install
#cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY install
#if [ $? -ne 0 ]; then
# log "\"$MRN_CND_SPY\" python setup FAILS, exiting!"
# exit 1
#fi
## Setup through pip
# Creating tarball
#cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY sdist
cd $SERVICE_CONTENT_DIRECTORY && $MRN_CND_SPY sdist
if [ $? -ne 0 ];then
log "Install of \"$MRN_CND_SPY\" FAILS, exiting!!!"
exit
log "\"$MRN_CND_SPY\" tarball creation FAILS, exiting!!!"
exit 1
fi
# Running tarball install
#TRBL_FILE=$(basename `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/dist/*.tar.gz`)
#pip install $GIT_CLONE_DIR/$SERVICE_SRV_NAME/dist/$TRBL_FILE
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
else
log "$MRN_CND_SPY not found!"
@ -118,16 +132,39 @@ CLONE_FROM_GIT=$1
fi
# making sample configs
log "Making sample configuration files at \"$ETC_CFG_DIR\""
for file in `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc`
#for file in `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc`
for file in `ls $SERVICE_CONTENT_DIRECTORY/etc`
do
cp -f "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc/$file" "$ETC_CFG_DIR/$file.sample"
#cp -f "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc/$file" "$ETC_CFG_DIR/$file.sample"
cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file.sample"
done
# making templates data
log "Making templates directory"
#cp -f -R "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/data" "$ETC_CFG_DIR/"
cp -f -R "$SERVICE_CONTENT_DIRECTORY/data" "$ETC_CFG_DIR/"
}
# searching for service executable in path
get_service_exec_path()
{
if [ -z "$SERVICE_EXEC_PATH" ]; then
SERVICE_EXEC_PATH=`which conductor`
if [ $? -ne 0 ]; then
log "Can't find \"conductor ($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!"
exit 1
fi
else
if [ ! -x "$SERVICE_EXEC_PATH" ]; then
log "\"$SERVICE_EXEC_PATH\" in not executable, please install the \"conductor ($SERVICE_SRV_NAME)\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!"
exit 1
fi
fi
}
# inject init
injectinit()
{
echo "description \"Murano Conductor service\"
echo "description \"$SERVICE_SRV_NAME service\"
author \"Igor Yozhikov <iyozhikov@mirantis.com>\"
start on runlevel [2345]
stop on runlevel [!2345]
@ -148,8 +185,18 @@ purgeinit()
# uninstall
uninst()
{
rm -f $SERVICE_EXEC_PATH
rm -rf $SERVICE_CONTENT_DIRECTORY
#rm -f $SERVICE_EXEC_PATH
#rm -rf $SERVICE_CONTENT_DIRECTORY
# Uninstall trough pip
# looking up for python package installed
PYPKG=`echo $SERVICE_SRV_NAME | sed -e 's/murano-//'`
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
}
# postinstall
@ -161,11 +208,7 @@ postinst()
COMMAND="$1"
case $COMMAND in
inject-init )
# searching for daemon PATH
if [ ! -x $SERVICE_EXEC_PATH ]; then
log "Can't find \"conductor\" in at \"$SERVICE_EXEC_PATH\", please install the \"$SERVICE_SRV_NAME\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!!!"
exit
fi
get_service_exec_path
log "Injecting \"$SERVICE_SRV_NAME\" to init..."
injectinit
postinst
@ -173,12 +216,14 @@ case $COMMAND in
install )
inst
get_service_exec_path
injectinit
postinst
;;
installfromgit )
inst "yes"
get_service_exec_path
injectinit
postinst
;;
@ -197,7 +242,7 @@ case $COMMAND in
;;
* )
echo "Usage: $(basename "$0") install | installfromgit | uninstall | inject-init | purge-init"
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"
exit 1
;;
esac

View File

@ -14,17 +14,15 @@
# under the License.
#
# Ubuntu script.
LOGLVL=1
SERVICE_CONTENT_DIRECTORY=`cd $(dirname "$0") && pwd`
PREREQ_PKGS="wget git python-pip python-dev python-mysqldb"
PREREQ_PKGS="upstart wget git make python-pip python-dev python-mysqldb libxml2-dev libxslt-dev"
SERVICE_SRV_NAME="murano-conductor"
GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME"
SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/conductor.conf"
if [ -z "$SERVICE_EXEC_PATH" ];then
SERVICE_EXEC_PATH="/usr/local/bin/conductor"
fi
# Functions
# Loger function
log()
@ -65,7 +63,6 @@ gitclone()
fi
}
# install
inst()
{
@ -95,15 +92,32 @@ CLONE_FROM_GIT=$1
# Setupping...
log "Running setup.py"
MRN_CND_SPY=$GIT_CLONE_DIR/$SERVICE_SRV_NAME/setup.py
log $MRN_CND_SPY
#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:_____________________________________________________________"
cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY install
#cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY install
#if [ $? -ne 0 ]; then
# log "\"$MRN_CND_SPY\" python setup FAILS, exiting!"
# exit 1
#fi
## Setup through pip
# Creating tarball
#cd $GIT_CLONE_DIR/$SERVICE_SRV_NAME && $MRN_CND_SPY sdist
cd $SERVICE_CONTENT_DIRECTORY && $MRN_CND_SPY sdist
if [ $? -ne 0 ];then
log "Install of \"$MRN_CND_SPY\" FAILS, exiting!!!"
exit
log "\"$MRN_CND_SPY\" tarball creation FAILS, exiting!!!"
exit 1
fi
# Running tarball install
#TRBL_FILE=$(basename `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/dist/*.tar.gz`)
#pip install $GIT_CLONE_DIR/$SERVICE_SRV_NAME/dist/$TRBL_FILE
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
else
log "$MRN_CND_SPY not found!"
@ -114,22 +128,49 @@ CLONE_FROM_GIT=$1
mkdir -p $ETC_CFG_DIR
if [ $? -ne 0 ];then
log "Can't create $ETC_CFG_DIR, exiting!!!"
exit
exit 1
fi
fi
# making sample configs
log "Making sample configuration files at \"$ETC_CFG_DIR\""
for file in `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc`
#for file in `ls $GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc`
for file in `ls $SERVICE_CONTENT_DIRECTORY/etc`
do
cp -f "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc/$file" "$ETC_CFG_DIR/$file.sample"
#cp -f "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/etc/$file" "$ETC_CFG_DIR/$file.sample"
cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file.sample"
done
# making templates data
log "Making templates directory"
#cp -f -R "$GIT_CLONE_DIR/$SERVICE_SRV_NAME/data" "$ETC_CFG_DIR/"
cp -f -R "$SERVICE_CONTENT_DIRECTORY/data" "$ETC_CFG_DIR/"
}
# searching for service executable in path
get_service_exec_path()
{
if [ -z "$SERVICE_EXEC_PATH" ]; then
SERVICE_EXEC_PATH=`which conductor`
if [ $? -ne 0 ]; then
log "Can't find \"conductor ($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!"
exit 1
fi
else
if [ ! -x "$SERVICE_EXEC_PATH" ]; then
log "\"$SERVICE_EXEC_PATH\" in not executable, please install the \"conductor ($SERVICE_SRV_NAME)\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!"
exit 1
fi
fi
}
# inject init
injectinit()
{
ln -s /lib/init/upstart-job /etc/init.d/$SERVICE_SRV_NAME
echo "description \"Murano Conductor service\"
if [ $? -ne 0 ]; then
log "Can't create symlink, please run \"$(basename "$0") purge-init\" before \"$(basename "$0") inject-init\", exiting"
exit 1
fi
echo "description \"$SERVICE_SRV_NAME service\"
author \"Igor Yozhikov <iyozhikov@mirantis.com>\"
start on runlevel [2345]
stop on runlevel [!2345]
@ -137,14 +178,11 @@ 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
update-rc.d $SERVICE_SRV_NAME defaults
}
# purge init
purgeinit()
{
update-rc.d -f $SERVICE_SRV_NAME remove
rm -f /etc/init.d/$SERVICE_SRV_NAME
rm -f /etc/init/$SERVICE_SRV_NAME.conf
log "Reloading initctl"
@ -154,8 +192,18 @@ purgeinit()
# uninstall
uninst()
{
rm -f $SERVICE_EXEC_PATH
rm -rf $SERVICE_CONTENT_DIRECTORY
#rm -f $SERVICE_EXEC_PATH
#rm -rf $SERVICE_CONTENT_DIRECTORY
# Uninstall trough pip
# looking up for python package installed
PYPKG=`echo $SERVICE_SRV_NAME | sed -e 's/murano-//'`
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
}
# postinstall
@ -167,12 +215,7 @@ postinst()
COMMAND="$1"
case $COMMAND in
inject-init )
# searching for daemon PATH
if [ ! -x $SERVICE_EXEC_PATH ]; then
log "Can't find \"conductor\" in at \"$SERVICE_EXEC_PATH\", please install the \"$SERVICE_SRV_NAME\" or set variable SERVICE_EXEC_PATH=/path/to/daemon before running setup script, exiting!!!"
exit
fi
ln -s /lib/init/upstart-job /etc/init.d/$SERVICE_SRV_NAME
get_service_exec_path
log "Injecting \"$SERVICE_SRV_NAME\" to init..."
injectinit
postinst
@ -180,12 +223,14 @@ case $COMMAND in
install )
inst
get_service_exec_path
injectinit
postinst
;;
installfromgit )
inst "yes"
get_service_exec_path
injectinit
postinst
;;
@ -204,7 +249,7 @@ case $COMMAND in
;;
* )
echo "Usage: $(basename "$0") install | installfromgit | uninstall | inject-init | purge-init"
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"
exit 1
;;
esac