Commit 6c81456d90ddbd4b94244b172ccae307b36463df

Authored by Etienne Pallier
1 parent c7318a4a
Exists in dev

Nouvelle méthode command.get_updated_result()

Démonstration d'utilisation dans "pyros shell" page 127
Showing 3 changed files with 9 additions and 5 deletions   Show diff stats
README.md
... ... @@ -71,7 +71,7 @@ Date: 22/03/2019
71 71  
72 72 Author: E. Pallier
73 73  
74   -VERSION: 0.20.25
  74 +VERSION: 0.20.26
75 75  
76 76 Comment: mode "test" (-t) géré (= mode simulateur)
77 77  
... ...
src/agent/Agent.py
... ... @@ -704,7 +704,7 @@ class Agent:
704 704 if param['section']=="assembly" and param['key']=="alias":
705 705 assembled_aliases.append(param['value'])
706 706 #print(f"Unit {unit_alias} is the assembly of {assembled_aliases}")
707   -
  707 +
708 708 print("--------- Components of the unit -----------")
709 709 print("Configuration file is {}".format(self.config.get_configfile()))
710 710 alias = self.config.get_aliases('unit')[0]
... ... @@ -722,15 +722,15 @@ class Agent:
722 722 assembled_mount_aliases.append(alias)
723 723 elif unit_subtag=="channel":
724 724 assembled_channel_aliases.append(alias)
725   -
  725 +
726 726 print("--------- Assembly of the unit -----------")
727 727 print(f"Assembled mount aliases: {assembled_mount_aliases}")
728 728 print(f"Assembled channel aliases: {assembled_channel_aliases}")
729   -
  729 +
730 730 # --- Get the home of the mount[0]
731 731 mount_alias = assembled_mount_aliases[0]
732 732 home = self.config.get_param(mount_alias,'MountPointing','home')
733   -
  733 +
734 734 print("------------------------------------------")
735 735 hostname = socket.gethostname()
736 736 self._computer_alias = ''
... ...
src/common/models.py
... ... @@ -482,6 +482,10 @@ class Command(models.Model):
482 482 def get_result(self):
483 483 return self.result
484 484  
  485 + def get_updated_result(self):
  486 + self.refresh_from_db()
  487 + return self.result
  488 +
485 489 def set_result(self, result:str):
486 490 self.result = result
487 491 self.save()
... ...