Ekaterina Fedorova b472670019 Cherry-pick the following commits from release-0.4
* Fix errors in infrastructure
	blueprint one-style-config
	1) Update sample config - remove non-existing directory
	2) Add 0.4.1 version
	3) Rename config file to sample
	Fixes-Bug: 1270734

* Fixed issue with copy configuration files.
	Closes-Bug: #1271079

* Removed SysV EL6 standalone file, removed old setup scripts

* Fixed typo in daemon executable name

* Delete init scripts and agent config dirs
	so we will update then and not delete cache if murano-repository is unavaliable
	Closes-bug: 1274470

* Fix accessing nested-dir scripts from nested-dir agent templates.
	This works the following way: if path to agent template is,
	.g. <someHash>/template/agent/SqlServerCluster/FailoverCluster.template,
	nd it references script file '/ImportCoreFunctions.ps1', then it will
	e searched in '<someHash>/template/agent/scripts/' dir, but if it
	eferences 'Failover-Cluster.ps1', it will be searched in
	<someHash>/template/agent/scripts/SqlServerCluster/' dir.

	o the root-like agent dir '<someHash>/template/agent' corresponds to
	oot-like scripts dir '<someHash>/template/agent/scripts', and the
	ctual script file will be searched immediately in root-like scripts
	dir if it starts with '/' (absolute name), or there will be
	'rest-dirs' between root-like scripts dir and the script filename if
	the script filename is a relative one. 'rest-dirs' is the difference
	between root-like agent dir and the actual parent dir of the agent
	template which references the script dir. As you see, the
	abovementioned example is much clearer than the explanation.
	Closes-bug: #1271578

* Add forgotten deletion in metadata folder setup

* Undo init file parameter remane

* Return external network id together with routerId
	blueprint auto-assign-floating-ip

* Fix name for syslog_log_facility param

* Update reqirements for a release-0.4.1

Change-Id: I2744eaeef369220c5a8dabb027ba40622be9d242
2014-02-11 12:11:09 +04:00

101 lines
3.0 KiB
Python

# 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.
from muranoconductor import xml_code_engine
import muranoconductor.config
from openstack.common import log as logging
log = logging.getLogger(__name__)
def get_subnet(engine, context, body, routerId=None, existingNetwork=None,
result=None):
command_dispatcher = context['/commandDispatcher']
def callback(result_value):
if result is not None:
context[result] = {"cidr": result_value}
success_handler = body.find('success')
if success_handler is not None:
engine.evaluate_content(success_handler, context)
if existingNetwork:
command = "get_existing_subnet"
else:
command = "get_new_subnet"
command_dispatcher.execute(
name="net",
command=command,
existingNetwork=existingNetwork,
routerId=routerId,
callback=callback)
def get_default_router(engine, context, body, result=None):
command_dispatcher = context['/commandDispatcher']
def callback(routerId, externalNetId):
if result is not None:
context[result] = {"routerId": routerId,
"floatingId": externalNetId}
success_handler = body.find('success')
if success_handler is not None:
engine.evaluate_content(success_handler, context)
command_dispatcher.execute(
name="net",
command="get_router",
callback=callback)
def get_default_network(engine, context, body, result=None):
command_dispatcher = context['/commandDispatcher']
def callback(result_value):
if result is not None:
context[result] = {"networkId": result_value}
success_handler = body.find('success')
if success_handler is not None:
engine.evaluate_content(success_handler, context)
command_dispatcher.execute(
name="net",
command="get_network",
callback=callback)
def get_network_topology(engine, context, body, result=None):
return muranoconductor.config.CONF.network_topology
xml_code_engine.XmlCodeEngine.register_function(
get_subnet, "get-cidr")
xml_code_engine.XmlCodeEngine.register_function(
get_default_router, "get-default-router-id")
xml_code_engine.XmlCodeEngine.register_function(
get_default_network, "get-default-network-id")
xml_code_engine.XmlCodeEngine.register_function(
get_default_router, "get-default-router-id")
xml_code_engine.XmlCodeEngine.register_function(
get_network_topology, "get-net-topology")