Changeset 597

Show
Ignore:
Timestamp:
03/29/07 15:30:13 (2 years ago)
Author:
sacha
Message:

permissions issues. changing permission on log files so non root user can write to it.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bin/applications/nightly_build_test_infrastructure/chroot.rb

    r595 r597  
    6060    @logger.info "  release:      #{@release}" 
    6161    @logger.info "  architecture: #{@arch}" 
     62    @logger.info "  log_file:     #{@log_file}" 
    6263 
    6364    run "#{@sudo}mkdir #{@complete_path}" 
    64     run "#{@sudo}debootstrap #{@release} #{@complete_path} http://ftp.debian.org/debian/  >> #{@log_file}" 
     65    run "#{@sudo}touch \"#{@log_file}\"" 
     66    run "#{@sudo}chmod 777 \"#{@log_file}\"" 
     67    run "#{@sudo}debootstrap #{@release} #{@complete_path} http://ftp.debian.org/debian/  >> \"#{@log_file}\"" 
    6568    run "#{@sudo}cp /etc/fstab /root/fstab.orig" 
    6669    run "#{@sudo}echo \"/proc #{@complete_path}/proc proc defaults 0 0\" >> /etc/fstab" 
     
    8083  # to ask for trusting the certificate). 
    8184  def install_subversion_and_add_ssl_certificate havanawave_certificate 
    82     run "#{@sudo}chroot #{@complete_path} apt-get update >> #{@log_file}
    83     run "#{@sudo}chroot #{@complete_path} apt-get -y install subversion >> #{@log_file}
     85    run "#{@sudo}chroot #{@complete_path} apt-get update >> \"#{@log_file}\"
     86    run "#{@sudo}chroot #{@complete_path} apt-get -y install subversion >> \"#{@log_file}\"
    8487    run "#{@sudo}cp #{havanawave_certificate} #{@complete_path}/root/" 
    8588    run "#{@sudo}echo \"ssl-authority-files = /root/#{File.basename havanawave_certificate}\" >> #{@complete_path}/etc/subversion/servers" 
     
    8891  # This method copies the HefeWeizen installation script 
    8992  def get_hefeweizen_installation_script command 
    90     run "#{@sudo}chroot #{@complete_path} #{command} >> #{@log_file}
     93    run "#{@sudo}chroot #{@complete_path} #{command} >> \"#{@log_file}\"
    9194  end 
    9295 
    9396  # This method runs the HefeWeizen installation inside the chroot. 
    9497  def run_hefeweizen_installation 
    95     run "#{@sudo}chroot #{@complete_path} sh hefeweizen-installation.sh  >> #{@log_file}
     98    run "#{@sudo}chroot #{@complete_path} sh hefeweizen-installation.sh  >> \"#{@log_file}\"
    9699  end 
    97100 
     
    104107  # This mehtod starts the HefeWeizen system 
    105108  def start_hefeweizen 
    106     run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-hefeweizen.sh & >> #{@log_file}
     109    run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-hefeweizen.sh & >> \"#{@log_file}\"
    107110  end 
    108111 
    109112  # This method starts the HefeWeizen Test system 
    110113  def start_tester 
    111     run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-tester.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin >> #{@log_file}
     114    run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-tester.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin >> \"#{@log_file}\"
    112115  end 
    113116   
    114117  # This method stops the HefeWeizen sytem. 
    115118  def stop_hefeweizen 
    116     run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/stop-hefeweizen.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/ >> #{@log_file}
     119    run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/stop-hefeweizen.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/ >> \"#{@log_file}\"
    117120  end 
    118121   
     
    138141    system command 
    139142    if $? != 0 then 
    140       raise Exception.new "Error executing command '#{command}'" 
     143      raise Exception.new( "Error executing command '#{command}'" ) 
    141144    end 
    142145  end 
  • trunk/bin/applications/nightly_build_test_infrastructure/hefeweizen-test-system.rb

    r596 r597  
    6262    @use_sudo = sudo 
    6363    @target_path = target_path 
    64     FileUtils.mkdir_p "#{@target_path}/#{CHROOT_PATH}" unless FileTest.exists? "#{@target_path}/#{CHROOT_PATH}" 
    65     FileUtils.mkdir_p "#{@target_path}/#{RESULTS_PATH}" unless FileTest.exists? "#{@target_path}/#{RESULTS_PATH}" 
    6664  end 
    6765 
     
    8280      path = chroot.create 
    8381      @logger.info "Created new chroot with the name '#{chroot_name}' at the following path: #{path}" 
    84  
    85        
    86  
    8782      @logger.info "Installing subversion and setting up ssl certificate" 
    8883      if FileTest.exists? "./havanawave.pem" then 
    8984        chroot.install_subversion_and_add_ssl_certificate "./havanawave.pem" # "/home/sacha/project/havanawave.pem" 
    9085      else 
    91         raise Exception.new "Unable to locate 'havanawave.pem' public server certificate" 
     86        raise Exception.new( "Unable to locate 'havanawave.pem' public server certificate" ) 
    9287      end 
    9388 
     
    157152 
    158153time_start = Time.now 
    159 log_file = "#{options.path}/#{RESULTS_PATH}/hefeweizen-test-system-#{time_start.to_f}_#{time_start.to_s.gsub(/ /, "_")}.log" 
    160 @logger = Logger.new(log_file) 
    161 @logger.level = Logger::DEBUG 
    162154 
    163 @logger.info "HefeWeizen CHROOT Test System" 
    164 @logger.info "Path to install: #{options.path}" 
     155begin 
     156  sudo = options.sudo == true ? "sudo " : "" 
     157  system "#{sudo}mkdir -p \"#{options.path}/#{CHROOT_PATH}\"" unless FileTest.exists? "#{options.path}/#{CHROOT_PATH}" 
     158  system "#{sudo}mkdir -p \"#{options.path}/#{RESULTS_PATH}\"" unless FileTest.exists? "#{options.path}/#{RESULTS_PATH}" 
     159  log_file = "#{options.path}/#{RESULTS_PATH}/hefeweizen-test-system-#{time_start.to_f}_#{time_start.to_s.gsub(/ /, "_")}.log" 
     160  system "#{sudo}touch \"#{log_file}\"" 
     161  system "#{sudo}chmod 777 \"#{log_file}\"" 
    165162 
    166 time_start = Time.now 
    167 @logger.info "Time start: #{time_start}" 
    168 result = HefeWeizenTester.new(options.path, options.sudo, @logger).run 
    169 time_end = Time.now 
    170 @logger.info "Time end: #{time_end}" 
    171 @logger.info "-> total time: #{time_end - time_start}" 
     163  @logger = Logger.new(log_file) 
     164  @logger.level = Logger::DEBUG 
     165  @logger.info "HefeWeizen CHROOT Test System" 
     166  @logger.info "Path to install: #{options.path}" 
     167   
     168  time_start = Time.now 
     169  @logger.info "Time start: #{time_start}" 
     170  result = HefeWeizenTester.new(options.path, options.sudo, @logger).run 
     171  time_end = Time.now 
     172  @logger.info "Time end: #{time_end}" 
     173  @logger.info "-> total time: #{time_end - time_start}" 
     174   
     175  @logger.error "Error" if result != 0 
     176   
     177  exit result 
     178   
     179rescue Exception => e 
     180  $stderr.puts "Exception: #{e.to_s}" 
     181  $stderr.puts "Exception details: #{e.inspect}" 
     182  exit -1 
     183end 
    172184 
    173 @logger.error "Error" if result != 0 
    174  
    175 exit result