X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Ftest%2Flaunchpad.py;h=324b94b659bb0569cd75eac4f07187879e767781;hb=refs%2Fheads%2Fstatic_ip;hp=239f91b3df174bbcf70962229800731a130ee827;hpb=6f07e6f33f751ab4ffe624f6037f887b243bece2;p=osm%2FSO.git diff --git a/rwlaunchpad/test/launchpad.py b/rwlaunchpad/test/launchpad.py index 239f91b3..324b94b6 100755 --- a/rwlaunchpad/test/launchpad.py +++ b/rwlaunchpad/test/launchpad.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# +# # Copyright 2016 RIFT.IO Inc # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -470,20 +470,43 @@ def main(argv=sys.argv[1:]): # since it doesn't need it and it will fail within containers os.environ["NO_KERNEL_MODS"] = "1" + + cleanup_dir_name = None + if os.environ["INSTALLDIR"] in ["/", "/home/rift", "/home/rift/.install", + "/usr/rift/build/fc20_debug/install/usr/rift", "/usr/rift"]: + cleanup_dir_name = os.environ["INSTALLDIR"] + "/var/rift/" + + if args.test_name and not cleanup_dir_name: + cleanup_dir_name = "find {rift_install}/var/rift -name '*{pattern}*' -type d".format( \ + rift_install=os.environ['RIFT_INSTALL'], + pattern = args.test_name) + try: + cleanup_dir_name = subprocess.check_output(cleanup_dir_name, shell=True) + cleanup_dir_name = cleanup_dir_name[:-1].decode("utf-8") + "/" + except Exception as e: + print ("Directory not found exception occurred. Probably running for first time") + print ("Zookeper cleanup cmd = {}".format(cleanup_dir_name)) + else: + if not cleanup_dir_name: + cleanup_dir_name = os.environ["INSTALLDIR"] + "/" + # Remove the persistent Redis data - for f in os.listdir(os.environ["INSTALLDIR"]): - if f.endswith(".aof") or f.endswith(".rdb"): - os.remove(os.path.join(os.environ["INSTALLDIR"], f)) - - # Remove the persistant DTS recovery files - for f in os.listdir(os.environ["INSTALLDIR"]): - if f.endswith(".db"): - os.remove(os.path.join(os.environ["INSTALLDIR"], f)) try: - shutil.rmtree(os.path.join(os.environ["INSTALLDIR"], "zk/server-1")) + for f in os.listdir(cleanup_dir_name): + if f.endswith(".aof") or f.endswith(".rdb"): + os.remove(os.path.join(cleanup_dir_name, f)) + + # Remove the persistant DTS recovery files + for f in os.listdir(cleanup_dir_name): + if f.endswith(".db"): + os.remove(os.path.join(cleanup_dir_name, f)) + + shutil.rmtree(os.path.join(cleanup_dir_name, "zk/server-1")) shutil.rmtree(os.path.join(os.environ["INSTALLDIR"], "var/rift/tmp*")) - except: + except FileNotFoundError as e: pass + except Exception as e: + print ("Error while cleanup: {}".format(str(e))) ha_mode = args.ha_mode mgmt_ip_list = [] if not args.mgmt_ip_list else args.mgmt_ip_list @@ -497,10 +520,8 @@ def main(argv=sys.argv[1:]): netconf_trace_override=True) confd_ip = socket.gethostbyname(socket.gethostname()) - intf = netifaces.ifaddresses('eth0') - if intf and netifaces.AF_INET in intf and len(intf[netifaces.AF_INET]): - confd_ip = intf[netifaces.AF_INET][0]['addr'] - rift.vcs.logger.configure_sink(config_file=None, confd_ip=confd_ip) + # TODO: This need to be changed when launchpad starts running on multiple VMs + rift.vcs.logger.configure_sink(config_file=None, confd_ip="127.0.0.1") # Start the prepared system system.start()