import os
import sys
import random
+import re
parser = argparse.ArgumentParser(description='Cluster Deployer')
-parser.add_argument("--distribution", default="", help="the absolute path of the distribution on the local host that needs to be deployed", required=True)
+parser.add_argument("--distribution", default="", help="the absolute path of the distribution on the local host that needs to be deployed. (Must contain version in the form: \"<#>.<#>.<#>-<name>\", e.g. 0.2.0-SNAPSHOT)", required=True)
parser.add_argument("--rootdir", default="/root", help="the root directory on the remote host where the distribution is to be deployed", required=True)
parser.add_argument("--hosts", default="", help="a comma separated list of host names or ip addresses", required=True)
parser.add_argument("--clean", action="store_true", default=False, help="clean the deployment on the remote host")
self.replicas = replicas
def deploy(self):
+ # Determine distribution version
+ distribution_name = os.path.splitext(os.path.basename(self.distribution))[0]
+ distribution_ver = re.search('(\d)\.(\d)\.(\d)-(\w)+', distribution_name)
+ if distribution_ver is None:
+ print distribution_name + " is not a valid distribution version. (Must contain version in the form: \"<#>.<#>.<#>-<name>\", e.g. 0.2.0-SNAPSHOT)"
+ sys.exit(1)
+ distribution_ver = distribution_ver.group()
+
# Render all the templates
renderer = TemplateRenderer(self.template)
akka_conf = renderer.render("akka.conf.template", "akka.conf",
)
module_shards_conf = renderer.render("module-shards.conf.template", "module-shards.conf", self.replicas)
modules_conf = renderer.render("modules.conf.template", "modules.conf")
- features_cfg = renderer.render("org.apache.karaf.features.cfg.template", "org.apache.karaf.features.cfg")
+ features_cfg = renderer.render("org.apache.karaf.features.cfg.template", "org.apache.karaf.features.cfg", {"ODL_DISTRIBUTION" : distribution_ver})
jolokia_xml = renderer.render("jolokia.xml.template", "jolokia.xml")
management_cfg = renderer.render("org.apache.karaf.management.cfg.template", "org.apache.karaf.management.cfg", {"HOST" : self.host})
remote.exec_cmd("unzip " + odl_file_path + " -d " + self.dir_name + "/")
# Rename the distribution directory to odl
- distribution_name = os.path.splitext(os.path.basename(self.distribution))[0]
remote.exec_cmd("mv " + self.dir_name + "/" + distribution_name + " " + self.dir_name + "/odl")
# Copy all the generated files to the server
#
#respectStartLvlDuringFeatureStartup=true
-
#
# Defines if the startlvl should be respected during feature uninstall. The default value is true.
# If true, means stop bundles respecting the descend order of start level in a certain feature.
#
# Comma separated list of features repositories to register by default
#
-featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.0-SNAPSHOT/xml/features
+featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/{{ODL_DISTRIBUTION}}/xml/features
#
# Comma separated list of features to install at startup
#
-featuresBoot=config,standard,region,package,kar,ssh,management,odl-openflowplugin-flow-services,odl-restconf,odl-mdsal-clustering,feature-jolokia
+featuresBoot=config,standard,region,package,kar,ssh,management,odl-openflowplugin-flow-services,odl-restconf,odl-mdsal-clustering
#
# Defines if the boot features are started in asynchronous mode (in a dedicated thread)