[elbe-devel] [RFC PATCH 5/5] initvmaction: Add sync action

Olivier Dion dion at linutronix.de
Tue May 5 22:02:51 CEST 2020


The initvm sync command will synchronize the local repository with the
initvm.  This does not check if there's a build in progress nor if the
files are okay.  The elbe-daemon _could crash silently_.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/initvmaction.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index c6c1943f..b51d5609 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -628,3 +628,18 @@ class SubmitAction(InitVMAction):
 
             submit_and_dl_result(xmlfile, cdrom, opt)
 
+ at InitVMAction.register('sync')
+class SyncAction(InitVMAction):
+
+    def __init__(self, node):
+        super(SyncAction, self).__init__(node)
+
+    def execute(self, _initvmdir, opt, args):
+        this_dir = os.path.dirname(os.path.realpath(__file__))
+        try:
+            system("rsync --info=name1,stats1  --archive --times "
+                   "--exclude='*.pyc' --exclude='__pycache__' "
+                   "--port=%s %s/ localhost::elbe" %
+                   (cfg['rsyncport'], this_dir))
+        except CommandError as E:
+            print(E)
-- 
2.26.2




More information about the elbe-devel mailing list