Move the kill functionality to a separate shell script which is
copied over to the destination system before invoking it
Change-Id: If9c01746263448e4dcb8920ebd962fe745275c8b
Signed-off-by: Moiz Raja <moraja@cisco.com>
self.cwd = os.getcwd()
self.template_root = self.cwd + "/templates/" + template + "/"
self.cwd = os.getcwd()
self.template_root = self.cwd + "/templates/" + template + "/"
- def render(self, template_path, output_path, variables={}):
+ def render(self, template_path, output_path, variables=None):
+ if variables is None:
+ variables = {}
+
with open(self.template_root + template_path, "r") as myfile:
data = myfile.read()
with open(self.template_root + template_path, "r") as myfile:
data = myfile.read()
for x in range(0, len(arr)):
s = s + '"' + arr[x] + '"'
if x < (len(arr) - 1):
for x in range(0, len(arr)):
s = s + '"' + arr[x] + '"'
if x < (len(arr) - 1):
- s = s + ","
- s = s + "]"
self.rpc_seed_nodes = rpc_seed_nodes
self.replicas = replicas
self.rpc_seed_nodes = rpc_seed_nodes
self.replicas = replicas
+ def kill_controller(self, remote):
+ remote.copy_file("kill_controller.sh", self.rootdir + "/")
+ remote.exec_cmd(self.rootdir + "/kill_controller.sh")
+
def deploy(self):
# Determine distribution version
distribution_name = os.path.splitext(os.path.basename(self.distribution))[0]
def deploy(self):
# Determine distribution version
distribution_name = os.path.splitext(os.path.basename(self.distribution))[0]
# Connect to the remote host and start doing operations
remote = RemoteHost(self.host, self.user, self.password, self.rootdir)
# Connect to the remote host and start doing operations
remote = RemoteHost(self.host, self.user, self.password, self.rootdir)
- remote.mkdir(self.dir_name)
# Delete all the sub-directories under the deploy directory if the --clean flag is used
# Delete all the sub-directories under the deploy directory if the --clean flag is used
- if(self.clean is True):
remote.exec_cmd("rm -rf " + self.rootdir + "/deploy/*")
remote.exec_cmd("rm -rf " + self.rootdir + "/deploy/*")
+ # Create the deployment directory
+ remote.mkdir(self.dir_name)
+
# Clean the m2 repository
remote.exec_cmd("rm -rf " + self.rootdir + "/.m2/repository")
# Kill the controller if it's running
# Clean the m2 repository
remote.exec_cmd("rm -rf " + self.rootdir + "/.m2/repository")
# Kill the controller if it's running
- remote.kill_controller()
+ self.kill_controller(remote)
# Copy the distribution to the host and unzip it
odl_file_path = self.dir_name + "/odl.zip"
# Copy the distribution to the host and unzip it
odl_file_path = self.dir_name + "/odl.zip"
hosts = args.hosts.split(",")
time_stamp = time.time()
dir_name = args.rootdir + "/deploy/" + str(time_stamp)
hosts = args.hosts.split(",")
time_stamp = time.time()
dir_name = args.rootdir + "/deploy/" + str(time_stamp)
- distribution_name = os.path.splitext(os.path.basename(args.distribution))[0] # noqa
ds_seed_nodes = []
rpc_seed_nodes = []
ds_seed_nodes = []
rpc_seed_nodes = []
--- /dev/null
+ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sudo sh
lib.close_connection()
def kill_controller(self):
lib.close_connection()
def kill_controller(self):
- self.exec_cmd("ps axf | grep karaf | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
+ self.exec_cmd("sudo ps axf | grep karaf | grep -v grep | awk '{print \"kill -9 \" $1}' | sudo sh")
def start_controller(self, dir_name):
self.exec_cmd(dir_name + "/odl/bin/start")
def start_controller(self, dir_name):
self.exec_cmd(dir_name + "/odl/bin/start")