def run_initial_setup(self): """ This is triggered by the amp protocol when the connection to the portal has been established. This attempts to run the initial_setup script of the server. It returns if this is not the first time the server starts. Once finished the last_initial_setup_step is set to -1. """ global INFO_DICT last_initial_setup_step = ServerConfig.objects.conf( "last_initial_setup_step") if not last_initial_setup_step: # None is only returned if the config does not exist, # i.e. this is an empty DB that needs populating. INFO_DICT[ "info"] = " Server started for the first time. Setting defaults." initial_setup.handle_setup(0) elif int(last_initial_setup_step) >= 0: # a positive value means the setup crashed on one of its # modules and setup will resume from this step, retrying # the last failed module. When all are finished, the step # is set to -1 to show it does not need to be run again. INFO_DICT[ "info"] = " Resuming initial setup from step {last}.".format( last=last_initial_setup_step) initial_setup.handle_setup(int(last_initial_setup_step))
def run_initial_setup(self): """ This attempts to run the initial_setup script of the server. It returns if this is not the first time the server starts. Once finished the last_initial_setup_step is set to -1. """ last_initial_setup_step = ServerConfig.objects.conf("last_initial_setup_step") if not last_initial_setup_step: # None is only returned if the config does not exist, # i.e. this is an empty DB that needs populating. print(" Server started for the first time. Setting defaults.") initial_setup.handle_setup(0) print("-" * 50) elif int(last_initial_setup_step) >= 0: # a positive value means the setup crashed on one of its # modules and setup will resume from this step, retrying # the last failed module. When all are finished, the step # is set to -1 to show it does not need to be run again. print(" Resuming initial setup from step %(last)s." % {"last": last_initial_setup_step}) initial_setup.handle_setup(int(last_initial_setup_step)) print("-" * 50)
def run_initial_setup(self): """ This attempts to run the initial_setup script of the server. It returns if this is not the first time the server starts. Once finished the last_initial_setup_step is set to -1. """ last_initial_setup_step = ServerConfig.objects.conf('last_initial_setup_step') if not last_initial_setup_step: # None is only returned if the config does not exist, # i.e. this is an empty DB that needs populating. print(' Server started for the first time. Setting defaults.') initial_setup.handle_setup(0) print('-' * 50) elif int(last_initial_setup_step) >= 0: # a positive value means the setup crashed on one of its # modules and setup will resume from this step, retrying # the last failed module. When all are finished, the step # is set to -1 to show it does not need to be run again. print(' Resuming initial setup from step %(last)s.' % \ {'last': last_initial_setup_step}) initial_setup.handle_setup(int(last_initial_setup_step)) print('-' * 50)