From 5e42bc745c7299733fd1c6050bc538baa61e23ae Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 8 Jun 2017 19:05:36 +0200 Subject: [PATCH] ceph-disk: _dmcrypt_map uses command_with_stdin Instead of an inlined version of it. Signed-off-by: Loic Dachary --- src/ceph-disk/ceph_disk/main.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index 9c1866f97b9..f49f54ab049 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -1307,27 +1307,15 @@ def _dmcrypt_map( rawdev, ] + cryptsetup_parameters - def run(args, stdin): - LOG.info(" ".join(args)) - process = subprocess.Popen( - args, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - out, err = process.communicate(stdin) - LOG.debug(out) - LOG.error(err) - assert process.returncode == 0 - try: if luks: if format_dev: - run(luksFormat_args, key) - run(luksOpen_args, key) + command_with_stdin(luksFormat_args, key) + command_with_stdin(luksOpen_args, key) else: # Plain mode has no format function, nor any validation # that the key is correct. - run(create_args, key) + command_with_stdin(create_args, key) # set proper ownership of mapped device command_check_call(['chown', 'ceph:ceph', dev]) return dev -- 2.47.3