Changeset 573

Show
Ignore:
Timestamp:
03/27/07 07:13:55 (2 years ago)
Author:
sacha
Message:

jump straight into dynamic menu of selecting party and CPA.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bin/run-command-center.rb

    r541 r573  
    181181  puts "                       PARTY  :: #{party_name}           CPA ID :: #{cpa_id}" 
    182182  puts "" 
    183   puts "D - Directive Menu     S - Show Statistics       T - Top program   P - Processes    Q - Quit" 
     183  puts "D - Main Men           S - Show Statistics       T - Top program   P - Processes    Q - Quit" 
    184184  puts "L - Payload Size (#{payload_size})" 
    185185  puts "N - number of directives: #{number_directives}   R - Resends (after seconds): #{resend_interval}" 
    186   puts "K - Show kids          KA - Kill all kids" 
     186  puts "K - Show kids          K <Process Id> - Kill process           KA - Kill all kids" 
    187187  puts "C - clear systems" 
    188188  puts "" 
     
    227227end 
    228228 
    229 def work_directive_dynamic_menu party_name, cpas_info, number_directives, payload_size, resend_interval 
     229def work_directive_dynamic_menu party_name, cpas_info, number_directives = 1, payload_size = "small", resend_interval = 0 
    230230  cpas_command = get_cpas_command cpas_info 
    231   directive_dynamic_menu party_name, cpas_info.first['cpa_id'], cpas_command, nil, nil, number_directives, resend_interval 
     231  directive_dynamic_menu party_name, cpas_info.first['cpa_id'], cpas_command, nil, nil, number_directives, payload_size, resend_interval 
    232232  children = Array.new 
    233233 
     
    357357end 
    358358 
    359 def directive_menu previous = nil, output = nil, number_directives = 1 
    360   puts "                           HefeWeizen Main Directive Menu" 
    361   puts "-------------------------------------------------------------------------------" 
    362   puts "M - Main Menu         S - Show Statistics       T - Top program       Q - Quit" 
    363   puts "" 
    364   puts "D - dynamic directives!" 
    365   puts "N - set number of directives to copy. currently: #{number_directives}" 
    366   puts "C - clear systems" 
    367   puts "" 
    368   puts "1 - ping from Coronation to Gnaraloo" 
    369   puts "2 - payload from Coronation to Gnaraloo" 
    370   puts "" 
    371   puts "8 - ping from Coronation to webswell connect" 
    372   puts "9 - payload from Coronation to webswell connect" 
    373   puts "-------------------------------------------------------------------------------" 
    374   puts "please select ..." 
    375   if !previous.nil? then 
    376     puts "previous selection '#{previous}'" 
    377     if !output.nil? then 
    378       puts "==========================output==================================" 
    379       puts output 
    380       puts "==================================================================" 
    381     end 
    382   end 
    383 end 
    384  
    385359def work_directive_menu 
    386360  directive_menu 
     
    393367    input = gets.chomp.upcase 
    394368    case input 
    395     when "M" 
    396       return 
    397     when "D" 
    398  
    399       party_path, party_name, cpa_path = get_party_and_cpa 
    400       system "clear" 
    401  
    402       cpa_filename = cpa_path 
    403  
    404       require "#{@config['LIB_DIR']}/hefeweizen_library_cpa" 
    405       cpa = HefeWeizen::HefeWeizenLibrary::CPA.create(cpa_filename, @config) 
    406  
    407       party_identities = load_identities party_path 
    408  
    409       cpas_info = [cpa.setup_all_ebMS_header_infos( cpa.id, party_name, party_identities )] 
    410       cpas_info.first['cpa_id'] = cpa.id 
    411       number_directives, resend_interval = work_directive_dynamic_menu party_name, cpas_info, number_directives, payload_size, resend_interval 
    412     when "S" 
    413       output = %x(sh ./run-statistics.sh Coronation Gnaraloo) 
    414     when "1" 
    415       command = "sh ./run-copy-ping-directive-n.sh #{number_directives || 1} &" 
    416       system command 
    417       output = "sent command: #{command}" 
    418     when "2" 
    419       command = "sh ./run-copy-directive-n.sh #{number_directives || 1} &" 
    420       system command 
    421       output = "sent command: #{command}" 
    422     when "8" 
    423       command = "sh ./run-copy-ping-gnaraloo-wc-directive-n.sh #{number_directives || 1} &" 
    424       system command 
    425       output = "sent command: #{command}" 
    426     when "9" 
    427       command = "sh ./run-copy-gnaraloo-wc-directive-n.sh #{number_directives || 1} &" 
    428       system command 
    429       output = "sent command: #{command}" 
    430     when "N" 
    431       puts "Enter value: " 
    432       begin 
    433         value = gets.chomp.upcase.to_i 
    434         number_directives = value 
    435       rescue 
    436         output "Unable to understand. Set number to 1" 
    437         number_directives = 1 
    438       end 
    439     when "C" 
    440       command = "sh ./run-clear-system.sh" 
    441       system command 
    442       output = "sent command: #{command}" 
    443     when "T" 
    444       system "top -d 0.7" 
    445       output = "back" 
    446369    when "Q" 
    447370      puts "exitting." 
    448371      exit 0 
    449     when "H" 
    450       puts "HAPPY" 
    451372    end 
    452373    system "clear" 
     
    536457  puts "" 
    537458  puts "Options:" 
    538   puts "S - Show statistics" 
    539   puts "D - Create directive" 
    540   puts "I - Infrastructure" 
     459  puts "P - Select Party" 
     460  puts "I - Infrastructure (not implemented yet)" 
    541461  puts "Q - QUIT" 
    542462  puts "" 
     
    554474def work_main_menu 
    555475  main_menu 
     476 
    556477  while true do  
    557478    output = nil 
    558479    input = gets.chomp.upcase 
    559480    case input 
     481    when "P" 
     482      number_directives = 1 
     483      resend_interval = 0 
     484      payload_size = "small" 
     485 
     486      party_path, party_name, cpa_path = get_party_and_cpa 
     487      system "clear" 
     488 
     489      cpa_filename = cpa_path 
     490      require "#{@config['LIB_DIR']}/hefeweizen_library_cpa" 
     491      cpa = HefeWeizen::HefeWeizenLibrary::CPA.create(cpa_filename, @config) 
     492 
     493      party_identities = load_identities party_path 
     494 
     495      cpas_info = [cpa.setup_all_ebMS_header_infos( cpa.id, party_name, party_identities )] 
     496      cpas_info.first['cpa_id'] = cpa.id 
     497      number_directives, resend_interval = work_directive_dynamic_menu party_name, cpas_info, number_directives, payload_size, resend_interval 
    560498    when "Q" 
    561499      puts "exitting." 
     
    564502      puts "Statistics" 
    565503      output = %x(sh ./run-statistics.sh Coronation Gnaraloo) 
    566     when "D" 
    567       system "clear" 
    568       work_directive_menu 
    569504    when "I" 
    570505      output = <<EOF