From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id D0D90E00C0E; Fri, 9 Oct 2015 06:35:11 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.220.44 listed in list.dnswl.org] Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 8F91CE0086D for ; Fri, 9 Oct 2015 06:35:08 -0700 (PDT) Received: by padhy16 with SMTP id hy16so87240119pad.1 for ; Fri, 09 Oct 2015 06:35:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=1kGX+GjAuSZICoQC+hbl8fJGKDiXQio/+DcdI9NQGdA=; b=bFINv+eMUl6qGJc7o0v1vwsSQpgC/7TXVleAhAA0mA9yHXLlmt3NJ84WDB81I+/O// KCTtMD0yAd/HA4N0fzyv++fEyPubf8TePDyQkVNHDFhjxE1j4xfeHjg8cflh8IpZ6fZC MZLWyEEYMY0ZzPmOm8jzCpkXCXZNHcN4SzSoA9BZlmmWUv1A7D+8gc0912Ggwm5/+dBj kOLmTC6Y644wDFdOj/HluVAJLktdr/aqnhKLvGgx5AZGL+uBMkIFn24Yenb9/odLYKVL 1YXgi/8sOJzAyveXyEHs3vVp1c1kOxAicvkId5zCjmDrEp649hZK5R60kFMgBnjVaxpE 9gog== X-Gm-Message-State: ALoCoQm1OGy/kn00w32Rr6hon4BPBjW6JEfALwHyKs6KSM8pMDBufRxIPPvhaWLtvbvY6R2K8VIA X-Received: by 10.68.137.202 with SMTP id qk10mr15555387pbb.30.1444397708308; Fri, 09 Oct 2015 06:35:08 -0700 (PDT) Received: from [192.168.0.21] ([2.218.205.118]) by smtp.googlemail.com with ESMTPSA id or9sm1459981pbb.17.2015.10.09.06.35.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Oct 2015 06:35:07 -0700 (PDT) To: Elliot Smith , "toaster@yoctoproject.org" References: <1443624857-7745-1-git-send-email-elliot.smith@intel.com> <1443624857-7745-2-git-send-email-elliot.smith@intel.com> From: Michael Wood Message-ID: <5617C289.4030407@intel.com> Date: Fri, 9 Oct 2015 14:35:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1443624857-7745-2-git-send-email-elliot.smith@intel.com> Subject: Re: [review-request][PATCH 1/3] toaster: Always run bldcontrol migrations X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2015 13:35:11 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 30/09/15 15:54, Elliot Smith wrote: > The toaster startup script conditionally migrates the database > tables depending on whether you are in managed mode or not. This > means that if you are in analysis mode, some of the bldcontrol* > database tables used by managed mode are not available. > > As a consequence, some of the code in toaster which refers to > those tables can break in analysis mode, as there's no clean > isolation of the two modes. > > To prevent this from happening, always run the migrations for > managed mode and create the bldcontrol* tables, even if in > analysis mode. > > Also clean up the function which starts up toaster so the > logic is easier to follow. > > [YOCTO #8277] > > Signed-off-by: Elliot Smith > --- > bitbake/bin/toaster | 58 +++++++++++++++++++++++++++++++++++------------------ > 1 file changed, 39 insertions(+), 19 deletions(-) > > diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster > index ac27826..05dabc9 100755 > --- a/bitbake/bin/toaster > +++ b/bitbake/bin/toaster > @@ -54,35 +54,55 @@ webserverStartAll() > fi > > retval=0 > - if [ "$TOASTER_MANAGED" '=' '1' ]; then > + if [ "$TOASTER_MANAGED" = '1' ]; then > python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1 > else > python $BBBASEDIR/lib/toaster/manage.py syncdb --noinput || retval=1 > fi > - python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=2 > + > if [ $retval -eq 1 ]; then > - echo "Failed db sync, stopping system start" 1>&2 > - elif [ $retval -eq 2 ]; then > - printf "\nError on migration, trying to recover... \n" > + echo "Failed db sync, aborting system start" 1>&2 > + return $retval > + fi > + > + python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1 > + > + if [ $retval -eq 1 ]; then > + printf "\nError on orm migration, rolling back...\n" > python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial --fake > - retval=0 > - python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1 > + return $retval > fi > + > + python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1 > + > + if [ $retval -eq 1 ]; then > + printf "\nError on bldcontrol migration, rolling back...\n" > + python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol 0001_initial --fake > + return $retval > + fi > + > if [ "$TOASTER_MANAGED" = '1' ]; then > - python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1 > - python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 > + python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 > fi > - if [ $retval -eq 0 ]; then > - echo "Starting webserver..." > - python $BBBASEDIR/lib/toaster/manage.py runserver "0.0.0.0:$WEB_PORT" >${BUILDDIR}/toaster_web.log 2>&1 & echo $! >${BUILDDIR}/.toastermain.pid > - sleep 1 > - if ! cat "${BUILDDIR}/.toastermain.pid" | xargs -I{} kill -0 {} ; then > - retval=1 > - rm "${BUILDDIR}/.toastermain.pid" > - else > - echo "Webserver address: http://0.0.0.0:$WEB_PORT/" > - fi > + > + if [ $retval -eq 1 ]; then > + printf "\nError while checking settings; aborting\n" > + return $retval > + fi > + > + echo "Starting webserver..." > + > + python $BBBASEDIR/lib/toaster/manage.py runserver "0.0.0.0:$WEB_PORT" >${BUILDDIR}/toaster_web.log 2>&1 & echo $! >${BUILDDIR}/.toastermain.pid > + > + sleep 1 > + > + if ! cat "${BUILDDIR}/.toastermain.pid" | xargs -I{} kill -0 {} ; then > + retval=1 > + rm "${BUILDDIR}/.toastermain.pid" > + else > + echo "Webserver address: http://0.0.0.0:$WEB_PORT/" > fi > + > return $retval > } > If you want to run all migrations we can do just do ./manage migrate --all