From patchwork Wed Apr 24 18:04:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 2485661 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AE996DF25A for ; Wed, 24 Apr 2013 18:04:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755967Ab3DXSE6 (ORCPT ); Wed, 24 Apr 2013 14:04:58 -0400 Received: from cobra.newdream.net ([66.33.216.30]:33815 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752393Ab3DXSE5 (ORCPT ); Wed, 24 Apr 2013 14:04:57 -0400 Received: from cobra.newdream.net (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id 5FE5A8044B; Wed, 24 Apr 2013 11:04:56 -0700 (PDT) Received: by cobra.newdream.net (Postfix, from userid 1031) id 5E2CB8047E; Wed, 24 Apr 2013 11:04:56 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id 5C8438044B; Wed, 24 Apr 2013 11:04:56 -0700 (PDT) Date: Wed, 24 Apr 2013 11:04:56 -0700 (PDT) From: Sage Weil X-X-Sender: sage@cobra.newdream.net To: Andreas Friedrich cc: Ceph Development Subject: Re: Unique bug in ceph start script In-Reply-To: <20130424075630.GA7395@upset.ux.pdb.fsc.net> Message-ID: References: <20130422150612.GA22006@upset.ux.pdb.fsc.net> <20130423064101.GA24976@upset.ux.pdb.fsc.net> <20130424075630.GA7395@upset.ux.pdb.fsc.net> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org On Wed, 24 Apr 2013, Andreas Friedrich wrote: > On Di, Apr 23, 2013 at 10:01:53 -0700, Sage Weil wrote: > ... > > > So in this example two config files with different names but the same > > > content would be copied to hosta. This is not very pretty but it > > > should work without error. > > > > It's because of the $pushed_to list.. for #3 it wouldn't re-push > > ceph.conf. I pushed a patch that just skips that optimization entirely: > > > > https://github.com/ceph/ceph/commit/ccbc4dbc6edf09626459ca52a53a72682f541e86 > > > > Look okay to you? > > Yes, but I'm not happy with the trap instruction: > > trap "ssh $host rm /tmp/ceph.conf.$unique" EXIT > > If the start script exits with or without error, the remote config > file will be removed from :/tmp - but only for the last > host (the former trap calls will be overwritten by the last trap > call)! This makes no sense to me. Bah.. I was thinking they would stack. How about ?? --- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/init-ceph.in b/src/init-ceph.in index 61c10e1..195bf76 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -218,8 +218,11 @@ for name in $what; do else unique=`dd if=/dev/urandom bs=16 count=1 2>/dev/null | md5sum | awk '{print $1}'` scp -q $conf $host:/tmp/ceph.conf.$unique - trap "ssh $host rm /tmp/ceph.conf.$unique" EXIT cur_conf="/tmp/ceph.conf.$unique" + + # clean up on exit + remote_configs="$host:/tmp/ceph.conf.$unique $remote_configs" + trap 'for f in '$remote_configs' ; do ssh ${f%:*} rm ${f#*:} ; done' EXIT fi cmd="$cmd -c $cur_conf"