From: Michael Wood <michael.g.wood@intel.com>
To: Elliot Smith <elliot.smith@intel.com>,
"toaster@yoctoproject.org" <toaster@yoctoproject.org>
Subject: Re: [review-request][PATCH 1/3] toaster: Always run bldcontrol migrations
Date: Fri, 9 Oct 2015 14:35:05 +0100 [thread overview]
Message-ID: <5617C289.4030407@intel.com> (raw)
In-Reply-To: <1443624857-7745-2-git-send-email-elliot.smith@intel.com>
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 <elliot.smith@intel.com>
> ---
> 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" </dev/null >>${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" </dev/null >>${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
next prev parent reply other threads:[~2015-10-09 13:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 14:54 [review-request][PATCH 0/3][v3] Fix errors thrown when viewing command line builds while build is running Elliot Smith
2015-09-30 14:54 ` [review-request][PATCH 1/3] toaster: Always run bldcontrol migrations Elliot Smith
2015-10-09 13:35 ` Michael Wood [this message]
2015-10-13 12:02 ` Smith, Elliot
2015-09-30 14:54 ` [review-request][PATCH 2/3] toaster: Check whether buildrequest exists before using it Elliot Smith
2015-09-30 14:54 ` [review-request][PATCH 3/3] toaster: Test that exception isn't thrown by project page Elliot Smith
2015-10-09 11:36 ` [review-request][PATCH 0/3][v3] Fix errors thrown when viewing command line builds while build is running Smith, Elliot
-- strict thread matches above, loose matches on Subject: below --
2015-09-22 16:41 [review-request][PATCH 0/3] Fix error thrown by "command line builds" project page Elliot Smith
2015-09-22 16:41 ` [review-request][PATCH 1/3] toaster: Always run bldcontrol migrations Elliot Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5617C289.4030407@intel.com \
--to=michael.g.wood@intel.com \
--cc=elliot.smith@intel.com \
--cc=toaster@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.