]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: do not discard stderr
authorLoic Dachary <ldachary@redhat.com>
Wed, 16 Dec 2015 11:29:17 +0000 (12:29 +0100)
committerLoic Dachary <ldachary@redhat.com>
Wed, 6 Jan 2016 15:54:05 +0000 (16:54 +0100)
Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 5fa35ba10e10b56262757afc43929ab8ee4164f2)

Conflicts:
src/ceph-disk : trivial, because destroy/deactivate
        are not implemented in infernalis

src/ceph-disk

index 3f009513c9a7668cf02db270a478cb1433f7e3ed..384eb171c7d3f6369b5795db489c84d278cb0a81 100755 (executable)
@@ -246,7 +246,7 @@ def is_upstart():
     """
     Detect whether upstart is running
     """
-    (out, _) = command(['init', '--version'])
+    (out, err, _) = command(['init', '--version'])
     if 'upstart' in out:
         return True
     return False
@@ -329,9 +329,10 @@ def command(arguments, **kwargs):
     process = subprocess.Popen(
         arguments,
         stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
         **kwargs)
-    out, _ = process.communicate()
-    return out, process.returncode
+    out, err = process.communicate()
+    return out, err, process.returncode
 
 
 def command_check_call(arguments):
@@ -868,11 +869,11 @@ def path_set_context(path):
            )
 
 def _check_output(args=None, **kwargs):
-    out, ret = command(args, **kwargs)
+    out, err, ret = command(args, **kwargs)
     if ret:
         cmd = args[0]
         error = subprocess.CalledProcessError(ret, cmd)
-        error.output = out
+        error.output = out + err
         raise error
     return out
 
@@ -886,7 +887,7 @@ def get_conf(cluster, variable):
     :return: The variable value or None.
     """
     try:
-        out, ret = command(
+        out, err, ret = command(
             [
                 'ceph-conf',
                 '--cluster={cluster}'.format(
@@ -899,7 +900,7 @@ def get_conf(cluster, variable):
             close_fds=True,
             )
     except OSError as e:
-        raise Error('error executing ceph-conf', e)
+        raise Error('error executing ceph-conf', e, err)
     if ret == 1:
         # config entry not found
         return None
@@ -1671,17 +1672,17 @@ def prepare_dev(
                             os.path.basename(rawdev)])
 
 def check_journal_reqs(args):
-    _, allows_journal = command([
+    _, _, allows_journal = command([
         'ceph-osd', '--check-allows-journal',
         '-i', '0',
         '--cluster', args.cluster,
     ])
-    _, wants_journal = command([
+    _, _, wants_journal = command([
         'ceph-osd', '--check-wants-journal',
         '-i', '0',
         '--cluster', args.cluster,
     ])
-    _, needs_journal = command([
+    _, _, needs_journal = command([
         'ceph-osd', '--check-needs-journal',
         '-i', '0',
         '--cluster', args.cluster,
@@ -2642,7 +2643,7 @@ def get_oneliner(base, name):
 
 
 def get_dev_fs(dev):
-    fscheck, _ = command(
+    fscheck, _, _ = command(
         [
             'blkid',
             '-s',
@@ -2674,7 +2675,7 @@ def get_partition_uuid(part):
 
 def get_sgdisk_partition_info(dev, regexp):
     (base, partnum) = split_dev_base_partnum(dev)
-    out, _ = command(['sgdisk', '-i', partnum, base])
+    out, _, _ = command(['sgdisk', '-i', partnum, base])
     for line in out.splitlines():
         m = re.match(regexp, line)
         if m: