From 493515e196aaffd7e4d0aad897914540826109b6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 20 Feb 2020 10:03:24 -0600 Subject: [PATCH] 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 --- src/cephadm/cephadm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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] == '}': -- 2.47.3