From a58468035b6a617e84471b2a98fa4d49a36c9444 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Tue, 10 Mar 2020 19:27:36 -0600 Subject: [PATCH] cephadm: merge `--config-and-keyring` and `--config-json` args both are passed via stdin from the mgr in a JSON format Signed-off-by: Michael Fritch --- src/cephadm/cephadm | 17 +++++++---------- src/pybind/mgr/cephadm/module.py | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index a1ff329d9a679..396f7b3dffebf 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -31,7 +31,7 @@ You can invoke cephadm in two ways: injected_argv = ['ls'] - For reading stdin from the '--config-and-json -' argument, + For reading stdin from the '--config-json -' argument, injected_stdin = '...' """ @@ -1124,14 +1124,14 @@ def get_parm(option): def get_config_and_keyring(): # type: () -> Tuple[str, str] - if args.config_and_keyring: - if args.config_and_keyring == '-': + 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_and_keyring, 'r') as f: + with open(args.config_json, 'r') as f: j = f.read() d = json.loads(j) config = d.get('config') @@ -2296,8 +2296,8 @@ def command_ceph_volume(): tmp_config = None tmp_keyring = None - if args.config_and_keyring: - # note: this will always pull from args.config_and_keyring (we + if args.config_json: + # note: this will always pull from args.config_json (we # require it) and never args.config or args.keyring. (config, keyring) = get_config_and_keyring() @@ -3481,7 +3481,7 @@ def _get_parser(): '--fsid', help='cluster FSID') parser_ceph_volume.add_argument( - '--config-and-keyring', + '--config-json', help='JSON file with config and (client.bootrap-osd) key') parser_ceph_volume.add_argument( 'command', nargs='+', @@ -3630,9 +3630,6 @@ def _get_parser(): parser_deploy.add_argument( '--key', help='key for new daemon') - parser_deploy.add_argument( - '--config-and-keyring', - help='JSON file with config and keyrings for the daemon and crash agent') parser_deploy.add_argument( '--osd-fsid', help='OSD uuid, if creating an OSD container') diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index f2d43765249ad..1ad560ea38ff0 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1987,7 +1987,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): before_osd_uuid_map = self.get_osd_uuid_map(only_up=True) split_cmd = cmd.split(' ') - _cmd = ['--config-and-keyring', '-', '--'] + _cmd = ['--config-json', '-', '--'] _cmd.extend(split_cmd) out, err, code = self._run_cephadm( host, 'osd', 'ceph-volume', @@ -2102,7 +2102,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): 'config': config, 'keyring': keyring, } - extra_args.extend(['--config-and-keyring', '-']) + extra_args.extend(['--config-json', '-']) # osd deployments needs an --osd-uuid arg if daemon_type == 'osd': -- 2.39.5