]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: clean-up error message
authorMichael Fritch <mfritch@suse.com>
Thu, 13 May 2021 23:03:32 +0000 (17:03 -0600)
committerSage Weil <sage@newdream.net>
Thu, 3 Jun 2021 12:41:54 +0000 (07:41 -0500)
use the standard error message from FileNotFound:
```
cephadm bootstrap --mon-ip 192.168.1.1 --config ~/foobar
ERROR: [Errno 2] No such file or directory: '/root/foobar'
```

Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit 870e9bddd2a059ae4930a2eed163bb862094dcaa)

src/cephadm/cephadm

index 1b0fe9b069a253479f8c789b4d929baa8e4d1e75..1c23a7ce6378b269a4f87cf8128172ac1222bddd 100755 (executable)
@@ -2259,8 +2259,8 @@ def get_config_and_keyring(ctx):
         try:
             with open(ctx.config, 'r') as f:
                 config = f.read()
-        except FileNotFoundError:
-            raise Error('config file: %s does not exist' % ctx.config)
+        except FileNotFoundError as e:
+            raise Error(e)
 
     if 'key' in ctx and ctx.key:
         keyring = '[%s]\n\tkey = %s\n' % (ctx.name, ctx.key)
@@ -2268,8 +2268,8 @@ def get_config_and_keyring(ctx):
         try:
             with open(ctx.keyring, 'r') as f:
                 keyring = f.read()
-        except FileNotFoundError:
-            raise Error('keyring file: %s does not exist' % ctx.keyring)
+        except FileNotFoundError as e:
+            raise Error(e)
 
     return config, keyring