[elbe-devel] [PATCH] Add/fix version check
Philipp Arras
philipp.arras at linutronix.de
Thu Jun 8 12:16:49 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 | 29 +++++++++++++++--------------
elbepack/commands/prjrepo.py | 29 +++++++++++++++--------------
2 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index 1528fa4..2fd2a22 100755
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -117,28 +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))
+ print("\nThe version numbers of your ELBE installation and the initvm do not conincide.", file=sys.stderr)
+ print("ELBE Version (initvm): %s\nELBE Version (host): %s"
+ % (v_server, elbe_version), file=sys.stderr)
+ print("You may try to create a new initvm (`elbe initvm create`).", 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)
+
+ try:
+ action = ClientAction (args[0])
+ except KeyError:
+ print ('elbe control - unknown subcommand', file=sys.stderr)
+ ClientAction.print_actions ()
+ sys.exit(20)
+
try:
diff --git a/elbepack/commands/prjrepo.py b/elbepack/commands/prjrepo.py
index f78fcc0..00cfa1b 100755
--- a/elbepack/commands/prjrepo.py
+++ b/elbepack/commands/prjrepo.py
@@ -127,30 +127,31 @@ 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))
+ print("\nThe version numbers of your ELBE installation and the initvm do not conincide.", file=sys.stderr)
+ print("ELBE Version (initvm): %s\nELBE Version (host): %s"
+ % (v_server, elbe_version), file=sys.stderr)
+ print("You may try to create a new initvm (`elbe initvm create`).", 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)
+ # 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:
action.execute(control, opt, args[1:])
--
2.1.4
More information about the elbe-devel
mailing list