]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
vstart: output command strings to stderr
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 15 Oct 2019 17:41:06 +0000 (10:41 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 15 Oct 2019 17:46:02 +0000 (10:46 -0700)
This allows redirecting prun/prunb to a file without using another
function. Also, write to the terminal if stderr is redirected to give a
visual glimpse of vstart's progress.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/vstart.sh

index 6fd3748e4617566f016c4a590a3a5bafcd3d04ce..ff1fbb51cf4e993f713ed182ed679f235aa73a23 100755 (executable)
@@ -477,23 +477,24 @@ quoted_print() {
     printf '\n'
 }
 
+debug() {
+  if [ -w /dev/tty -a ! -t 2 ]; then
+    "$@" | tee /dev/tty >&2
+  else
+    "$@" >&2
+  fi
+}
+
 prunb() {
-    quoted_print "$@" '&'
+    debug quoted_print "$@" '&'
     "$@" &
 }
 
 prun() {
-    quoted_print "$@"
+    debug quoted_print "$@"
     "$@"
 }
 
-prun_to_file() {
-       f=$1
-       shift
-       quoted_print "$@"
-       "$@" >> $f
-}
-
 run() {
     type=$1
     shift
@@ -1128,17 +1129,6 @@ ceph_adm() {
     fi
 }
 
-ceph_adm_to_file() {
-       f=$1
-       shift
-
-       if [ "$cephx" -eq 1 ]; then
-               prun_to_file $f $SUDO "$CEPH_ADM" -c "$conf_fn" -k "$keyring_fn" "$@"
-       else
-               prun_to_file $f $SUDO "$CEPH_ADM" -c "$conf_fn" "$@"
-       fi
-}
-
 if [ $inc_osd_num -gt 0 ]; then
     start_osd
     exit
@@ -1368,10 +1358,11 @@ do_rgw()
     for n in $(seq 1 $CEPH_NUM_RGW); do
         rgw_name="client.rgw.${current_port}"
 
-        ceph_adm_to_file $keyring_fn auth get-or-create $rgw_name \
+        ceph_adm auth get-or-create $rgw_name \
             mon 'allow rw' \
             osd 'allow rwx' \
             mgr 'allow rw' \
+            >> "$keyring_fn"
 
         echo start rgw on http${CEPH_RGW_HTTPS}://localhost:${current_port}
         run 'rgw' $current_port $RGWSUDO $CEPH_BIN/radosgw -c $conf_fn \