[elbe-devel] [PATCH] Add/fix version check

Philipp Arras philipp.arras at linutronix.de
Wed May 10 10:48:10 CEST 2017


It is important that the Elbe versions in initvm and host machine
conincide. The check whether this is the case hasn't been in the correct
position leading to unexpected error messages.

The version is only checked when `elbe control` or `elbe prjrepo` is
called. This is sensible since `elbe initvm` and `elbe pbuilder`
essentially call `elbe control`.

https://github.com/Linutronix/elbe/issues/99

Signed-off-by: Philipp Arras <philipp.arras at linutronix.de>
---
 elbepack/commands/control.py | 20 ++++++++++----------
 elbepack/commands/prjrepo.py | 28 ++++++++++++++--------------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index 1528fa4..c1e8a40 100755
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -117,29 +117,29 @@ def run_command (argv):
         print ("try 'elbe initvm --directory /path/to/initvm start'", file=sys.stderr)
         sys.exit(10)
 
-
-    try:
-        action = ClientAction (args[0])
-    except KeyError:
-        print ('elbe control - unknown subcommand', file=sys.stderr)
-        ClientAction.print_actions ()
-        sys.exit(20)
-
     try:
         v_server = control.service.get_version ()
         if v_server != elbe_version:
             print ("elbe v%s is used in initvm, this is not compatible with \
 elbe v%s that is used on this machine. Please install same \
-versions of elbe in initvm and on your machine." % (v_server, elbe_version))
+versions of elbe in initvm and on your machine." % (v_server, elbe_version), file=sys.stderr)
             if not (opt.ignore_version):
                 sys.exit (20)
     except AttributeError:
         print ("the elbe installation inside the initvm doesn't provide a \
 get_version interface. Please create a new initvm or upgrade \
-elbe inside the existing initvm.")
+elbe inside the existing initvm.", file=sys.stderr)
         if not (opt.ignore_version):
             sys.exit (20)
 
+    try:
+        action = ClientAction (args[0])
+    except KeyError:
+        print ('elbe control - unknown subcommand', file=sys.stderr)
+        ClientAction.print_actions ()
+        sys.exit(20)
+
+
 
     try:
         action.execute (control, opt, args[1:])
diff --git a/elbepack/commands/prjrepo.py b/elbepack/commands/prjrepo.py
index f78fcc0..515ce5b 100755
--- a/elbepack/commands/prjrepo.py
+++ b/elbepack/commands/prjrepo.py
@@ -127,29 +127,29 @@ def run_command(argv):
             file=sys.stderr)
         sys.exit(10)
 
-    # Check whether subcommand exists
-    try:
-        action = RepoAction(args[0])
-    except KeyError:
-        print ('elbe prjrepo - unknown subcommand', file=sys.stderr)
-        RepoAction.print_actions()
-        sys.exit(20)
-
-    # Check elbe version
+    # Check Elbe version
     try:
-        v_server = control.service.get_version()
+        v_server = control.service.get_version ()
         if v_server != elbe_version:
             print ("elbe v%s is used in initvm, this is not compatible with \
 elbe v%s that is used on this machine. Please install same \
-versions of elbe in initvm and on your machine." % (v_server, elbe_version))
+versions of elbe in initvm and on your machine." % (v_server, elbe_version), file=sys.stderr)
             if not (opt.ignore_version):
-                sys.exit(20)
+                sys.exit (20)
     except AttributeError:
         print ("the elbe installation inside the initvm doesn't provide a \
 get_version interface. Please create a new initvm or upgrade \
-elbe inside the existing initvm.")
+elbe inside the existing initvm.", file=sys.stderr)
         if not (opt.ignore_version):
-            sys.exit(20)
+            sys.exit (20)
+
+    # Check whether subcommand exists
+    try:
+        action = RepoAction(args[0])
+    except KeyError:
+        print ('elbe prjrepo - unknown subcommand', file=sys.stderr)
+        RepoAction.print_actions()
+        sys.exit(20)
 
     # Execute command
     try:
-- 
2.1.4





More information about the elbe-devel mailing list