From: <jh...@us...> - 2011-05-04 22:13:13
|
Revision: 283 http://etch.svn.sourceforge.net/etch/?rev=283&view=rev Author: jheiss Date: 2011-05-04 22:13:07 +0000 (Wed, 04 May 2011) Log Message: ----------- Update to reflect server directory structure changes Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2011-05-04 22:11:29 UTC (rev 282) +++ trunk/client/lib/etch/client.rb 2011-05-04 22:13:07 UTC (rev 283) @@ -3,8 +3,8 @@ ############################################################################## # Ensure we can find etch.rb if run within the development directory structure -# This is roughly equivalent to "../server/lib" -serverlibdir = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'server', 'lib') +# This is roughly equivalent to "../../../server/lib" +serverlibdir = File.join(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))), 'server', 'lib') if File.exist?(serverlibdir) $:.unshift(serverlibdir) end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2011-07-07 22:52:48
|
Revision: 293 http://etch.svn.sourceforge.net/etch/?rev=293&view=rev Author: thepob Date: 2011-07-07 22:52:42 +0000 (Thu, 07 Jul 2011) Log Message: ----------- updating client so fact values are converted to strings as they are done in client/server mode - ticket 16 Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2011-06-01 16:39:39 UTC (rev 292) +++ trunk/client/lib/etch/client.rb 2011-07-07 22:52:42 UTC (rev 293) @@ -169,6 +169,10 @@ else dlogger.level = Logger::INFO end + blankrequest = {} + @facts.each_pair { |key, value| blankrequest[key] = value.to_s } + blankrequest['fqdn'] = @facts['fqdn'] + @facts = blankrequest @etch = Etch.new(logger, dlogger) else # Make sure the server URL ends in a / so that we can append paths This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-03-18 15:28:50
|
Revision: 307 http://etch.svn.sourceforge.net/etch/?rev=307&view=rev Author: jheiss Date: 2012-03-18 15:28:44 +0000 (Sun, 18 Mar 2012) Log Message: ----------- ticket:14 Increase output capture timeout in interactive mode. >From the ticket: The output capture timeout causes the interactive mode prompt to timeout and fail after a few minutes. I often need to leave an interactive prompt for a few minutes while I research something. Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-03-03 16:21:43 UTC (rev 306) +++ trunk/client/lib/etch/client.rb 2012-03-18 15:28:44 UTC (rev 307) @@ -2452,6 +2452,8 @@ # for etch to handle any given file, including running any # setup/pre/post commands. OUTPUT_CAPTURE_TIMEOUT = 5 * 60 + # In interactive mode bump the timeout up to something absurdly large + OUTPUT_CAPTURE_INTERACTIVE_TIMEOUT = 14 * 24 * 60 * 60 def start_output_capture # Establish a pipe, spawn a child process, and redirect stdout/stderr # to the pipe. The child gathers up anything sent over the pipe and @@ -2503,7 +2505,13 @@ # capturing feature this results in etch hanging around forever # waiting for the pipes to close. We time out after a suitable # period of time so that etch processes don't hang around forever. - Timeout.timeout(OUTPUT_CAPTURE_TIMEOUT) do + timeout = nil + if @interactive + timeout = OUTPUT_CAPTURE_INTERACTIVE_TIMEOUT + else + timeout = OUTPUT_CAPTURE_TIMEOUT + end + Timeout.timeout(timeout) do while char = pread.getc putc(char) output << char.chr This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sal...@us...> - 2012-03-21 21:12:38
|
Revision: 311 http://etch.svn.sourceforge.net/etch/?rev=311&view=rev Author: saltmanm Date: 2012-03-21 21:12:32 +0000 (Wed, 21 Mar 2012) Log Message: ----------- Show the ArgumentError messages only when in debug mode. Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-03-19 14:39:16 UTC (rev 310) +++ trunk/client/lib/etch/client.rb 2012-03-21 21:12:32 UTC (rev 311) @@ -2250,7 +2250,7 @@ pw = Etc.getpwnam(user) uid = pw.uid rescue ArgumentError - puts "config.xml requests user #{user}, but that user can't be found. Using UID 0." + puts "config.xml requests user #{user}, but that user can't be found. Using UID 0." if @debug uid = 0 end end @@ -2270,7 +2270,7 @@ gr = Etc.getgrnam(group) gid = gr.gid rescue ArgumentError - puts "config.xml requests group #{group}, but that group can't be found. Using GID 0." + puts "config.xml requests group #{group}, but that group can't be found. Using GID 0." if @debug gid = 0 end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-27 01:59:32
|
Revision: 329 http://etch.svn.sourceforge.net/etch/?rev=329&view=rev Author: jheiss Date: 2012-04-27 01:59:26 +0000 (Fri, 27 Apr 2012) Log Message: ----------- Store @results as a hash so that we only capture the last result for each individual file. This eliminates a bunch of empty and misleading results for files from handling need_sum or need_orig requests. We only want to capture the last result where the contents of the file are handled. If ruby >= 1.9 then specify encoding options to the pipes used for output capturing. Otherwise we may end up capturing non-UTF-8 output and sending it to the server as UTF-8, which causes the server to error out. Minor cleanup in lock_file to eliminate a warning about an unused variable. Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-04-27 01:50:53 UTC (rev 328) +++ trunk/client/lib/etch/client.rb 2012-04-27 01:59:26 UTC (rev 329) @@ -204,7 +204,7 @@ @already_processed = {} @exec_already_processed = {} @exec_once_per_run = {} - @results = [] + @results = {} # See start/stop_output_capture for these @output_pipes = [] @@ -521,11 +521,11 @@ rails_results << "status=#{CGI.escape(status.to_s)}" rails_results << "message=#{CGI.escape(message)}" if @detailed_results.include?('SERVER') - @results.each do |result| + @results.each do |file, result| # Strangely enough this works. Even though the key is not unique to # each result the Rails parameter parsing code keeps track of keys it # has seen, and if it sees a duplicate it starts a new hash. - rails_results << "results[][file]=#{CGI.escape(result['file'])}" + rails_results << "results[][file]=#{CGI.escape(file)}" rails_results << "results[][success]=#{CGI.escape(result['success'].to_s)}" rails_results << "results[][message]=#{CGI.escape(result['message'])}" end @@ -563,8 +563,8 @@ file.puts "Message:\n#{message}\n" end # Then the detailed results - @results.each do |result| - file.puts "File #{result['file']}, result #{result['success']}:\n" + @results.each do |resultfile, result| + file.puts "File #{resultfile}, result #{result['success']}:\n" file.puts result['message'] end end @@ -621,7 +621,6 @@ # Prep the results capturing for this file result = {} - result['file'] = file result['success'] = true result['message'] = '' @@ -1504,7 +1503,7 @@ end result['message'] << output if save_results - @results << result + @results[file] = result end if exception @@ -1542,7 +1541,6 @@ # Prep the results capturing for this command result = {} - result['file'] = commandname result['success'] = true result['message'] = '' @@ -1637,7 +1635,7 @@ end result['message'] << output if save_results - @results << result + @results[commandname] = result end if exception @@ -2384,9 +2382,9 @@ # Make 30 attempts (1s sleep after each attempt) 30.times do |i| begin - fd = IO::sysopen(lockpath, Fcntl::O_WRONLY|Fcntl::O_CREAT|Fcntl::O_EXCL) + fd = File.sysopen(lockpath, Fcntl::O_WRONLY|Fcntl::O_CREAT|Fcntl::O_EXCL) puts "Lock acquired for #{file}" if (@debug) - f = IO.open(fd) { |lockfile| lockfile.puts $$ } + File.open(fd) { |lockfile| lockfile.puts $$ } @locked_files[file] = true return rescue Errno::EEXIST @@ -2459,8 +2457,14 @@ # to the pipe. The child gathers up anything sent over the pipe and # when we close the pipe later it sends the captured output back to us # over a second pipe. - pread, pwrite = IO.pipe - oread, owrite = IO.pipe + pread = pwrite = oread = owrite = nil + if RUBY_VERSION.split('.')[0..1].join('.').to_f >= 1.9 + pread, pwrite = IO.pipe(Encoding.default_external, 'UTF-8', :invalid => :replace, :undef => :replace) + oread, owrite = IO.pipe(Encoding.default_external, 'UTF-8', :invalid => :replace, :undef => :replace) + else + pread, pwrite = IO.pipe + oread, owrite = IO.pipe + end if fork # Parent pread.close This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-27 02:25:59
|
Revision: 331 http://etch.svn.sourceforge.net/etch/?rev=331&view=rev Author: jheiss Date: 2012-04-27 02:25:53 +0000 (Fri, 27 Apr 2012) Log Message: ----------- When processing commands if a guard fails then tell the user which command we're going to run to address the problem, similar to what we do when processing files. That way if the user is running in interactive mode they know what they're agreeing to have done. Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-04-27 02:00:29 UTC (rev 330) +++ trunk/client/lib/etch/client.rb 2012-04-27 02:25:53 UTC (rev 331) @@ -1591,6 +1591,9 @@ guard_result = process_guard(guard, commandname) if !guard_result + # Tell the user what we're going to do + puts "Will run command '#{command}'" + # If the user requested interactive mode ask them for # confirmation to proceed. if @interactive This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-28 02:00:35
|
Revision: 334 http://etch.svn.sourceforge.net/etch/?rev=334&view=rev Author: jheiss Date: 2012-04-28 02:00:29 +0000 (Sat, 28 Apr 2012) Log Message: ----------- Fix up get_user_confirmation so that it behaves properly Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-04-28 01:31:19 UTC (rev 333) +++ trunk/client/lib/etch/client.rb 2012-04-28 02:00:29 UTC (rev 334) @@ -2315,14 +2315,17 @@ else print "[p|s|q] " end response = $stdin.gets.chomp - if response =~ /p/i || @last_response =~ /p/i - @last_response = response if !response.strip.empty? + if response.empty? + response = @last_response + end + if response =~ /p/i + @last_response = response return CONFIRM_PROCEED - elsif response =~ /s/i || @last_response =~ /s/i - @last_response = response if !response.strip.empty? + elsif response =~ /s/i + @last_response = response return CONFIRM_SKIP - elsif response =~ /q/i || @last_response =~ /q/i - @last_response = response if !response.strip.empty? + elsif response =~ /q/i + @last_response = response return CONFIRM_QUIT end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-30 01:03:04
|
Revision: 335 http://etch.svn.sourceforge.net/etch/?rev=335&view=rev Author: jheiss Date: 2012-04-30 01:02:58 +0000 (Mon, 30 Apr 2012) Log Message: ----------- When processing dependencies we need to pay attention to the return value from process_file or process_command Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-04-28 02:00:29 UTC (rev 334) +++ trunk/client/lib/etch/client.rb 2012-04-30 01:02:58 UTC (rev 335) @@ -653,13 +653,19 @@ # Process any other files that this file depends on config.elements.each('/config/depend') do |depend| puts "Processing dependency #{depend.text}" if (@debug) - process_file(depend.text, responsedata) + continue_processing = process_file(depend.text, responsedata) + if !continue_processing + throw :process_done + end end # Process any commands that this file depends on config.elements.each('/config/dependcommand') do |dependcommand| puts "Processing command dependency #{dependcommand.text}" if (@debug) - process_commands(dependcommand.text, responsedata) + continue_processing = process_commands(dependcommand.text, responsedata) + if !continue_processing + throw :process_done + end end # See what type of action the user has requested @@ -1573,13 +1579,19 @@ # Process any other commands that this command depends on command.elements.each('/commands/depend') do |depend| puts "Processing command dependency #{depend.text}" if (@debug) - process_commands(depend.text, responsedata) + continue_processing = process_commands(depend.text, responsedata) + if !continue_processing + throw :process_done + end end # Process any files that this command depends on command.elements.each('/commands/dependfile') do |dependfile| puts "Processing file dependency #{dependfile.text}" if (@debug) - process_file(dependfile.text, responsedata) + continue_processing = process_file(dependfile.text, responsedata) + if !continue_processing + throw :process_done + end end # Perform each step This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-30 01:44:38
|
Revision: 336 http://etch.svn.sourceforge.net/etch/?rev=336&view=rev Author: jheiss Date: 2012-04-30 01:44:32 +0000 (Mon, 30 Apr 2012) Log Message: ----------- Remove the calls to unlock_all_files when the user selects quit in interactive mode. Unlocking will naturally occur as the stack of process_file and process_command calls unwinds. Fixes ticket:21 Modified Paths: -------------- trunk/client/lib/etch/client.rb Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-04-30 01:02:58 UTC (rev 335) +++ trunk/client/lib/etch/client.rb 2012-04-30 01:44:32 UTC (rev 336) @@ -839,7 +839,6 @@ save_results = false throw :process_done when CONFIRM_QUIT - unlock_all_files continue_processing = false save_results = false throw :process_done @@ -1104,7 +1103,6 @@ save_results = false throw :process_done when CONFIRM_QUIT - unlock_all_files continue_processing = false save_results = false throw :process_done @@ -1284,7 +1282,6 @@ save_results = false throw :process_done when CONFIRM_QUIT - unlock_all_files continue_processing = false save_results = false throw :process_done @@ -1409,7 +1406,6 @@ save_results = false throw :process_done when CONFIRM_QUIT - unlock_all_files continue_processing = false save_results = false throw :process_done @@ -1616,7 +1612,6 @@ save_results = false throw :process_done when CONFIRM_QUIT - unlock_all_files continue_processing = false save_results = false throw :process_done This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |