From: Sage Weil Date: Thu, 20 Feb 2020 16:03:24 +0000 (-0600) Subject: cephadm: allow multiple get_parm() calls X-Git-Tag: v15.1.1~346^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33437%2Fhead;p=ceph.git cephadm: allow multiple get_parm() calls This fixes deployment of monitoring components when the config-json is passed via stdin. Signed-off-by: Sage Weil --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 2dccdba1b68a..e9dbda44a995 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -79,6 +79,7 @@ else: from urllib2 import urlopen, HTTPError container_path = '' +cached_stdin = None class Error(Exception): pass @@ -977,11 +978,16 @@ def get_parm(option): if not option: return dict() + global cached_stdin if option == '-': - try: - j = injected_stdin # type: ignore - except NameError: - j = sys.stdin.read() + if cached_stdin is not None: + j = cached_stdin + else: + try: + j = injected_stdin # type: ignore + except NameError: + j = sys.stdin.read() + cached_stdin = j else: # inline json string if option[0] == '{' and option[-1] == '}':