From owner-freebsd-current@FreeBSD.ORG Wed Jan 14 00:12:27 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7273665; Wed, 14 Jan 2015 00:12:27 +0000 (UTC) Received: from mail-ie0-x232.google.com (mail-ie0-x232.google.com [IPv6:2607:f8b0:4001:c03::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C9BF20A; Wed, 14 Jan 2015 00:12:27 +0000 (UTC) Received: by mail-ie0-f178.google.com with SMTP id vy18so6020286iec.9; Tue, 13 Jan 2015 16:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8nykvverx2m4PLhmgbqNUBb4DMSHAz8r3/s28nJrhjc=; b=zBZ+h5ErRsAanGYoxW21VBjLFZWA08KmgRi9HKQenACq9PITmZjBuTZZvtdOzY3Ogy 0hhPlK9kScrCCGi+fn7b0Tzg9NlEnIrTj6I79tZ7UuClYaxlAiCbJURPwrFDDrxtdYB1 jUnaGpCa3+zMco4vjJXiciyAYyvT3XtC+WZ7sKmHeXMORuPKeF+rY7qNYllKh+gftiaC Gr2zexgOq0NZbTCyxcQFRwQQYBr6QRQuBpC5l0FbIQLAo4lyJ+jeCFU4xz8IUdg9Y9Ta lHMZ3H1lg9mHL0iHCq3JlWUtQpkAN51MZ1f2ZLvm/89h+yGzt5ObEK1qh1hPS9cMIZvF DtTg== MIME-Version: 1.0 X-Received: by 10.50.137.99 with SMTP id qh3mr1450802igb.7.1421194347100; Tue, 13 Jan 2015 16:12:27 -0800 (PST) Received: by 10.50.225.141 with HTTP; Tue, 13 Jan 2015 16:12:27 -0800 (PST) In-Reply-To: References: <54B5AA4C.7050307@FreeBSD.org> Date: Tue, 13 Jan 2015 16:12:27 -0800 Message-ID: Subject: Re: Devops question: freebsd-update needs a real tty to run, problem for automation From: NGie Cooper To: Bryan Drewery Content-Type: text/plain; charset=UTF-8 Cc: Craig Rodrigues , Ahmed Kamal , freebsd-current Current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jan 2015 00:12:28 -0000 On Tue, Jan 13, 2015 at 4:09 PM, NGie Cooper wrote: > On Tue, Jan 13, 2015 at 3:29 PM, Bryan Drewery wrote: >> On 1/13/2015 5:11 PM, Craig Rodrigues wrote: >>> Hi, >>> >>> Ahmed Kamal, a devops expert, is helping me to script the steps to >>> upgrade a cluster of FreeBSD machines. For certain machines, >>> we want to track the official FreeBSD releases and use freebsd-update >>> to install official updates. >>> >>> We found that when the invocation of freebsd-update was scripted >>> and not run via a real tty, we can into this error: >>> >>> "freebsd-update fetch should not be run non-interactively." >>> >>> There are various workarounds mentioned on various web pages. >>> However, should we modify freebsd-update so that it can work better >>> when not run via a real tty? This would make it more devops/automation >>> friendly. >>> >>> The closest thing I have found is "freebsd-update cron", which can fetch >>> the updates and run without a real tty. The only problem with >>> "freebsd-update cron" >>> is that it sleeps a random amount of time between 1 and 3600 seconds before >>> fetching the updates. This is OK when run in a cron job, >>> but not OK when run as part of a devops automation framework. >>> >>> Anybody have ideas as to the best way to proceed in fixing this in >>> freebsd-update? >>> -- >>> Craig >> >> >> sed -i '' -e 's,-t 0 ];,-t 0 ] \&\& [ 0 -eq 1 ],' /usr/sbin/freebsd-update >> >> This is untested. We'll likely put it in Poudriere as well. > > freebsd-update needs to grow a non-interactive option probably: > > 2375 read dummy 2376 ${EDITOR} `pwd`/merge/new/${F} < /dev/tty > 2377 done < failed.merges > 2378 rm failed.merges $ grep -nr /dev/tty `which freebsd-update` 2375: read dummy