]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: consolidate logic for reading `config-json`
authorMichael Fritch <mfritch@suse.com>
Wed, 11 Mar 2020 01:28:30 +0000 (19:28 -0600)
committerMichael Fritch <mfritch@suse.com>
Wed, 11 Mar 2020 20:02:47 +0000 (14:02 -0600)
logic for reading `--config-json` from stdin or file was duplicated

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index 396f7b3dffebf04b293370abf5c8b9712ca673cf..af2b3ea24195e5412cbaee16b6ca9793675d9897 100755 (executable)
@@ -1125,15 +1125,7 @@ def get_parm(option):
 def get_config_and_keyring():
     # type: () -> Tuple[str, str]
     if 'config_json' in args and args.config_json:
-        if args.config_json == '-':
-            try:
-                j = injected_stdin # type: ignore
-            except NameError:
-                j = sys.stdin.read()
-        else:
-            with open(args.config_json, 'r') as f:
-                j = f.read()
-        d = json.loads(j)
+        d = get_parm(args.config_json)
         config = d.get('config')
         keyring = d.get('keyring')
     else: