def tearDown(self): automat.CloseLogFile() tmpfile.shutdown() key.ForgetMyKey() my_id.forgetLocalIdentity() settings.shutdown() os.remove('/tmp/_some_priv_key') bpio.rmdir_recursive('/tmp/.bitdust_tmp') bpio.rmdir_recursive('/tmp/_some_folder') os.remove('/tmp/random_file')
def shutdown(x=None): """ This is a top level method which control the process of finishing the program. Calls method ``shutdown()`` in other modules. """ lg.out(2, "shutdowner.shutdown " + str(x)) from services import driver from main import settings from main import events from logs import weblog from logs import webtraffic from system import tmpfile from system import run_upnpc from raid import eccmap from lib import net_misc from updates import git_proc from interface import api_jsonrpc_server from interface import api_rest_http_server from interface import ftp_server from userid import my_id from crypt import my_keys dl = [] my_keys.shutdown() my_id.shutdown() ftp_server.shutdown() api_jsonrpc_server.shutdown() api_rest_http_server.shutdown() driver.shutdown() eccmap.shutdown() run_upnpc.shutdown() net_misc.shutdown() git_proc.shutdown() events.clear_subscribers() tmpfile.shutdown() if settings.NewWebGUI(): from web import control dl.append(control.shutdown()) else: from web import webcontrol dl.append(webcontrol.shutdown()) weblog.shutdown() webtraffic.shutdown() for a in automat.objects().values(): if a.name != 'shutdowner': a.event('shutdown') return DeferredList(dl)
def shutdown(x=None): """ This is a top level method which control the process of finishing the program. Calls method ``shutdown()`` in other modules. """ if _Debug: lg.out(_DebugLevel, "shutdowner.shutdown " + str(x)) dl = [] try: from services import driver from main import control from main import events from main import listeners from logs import weblog from logs import webtraffic from system import tmpfile from system import run_upnpc from raid import eccmap from lib import net_misc from updates import git_proc from interface import api_rest_http_server from interface import api_web_socket # from interface import ftp_server from contacts import identitydb from crypt import my_keys from userid import id_url from userid import my_id my_keys.shutdown() my_id.shutdown() identitydb.shutdown() # ftp_server.shutdown() api_rest_http_server.shutdown() api_web_socket.shutdown() driver.shutdown() eccmap.shutdown() run_upnpc.shutdown() net_misc.shutdown() git_proc.shutdown() listeners.shutdown() events.shutdown() tmpfile.shutdown() control.shutdown() try: weblog.shutdown() except: lg.exc() try: webtraffic.shutdown() except: lg.exc() survived_automats = list(automat.objects().values()) if survived_automats: lg.warn( 'found %d survived state machines, sending "shutdown" event to them all' % len(survived_automats)) for a in survived_automats: if a.name != 'shutdowner': a.event('shutdown') survived_automats = list(automat.objects().values()) if survived_automats: lg.warn( 'still found %d survived state machines, executing "destroy()" method to them all' % len(survived_automats)) for a in survived_automats: if a.name != 'shutdowner': a.destroy() settings.shutdown() id_url.shutdown() except: lg.exc() # TODO: rework all shutdown() methods to return deferred objects return DeferredList(dl)