]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
location(8): Allow downloading a database without one on disk
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Jul 2020 10:43:46 +0000 (10:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Jul 2020 10:43:46 +0000 (10:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/location.in

index c4987a5ccae6672606b60ad2602f770520bf42f6..5189738c449cb082e0d3cef6b88d57e4818335b7 100644 (file)
@@ -199,9 +199,14 @@ class CLI(object):
                try:
                        db = location.Database(args.database)
                except FileNotFoundError as e:
-                       sys.stderr.write("location: Could not open database %s: %s\n" \
-                               % (args.database, e))
-                       sys.exit(1)
+                       # Allow continuing without a database
+                       if args.func == self.handle_update:
+                               db = None
+
+                       else:
+                               sys.stderr.write("location: Could not open database %s: %s\n" \
+                                       % (args.database, e))
+                               sys.exit(1)
 
                # Translate family (if present)
                if "family" in args: