]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: _dmcrypt_map uses command_with_stdin
authorLoic Dachary <ldachary@redhat.com>
Thu, 8 Jun 2017 17:05:36 +0000 (19:05 +0200)
committerLoic Dachary <ldachary@redhat.com>
Fri, 14 Jul 2017 17:47:00 +0000 (19:47 +0200)
Instead of an inlined version of it.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/ceph-disk/ceph_disk/main.py

index 9c1866f97b957a23e2ca1e554f7b466ebc30301f..f49f54ab0497692bbfd68afaafc15ccb709bbeae 100755 (executable)
@@ -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