diff --git a/src/core/pyros_django/majordome/agent/Agent.py b/src/core/pyros_django/majordome/agent/Agent.py index 44a8ae7..3db9644 100755 --- a/src/core/pyros_django/majordome/agent/Agent.py +++ b/src/core/pyros_django/majordome/agent/Agent.py @@ -3517,7 +3517,30 @@ class Agent: ephem_target = pickle.load(open(eph_file,"rb")) self._oc['config'].fn.fcontext = fcontext0 return ephem_target + + + def get_period(self) -> dict: + """Returns a dictionary of the period in various formats + + Returns: + Dictionay of following items: + * id: integer of the period number + * Pxxx: string of the period symbol for file names + """ + period_dict = {} + operiod = Period.objects.exploitation_period() + if operiod == None: + log.info("No period valid in the database") + raise Exception + period_dict['id'] = int(operiod.id) + period_id = str(operiod.id) + if len(str(operiod.id)) < 3: + while len(period_id) < 3: + period_id = "0" + period_id + period_id = "P" + period_id + period_dict['Pxxx'] = period_id + return period_dict """ ================================================================= MAIN @@ -3539,6 +3562,7 @@ def parse_args(args): parser = argparse.ArgumentParser(description='Start an agent.') parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store") parser.add_argument("-t", action="store_true") + parser.add_argument("-d", action="store_true" ) args = vars(parser.parse_args(args)) return args -- libgit2 0.21.2