]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: process: disable stdin param of run() 20244/head
authorKefu Chai <kchai@redhat.com>
Fri, 1 Dec 2017 16:43:21 +0000 (00:43 +0800)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 1 Feb 2018 22:37:05 +0000 (16:37 -0600)
we cannot use process.communicate() to feed the Popen with input,
because, upon return of process.communicate() the stdout,stderr are
closed. see https://docs.python.org/2/library/subprocess.html#subprocess.Popen.communicate .

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 6df444cf33a251f5dcb536606b44af696cdb4ed5)

Conflicts:
src/ceph-volume/ceph_volume/process.py

src/ceph-volume/ceph_volume/process.py

index d34aff2bb295ca5b3abb24def2088be4591ca60b..de935a3f96182fc9ad8361ebcfe7bf92a75ad1c3 100644 (file)
@@ -100,7 +100,6 @@ def run(command, **kw):
     """
     stop_on_error = kw.pop('stop_on_error', True)
     command_msg = obfuscate(command, kw.pop('obfuscate', None))
-    stdin = kw.pop('stdin', None)
     fail_msg = kw.pop('fail_msg', None)
     logger.info(command_msg)
     terminal.write(command_msg)
@@ -108,15 +107,12 @@ def run(command, **kw):
 
     process = subprocess.Popen(
         command,
-        stdin=subprocess.PIPE,
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,
         close_fds=True,
         **kw
     )
 
-    if stdin:
-        process.communicate(stdin)
     while True:
         reads, _, _ = select(
             [process.stdout.fileno(), process.stderr.fileno()],