[Ovirt-devel] Re: [PATCH] ovirt / autobuild integration

Mohammed Morsi mmorsi at redhat.com
Mon Jul 28 18:46:13 UTC 2008


Alan Pevec wrote:
> From: Mohammed Morsi <mmorsi at redhat.com>
>
> ---
>  autobuild.sh                           |   73 +++++++++++++++++++++++++++++--
>  wui-appliance/common-pkgs.ks           |    1 +
>  wui/src/app/controllers/application.rb |    6 ++-
>  3 files changed, 74 insertions(+), 6 deletions(-)
>
> diff --git a/autobuild.sh b/autobuild.sh
> index ccae050..4e67200 100755
> --- a/autobuild.sh
> +++ b/autobuild.sh
> @@ -1,6 +1,69 @@
> -#oVirt wui autobuild script
> +#oVirt autobuild script
> +#
> +# Copyright (C) 2008 Red Hat, Inc.
> +# Written by Mohammed Morsi <mmorsi at redhat.com>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; version 2 of the License.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA  02110-1301, USA.  A copy of the GNU General Public License is
> +# also available at http://www.gnu.org/copyleft/gpl.html.
> +#
> +# NOTE StrictHostKeyChecking must be set to "no" in /etc/ssh/sshd_config for this to work
>  
> -#run tests
> -cd wui/src/
> -rake db:migrate
> -rake test
> +echo "Running oVirt Autobuild"
> +
> +ssh_cmd="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root at 192.168.50.2"
> +
> +# implant local ssh key into appliance for autobuild only
> +if [ ! -e ~/.ssh/id_rsa.pub ]; then
> +  ssh-keygen -t rsa
> +fi
>   
Doesn't ssh-keygen prompt you for a passphrase? If so we won't be able 
to use it in the automated autobuild script.
> +git checkout wui-appliance/common-post.ks
>   
Why are you re-checking out a file here? Autobuild should take care of 
all that for us.
> +cat >> wui-appliance/common-post.ks << \KS
> +mkdir -p /root/.ssh/
> +chmod 700 /root/.ssh/
> +cat > /root/.ssh/authorized_keys << \EOF
> +KS
> +cat ~/.ssh/id_rsa.pub >> wui-appliance/common-post.ks
> +cat >> wui-appliance/common-post.ks << \KS
> +EOF
> +chmod 600 /root/.ssh/authorized_keys
> +KS
> +# move sshd to start last
> +cat >> wui-appliance/common-post.ks << \KS
> +mkdir -p /etc/chkconfig.d/
> +cat > /etc/chkconfig.d/sshd << \EOF
> +# chkconfig: 2345 99 01
> +EOF
> +chkconfig --override sshd
> +KS
>   
I like the idea of generating a new key each time and just using that 
instead of a fixed key, but my only concerns stems from the case where 
the existing keys on the build server are being used by something else 
and overwritten, and the fact that we're generating the kickstart 
contents on the fly when we could simply just add it the changes to the 
repo.
> +
> +# create appliance
> +./build-all.sh -ac
> +
> +# start appliance
> +virsh start ovirt-appliance
> +
> +# wait until started
> +while : ; do
> +   $ssh_cmd "exit"
> +   if [ $? -eq 0 ]; then
> +      break
> +   fi
> +   sleep 10
> +done
> +
> +echo "Running the wui tests"
> +$ssh_cmd \
> +    "curl -i --negotiate -u : management.priv.ovirt.org/ovirt/ | grep \"HTTP/1.1 200 OK\" && \
> +     cd /usr/share/ovirt-wui/ && rake test"
> diff --git a/wui-appliance/common-pkgs.ks b/wui-appliance/common-pkgs.ks
> index 7a8866c..5688308 100644
> --- a/wui-appliance/common-pkgs.ks
> +++ b/wui-appliance/common-pkgs.ks
> @@ -25,3 +25,4 @@ cobbler
>  bind-utils
>  augeas
>  /usr/sbin/lokkit
> +curl
> diff --git a/wui/src/app/controllers/application.rb b/wui/src/app/controllers/application.rb
> index aa8fd7c..eacf6f3 100644
> --- a/wui/src/app/controllers/application.rb
> +++ b/wui/src/app/controllers/application.rb
> @@ -34,7 +34,11 @@ class ApplicationController < ActionController::Base
>    before_filter :authorize_admin, :only => [:new, :create, :edit, :update, :destroy]
>  
>    def get_login_user
> -    user_from_principal(request.env["HTTP_X_FORWARDED_USER"])
> +    if ENV["RAILS_ENV"] != 'test'
> +        user_from_principal(request.env["HTTP_X_FORWARDED_USER"])
> +    else
> +        'ovirtadmin'
> +    end
>    end
>    
>    def user_from_principal(principal)
>   




More information about the ovirt-devel mailing list