You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(3) |
Feb
(15) |
Mar
|
Apr
(9) |
May
|
Jun
(6) |
Jul
|
Aug
|
Sep
(23) |
Oct
(25) |
Nov
(44) |
Dec
(9) |
2010 |
Jan
(14) |
Feb
|
Mar
(4) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
(4) |
Sep
|
Oct
(10) |
Nov
(4) |
Dec
(22) |
2011 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
(7) |
May
(16) |
Jun
(4) |
Jul
(6) |
Aug
(3) |
Sep
|
Oct
(4) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
(10) |
Apr
(24) |
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Jason H. <jh...@ap...> - 2012-08-28 02:49:22
|
All open tickets have been moved to github https://github.com/etch/etch/issues |
From: Jason H. <jh...@ap...> - 2012-08-28 02:31:48
|
etch source code has been imported from svn to git and pushed to github: https://github.com/etch No further development should be done on the code in svn on sourceforge. If anyone with commit rights on sourceforge wants to retain them on github let me know. I'm still working on moving docs and mailing lists. |
From: Pat O'B. <obr...@gm...> - 2012-07-05 18:22:55
|
I would support a move to github -pat On Wed, Jul 4, 2012 at 8:17 AM, Jason Heiss <jh...@ap...> wrote: > I got a notification from Sourceforge that they are planning to retire > their hosted apps service, which includes the trac instance that we use for > the etch wiki and tickets. > > Apparently SF is working on a process to allow us to set up an instance of > trac in the etch project's web space. Or we could just give up on SF and > move the whole project to github. Either way all of the existing web URLs > will change. > > Any preferences? > > http://sourceforge.net/p/forge/community-docs/Hosted%20Apps%20Retirement/ > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > etch-devel mailing list > etc...@li... > https://lists.sourceforge.net/lists/listinfo/etch-devel > > |
From: Jason H. <jh...@ap...> - 2012-07-04 15:18:47
|
I got a notification from Sourceforge that they are planning to retire their hosted apps service, which includes the trac instance that we use for the etch wiki and tickets. Apparently SF is working on a process to allow us to set up an instance of trac in the etch project's web space. Or we could just give up on SF and move the whole project to github. Either way all of the existing web URLs will change. Any preferences? http://sourceforge.net/p/forge/community-docs/Hosted%20Apps%20Retirement/ |
From: <jh...@us...> - 2012-04-30 02:06:14
|
Revision: 337 http://etch.svn.sourceforge.net/etch/?rev=337&view=rev Author: jheiss Date: 2012-04-30 02:06:05 +0000 (Mon, 30 Apr 2012) Log Message: ----------- Tag 4.0.0 release Modified Paths: -------------- Rakefile tags/release-4.0.0/VERSION Added Paths: ----------- tags/release-4.0.0/ tags/release-4.0.0/client/Gemfile tags/release-4.0.0/client/Gemfile.lock tags/release-4.0.0/client/lib/etch/client.rb tags/release-4.0.0/server/ tags/release-4.0.0/server/app/assets/stylesheets/design.css tags/release-4.0.0/server/app/controllers/dashboard_controller.rb tags/release-4.0.0/server/config/initializers/session_store.rb tags/release-4.0.0/server/config/initializers/wrap_parameters.rb tags/release-4.0.0/server/lib/etch/server.rb tags/release-4.0.0/server/lib/etch.rb tags/release-4.0.0/test/TODO tags/release-4.0.0/test/etchtest.rb tags/release-4.0.0/test/test_auth.rb tags/release-4.0.0/test/test_conf.rb tags/release-4.0.0/test/test_file.rb tags/release-4.0.0/test/test_outputcapture.rb Removed Paths: ------------- tags/release-4.0.0/Gemfile tags/release-4.0.0/Gemfile.lock tags/release-4.0.0/client/lib/etch/client.rb tags/release-4.0.0/server/ tags/release-4.0.0/server/app/assets/stylesheets/design.css tags/release-4.0.0/server/app/controllers/dashboard_controller.rb tags/release-4.0.0/server/config/initializers/session_store.rb tags/release-4.0.0/server/config/initializers/wrap_parameters.rb tags/release-4.0.0/server/lib/etch/server.rb tags/release-4.0.0/server/lib/etch.rb tags/release-4.0.0/test/TODO tags/release-4.0.0/test/etchtest.rb tags/release-4.0.0/test/test_auth.rb tags/release-4.0.0/test/test_conf.rb tags/release-4.0.0/test/test_file.rb tags/release-4.0.0/test/test_outputcapture.rb Modified: Rakefile =================================================================== --- Rakefile 2012-04-30 01:44:32 UTC (rev 336) +++ Rakefile 2012-04-30 02:06:05 UTC (rev 337) @@ -1,4 +1,4 @@ -ETCHVER = '3.20.1' +ETCHVER = '4.0.0' TAGNAME = "release-#{ETCHVER}" TAGDIR = "tags/#{TAGNAME}" DIST = "etch-#{ETCHVER}" Deleted: tags/release-4.0.0/Gemfile =================================================================== --- trunk/Gemfile 2012-04-21 04:22:22 UTC (rev 315) +++ tags/release-4.0.0/Gemfile 2012-04-30 02:06:05 UTC (rev 337) @@ -1,14 +0,0 @@ -source :rubygems -gem 'facter' -gem 'nokogiri' -# Tests will be run with nokogiri by default, but it might be nice to have -# libxml available too if you want to test with it as well. -gem 'libxml-ruby' - -group :server do - gem 'rails', '2.3.14' - gem 'sqlite3' - gem 'will_paginate', '~> 2.3.15' - gem 'searchlogic' -end - Deleted: tags/release-4.0.0/Gemfile.lock =================================================================== --- trunk/Gemfile.lock 2012-04-21 04:22:22 UTC (rev 315) +++ tags/release-4.0.0/Gemfile.lock 2012-04-30 02:06:05 UTC (rev 337) @@ -1,42 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - actionmailer (2.3.14) - actionpack (= 2.3.14) - actionpack (2.3.14) - activesupport (= 2.3.14) - rack (~> 1.1.0) - activerecord (2.3.14) - activesupport (= 2.3.14) - activeresource (2.3.14) - activesupport (= 2.3.14) - activesupport (2.3.14) - facter (1.6.5) - libxml-ruby (2.2.2) - nokogiri (1.5.0) - rack (1.1.3) - rails (2.3.14) - actionmailer (= 2.3.14) - actionpack (= 2.3.14) - activerecord (= 2.3.14) - activeresource (= 2.3.14) - activesupport (= 2.3.14) - rake (>= 0.8.3) - rake (0.9.2) - searchlogic (2.5.8) - activerecord (~> 2.3.12) - activerecord (~> 2.3.12) - sqlite3 (1.3.5) - will_paginate (2.3.16) - -PLATFORMS - ruby - -DEPENDENCIES - facter - libxml-ruby - nokogiri - rails (= 2.3.14) - searchlogic - sqlite3 - will_paginate (~> 2.3.15) Modified: tags/release-4.0.0/VERSION =================================================================== --- trunk/VERSION 2012-04-21 04:22:22 UTC (rev 315) +++ tags/release-4.0.0/VERSION 2012-04-30 02:06:05 UTC (rev 337) @@ -1 +1 @@ -trunk +4.0.0 Copied: tags/release-4.0.0/client/Gemfile (from rev 323, trunk/client/Gemfile) =================================================================== --- tags/release-4.0.0/client/Gemfile (rev 0) +++ tags/release-4.0.0/client/Gemfile 2012-04-30 02:06:05 UTC (rev 337) @@ -0,0 +1,2 @@ +source :rubygems +gem 'facter' Copied: tags/release-4.0.0/client/Gemfile.lock (from rev 323, trunk/client/Gemfile.lock) =================================================================== --- tags/release-4.0.0/client/Gemfile.lock (rev 0) +++ tags/release-4.0.0/client/Gemfile.lock 2012-04-30 02:06:05 UTC (rev 337) @@ -0,0 +1,10 @@ +GEM + remote: http://rubygems.org/ + specs: + facter (1.6.5) + +PLATFORMS + ruby + +DEPENDENCIES + facter Deleted: tags/release-4.0.0/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2012-04-21 04:22:22 UTC (rev 315) +++ tags/release-4.0.0/client/lib/etch/client.rb 2012-04-30 02:06:05 UTC (rev 337) @@ -1,2583 +0,0 @@ -############################################################################## -# Etch configuration file management tool library -############################################################################## - -# 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.dirname(File.dirname(File.expand_path(__FILE__))))), 'server', 'lib') -if File.exist?(serverlibdir) - $:.unshift(serverlibdir) -end - -# Exclude standard libraries and gems from the warnings induced by -# running ruby with the -w flag. Several of these have warnings under -# ruby 1.9 and there's nothing we can do to fix that. -require 'silently' -Silently.silently do - begin - # Try loading facter w/o gems first so that we don't introduce a - # dependency on gems if it is not needed. - require 'facter' # Facter - rescue LoadError - require 'rubygems' - require 'facter' - end - require 'find' - require 'digest/sha1' # hexdigest - require 'openssl' # OpenSSL - require 'base64' # decode64, encode64 - require 'uri' - require 'net/http' - require 'net/https' - require 'rexml/document' - require 'fileutils' # copy, mkpath, rmtree - require 'fcntl' # Fcntl::O_* - require 'etc' # getpwnam, getgrnam - require 'tempfile' # Tempfile - require 'find' # Find.find - require 'cgi' - require 'timeout' - require 'logger' -end -require 'etch' - -class Etch::Client - VERSION = 'unset' - - CONFIRM_PROCEED = 1 - CONFIRM_SKIP = 2 - CONFIRM_QUIT = 3 - PRIVATE_KEY_PATHS = ["/etc/ssh/ssh_host_rsa_key", "/etc/ssh_host_rsa_key"] - DEFAULT_CONFIGDIR = '/etc' - DEFAULT_VARDIR = '/var/etch' - DEFAULT_DETAILED_RESULTS = ['SERVER'] - - # We need these in relation to the output capturing - ORIG_STDOUT = STDOUT.dup - ORIG_STDERR = STDERR.dup - - attr_reader :exec_once_per_run - - def initialize(options) - @server = options[:server] ? options[:server] : 'https://etch' - @configdir = options[:configdir] ? options[:configdir] : DEFAULT_CONFIGDIR - @vardir = options[:vardir] ? options[:vardir] : DEFAULT_VARDIR - @tag = options[:tag] - @local = options[:local] ? File.expand_path(options[:local]) : nil - @debug = options[:debug] - @dryrun = options[:dryrun] - @listfiles = options[:listfiles] - @interactive = options[:interactive] - @filenameonly = options[:filenameonly] - @fullfile = options[:fullfile] - @key = options[:key] ? options[:key] : get_private_key_path - @disableforce = options[:disableforce] - @lockforce = options[:lockforce] - - @last_response = "" - - @file_system_root = '/' # Not sure if this needs to be more portable - # This option is only intended for use by the test suite - if options[:file_system_root] - @file_system_root = options[:file_system_root] - @vardir = File.join(@file_system_root, @vardir) - @configdir = File.join(@file_system_root, @configdir) - end - - @configfile = File.join(@configdir, 'etch.conf') - @detailed_results = [] - - if File.exist?(@configfile) - IO.foreach(@configfile) do |line| - line.chomp! - next if (line =~ /^\s*$/); # Skip blank lines - next if (line =~ /^\s*#/); # Skip comments - line.strip! # Remove leading/trailing whitespace - key, value = line.split(/\s*=\s*/, 2) - if key == 'server' - # A setting for the server to use which comes from upstream - # (generally from a command line option) takes precedence - # over the config file - if !options[:server] - @server = value - # Warn the user, as this could potentially be confusing - # if they don't realize there's a config file lying - # around - warn "Using server #{@server} from #{@configfile}" if @debug - else - # "command line override" isn't necessarily accurate, we don't - # know why the caller passed us an option to override the config - # file, but most of the time it will be due to a command line - # option and I want the message to be easily understood by users. - # If someone can come up with some better wording without turning - # the message into something as long as this comment that would be - # welcome. - warn "Ignoring 'server' option in #{@configfile} due to command line override" if @debug - end - elsif key == 'local' - if !options[:local] && !options[:server] - @local = value - warn "Using local directory #{@local} from #{@configfile}" if @debug - else - warn "Ignoring 'local' option in #{@configfile} due to command line override" if @debug - end - elsif key == 'key' - if !options[:key] - @key = value - warn "Using key #{@key} from #{@configfile}" if @debug - else - warn "Ignoring 'key' option in #{@configfile} due to command line override" if @debug - end - elsif key == 'path' - ENV['PATH'] = value - elsif key == 'detailed_results' - warn "Adding detailed results destination '#{value}'" if @debug - @detailed_results << value - end - end - end - - if @key && !File.readable?(@key) - @key = nil - end - if !@key - warn "No readable private key found, messages to server will not be signed and may be rejected depending on server configuration" - end - - if @detailed_results.empty? - @detailed_results = DEFAULT_DETAILED_RESULTS - end - - @origbase = File.join(@vardir, 'orig') - @historybase = File.join(@vardir, 'history') - @lockbase = File.join(@vardir, 'locks') - @requestbase = File.join(@vardir, 'requests') - - @facts = Facter.to_hash - if @facts['operatingsystemrelease'] - # Some versions of Facter have a bug that leaves extraneous - # whitespace on this fact. Work around that with strip. I.e. on - # CentOS you'll get '5 ' or '5.2 '. - @facts['operatingsystemrelease'].strip! - end - - if @local - logger = Logger.new(STDOUT) - dlogger = Logger.new(STDOUT) - if @debug - dlogger.level = Logger::DEBUG - 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 - # to it using URI.join - if @server !~ %r{/$} - @server << '/' - end - @filesuri = URI.join(@server, 'files') - @resultsuri = URI.join(@server, 'results') - - @blankrequest = {} - # If the user specified a non-standard key then override the - # sshrsakey fact so that authentication works - if @key - @facts['sshrsakey'] = IO.read(@key+'.pub').chomp.split[1] - end - @facts.each_pair { |key, value| @blankrequest["facts[#{key}]"] = value.to_s } - @blankrequest['fqdn'] = @facts['fqdn'] - if @debug - @blankrequest['debug'] = '1' - end - if @tag - @blankrequest['tag'] = @tag - end - end - - @locked_files = {} - @first_update = {} - @already_processed = {} - @exec_already_processed = {} - @exec_once_per_run = {} - @results = [] - # See start/stop_output_capture for these - @output_pipes = [] - - @lchown_supported = nil - @lchmod_supported = nil - end - - def process_until_done(files, commands) - # Our overall status. Will be reported to the server and used as the - # return value for this method. Command-line clients should use it as - # their exit value. Zero indicates no errors. - status = 0 - message = '' - - # A variable to collect filenames if operating in @listfiles mode - files_to_list = {} - - # Prep http instance - http = nil - if !@local - puts "Connecting to #{@filesuri}" if (@debug) - http = Net::HTTP.new(@filesuri.host, @filesuri.port) - if @filesuri.scheme == "https" - # Eliminate the OpenSSL "using default DH parameters" warning - if File.exist?(File.join(@configdir, 'etch', 'dhparams')) - dh = OpenSSL::PKey::DH.new(IO.read(File.join(@configdir, 'etch', 'dhparams'))) - Net::HTTP.ssl_context_accessor(:tmp_dh_callback) - http.tmp_dh_callback = proc { dh } - end - http.use_ssl = true - if File.exist?(File.join(@configdir, 'etch', 'ca.pem')) - http.ca_file = File.join(@configdir, 'etch', 'ca.pem') - http.verify_mode = OpenSSL::SSL::VERIFY_PEER - elsif File.directory?(File.join(@configdir, 'etch', 'ca')) - http.ca_path = File.join(@configdir, 'etch', 'ca') - http.verify_mode = OpenSSL::SSL::VERIFY_PEER - end - end - http.start - end - - # catch/throw for expected/non-error events that end processing - # begin/raise for error events that end processing - catch :stop_processing do - begin - enabled, message = check_for_disable_etch_file - if !enabled - # 200 is the arbitrarily picked exit value indicating - # that etch is disabled - status = 200 - throw :stop_processing - end - remove_stale_lock_files - - # Assemble the initial request - request = nil - if @local - request = {} - if files && !files.empty? - request[:files] = {} - files.each do |file| - request[:files][file] = {:orig => save_orig(file)} - local_requests = get_local_requests(file) - if local_requests - request[:files][file][:local_requests] = local_requests - end - end - end - if commands && !commands.empty? - request[:commands] = {} - commands.each do |command| - request[:commands][command] = {} - end - end - else - request = get_blank_request - if (files && !files.empty?) || (commands && !commands.empty?) - if files - files.each do |file| - request["files[#{CGI.escape(file)}][sha1sum]"] = - get_orig_sum(file) - local_requests = get_local_requests(file) - if local_requests - request["files[#{CGI.escape(file)}][local_requests]"] = - local_requests - end - end - end - if commands - commands.each do |command| - request["commands[#{CGI.escape(command)}]"] = '1' - end - end - else - request['files[GENERATEALL]'] = '1' - end - end - - # - # Loop back and forth with the server sending requests for files and - # responding to the server's requests for original contents or sums - # it needs - # - - Signal.trap('EXIT') do - STDOUT.reopen(ORIG_STDOUT) - STDERR.reopen(ORIG_STDERR) - unlock_all_files - end - - # It usually takes a few back and forth exchanges with the server to - # exchange all needed data and get a complete set of configuration. - # The number of iterations is capped at 10 to prevent any unplanned - # infinite loops. The limit of 10 was chosen somewhat arbitrarily but - # seems fine in practice. - 10.times do - # - # Send request to server - # - - responsedata = {} - if @local - results = @etch.generate(@local, @facts, request) - # FIXME: Etch#generate returns parsed XML using whatever XML - # library it happens to use. In order to avoid re-parsing - # the XML we'd have to use the XML abstraction code from Etch - # everwhere here. - # Until then re-parse the XML using REXML. - #responsedata[:configs] = results[:configs] - responsedata[:configs] = {} - results[:configs].each {|f,c| responsedata[:configs][f] = REXML::Document.new(c.to_s) } - responsedata[:need_sums] = {} - responsedata[:need_origs] = results[:need_orig] - #responsedata[:allcommands] = results[:allcommands] - responsedata[:allcommands] = {} - results[:allcommands].each {|cn,c| responsedata[:allcommands][cn] = REXML::Document.new(c.to_s) } - responsedata[:retrycommands] = results[:retrycommands] - else - puts "Sending request to server #{@filesuri}: #{request.inspect}" if (@debug) - post = Net::HTTP::Post.new(@filesuri.path) - post.set_form_data(request) - sign_post!(post, @key) - response = http.request(post) - if !response.kind_of?(Net::HTTPSuccess) - $stderr.puts response.body - # error! raises an exception - response.error! - end - puts "Response from server:\n'#{response.body}'" if (@debug) - if !response.body.nil? && !response.body.empty? - response_xml = REXML::Document.new(response.body) - responsedata[:configs] = {} - response_xml.elements.each('/files/configs/config') do |config| - file = config.attributes['filename'] - # We have to make a new document so that XPath paths are - # referenced relative to the configuration for this - # specific file. - #responsedata[:configs][file] = REXML::Document.new(response_xml.elements["/files/configs/config[@filename='#{file}']"].to_s) - responsedata[:configs][file] = REXML::Document.new(config.to_s) - end - responsedata[:need_sums] = {} - response_xml.elements.each('/files/need_sums/need_sum') do |ns| - responsedata[:need_sums][ns.text] = true - end - responsedata[:need_origs] = {} - response_xml.elements.each('/files/need_origs/need_orig') do |no| - responsedata[:need_origs][no.text] = true - end - responsedata[:allcommands] = {} - response_xml.elements.each('/files/allcommands/commands') do |command| - commandname = command.attributes['commandname'] - # We have to make a new document so that XPath paths are - # referenced relative to the configuration for this - # specific file. - #responsedata[:allcommands][commandname] = REXML::Document.new(response_xml.root.elements["/files/allcommands/commands[@commandname='#{commandname}']"].to_s) - responsedata[:allcommands][commandname] = REXML::Document.new(command.to_s) - end - responsedata[:retrycommands] = {} - response_xml.elements.each('/files/retrycommands/retrycommand') do |rc| - responsedata[:retrycommands][rc.text] = true - end - else - puts " Response is empty" if (@debug) - break - end - end - - # - # Process the response from the server - # - - # Prep a clean request hash - if @local - request = {} - if !responsedata[:need_origs].empty? - request[:files] = {} - end - if !responsedata[:retrycommands].empty? - request[:commands] = {} - end - else - request = get_blank_request - end - - # With generateall we expect to make at least two round trips - # to the server. - # 1) Send GENERATEALL request, get back a list of need_sums - # 2) Send sums, possibly get back some need_origs - # 3) Send origs, get back generated files - need_to_loop = false - reset_already_processed - # Process configs first, as they may contain setup entries that are - # needed to create the original files. - responsedata[:configs].each_key do |file| - puts "Processing config for #{file}" if (@debug) - if !@listfiles - continue_processing = process_file(file, responsedata) - if !continue_processing - throw :stop_processing - end - else - files_to_list[file] = true - end - end - responsedata[:need_sums].each_key do |need_sum| - puts "Processing request for sum of #{need_sum}" if (@debug) - if @local - # If this happens we screwed something up, the local mode - # code never requests sums. - raise "No support for sums in local mode" - else - request["files[#{CGI.escape(need_sum)}][sha1sum]"] = - get_orig_sum(need_sum) - end - local_requests = get_local_requests(need_sum) - if local_requests - if @local - request[:files][need_sum][:local_requests] = local_requests - else - request["files[#{CGI.escape(need_sum)}][local_requests]"] = - local_requests - end - end - need_to_loop = true - end - responsedata[:need_origs].each_key do |need_orig| - puts "Processing request for contents of #{need_orig}" if (@debug) - if @local - request[:files][need_orig] = {:orig => save_orig(need_orig)} - else - request["files[#{CGI.escape(need_orig)}][contents]"] = - Base64.encode64(get_orig_contents(need_orig)) - request["files[#{CGI.escape(need_orig)}][sha1sum]"] = - get_orig_sum(need_orig) - end - local_requests = get_local_requests(need_orig) - if local_requests - if @local - request[:files][need_orig][:local_requests] = local_requests - else - request["files[#{CGI.escape(need_orig)}][local_requests]"] = - local_requests - end - end - need_to_loop = true - end - responsedata[:allcommands].each_key do |commandname| - puts "Processing commands #{commandname}" if (@debug) - continue_processing = process_commands(commandname, responsedata) - if !continue_processing - throw :stop_processing - end - end - responsedata[:retrycommands].each_key do |commandname| - puts "Processing request to retry command #{commandname}" if (@debug) - if @local - request[:commands][commandname] = true - else - request["commands[#{CGI.escape(commandname)}]"] = '1' - end - need_to_loop = true - end - - if !need_to_loop - break - end - end - - puts "Processing 'exec once per run' commands" if (!exec_once_per_run.empty?) - exec_once_per_run.keys.each do |exec| - process_exec('post', exec) - end - rescue Exception => e - status = 1 - $stderr.puts e.message - message << e.message - $stderr.puts e.backtrace.join("\n") if @debug - message << e.backtrace.join("\n") if @debug - end # begin/rescue - end # catch - - if @listfiles - puts "Files under management:" - files_to_list.keys.sort.each {|file| puts file} - end - - # Send results to server - if !@dryrun && !@local - rails_results = [] - # A few of the fields here are numbers or booleans and need a - # to_s to make them compatible with CGI.escape, which expects a - # string. - rails_results << "fqdn=#{CGI.escape(@facts['fqdn'])}" - rails_results << "status=#{CGI.escape(status.to_s)}" - rails_results << "message=#{CGI.escape(message)}" - if @detailed_results.include?('SERVER') - @results.each do |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[][success]=#{CGI.escape(result['success'].to_s)}" - rails_results << "results[][message]=#{CGI.escape(result['message'])}" - end - end - puts "Sending results to server #{@resultsuri}" if (@debug) - resultspost = Net::HTTP::Post.new(@resultsuri.path) - # We have to bypass Net::HTTP's set_form_data method in this case - # because it expects a hash and we can't provide the results in the - # format we want in a hash because we'd have duplicate keys (see above). - results_as_string = rails_results.join('&') - resultspost.body = results_as_string - resultspost.content_type = 'application/x-www-form-urlencoded' - sign_post!(resultspost, @key) - response = http.request(resultspost) - case response - when Net::HTTPSuccess - puts "Response from server:\n'#{response.body}'" if (@debug) - else - $stderr.puts "Error submitting results:" - $stderr.puts response.body - end - end - - if !@dryrun - @detailed_results.each do |detail_dest| - # If any of the destinations look like a file (start with a /) then we - # log to that file - if detail_dest =~ %r{^/} - FileUtils.mkpath(File.dirname(detail_dest)) - File.open(detail_dest, 'a') do |file| - # Add a header for the overall status of the run - file.puts "Etch run at #{Time.now}" - file.puts "Status: #{status}" - if !message.empty? - file.puts "Message:\n#{message}\n" - end - # Then the detailed results - @results.each do |result| - file.puts "File #{result['file']}, result #{result['success']}:\n" - file.puts result['message'] - end - end - end - end - end - - status - end - - def check_for_disable_etch_file - disable_etch = File.join(@vardir, 'disable_etch') - message = '' - if File.exist?(disable_etch) - if !@disableforce - message = "Etch disabled:\n" - message << IO.read(disable_etch) - puts message - return false, message - else - puts "Ignoring disable_etch file" - end - end - return true, message - end - - def get_blank_request - @blankrequest.dup - end - - # Raises an exception if any fatal error is encountered - # Returns a boolean, true unless the user indicated in interactive mode - # that further processing should be halted - def process_file(file, responsedata) - continue_processing = true - save_results = true - exception = nil - - # We may not have configuration for this file, if it does not apply - # to this host. The server takes care of detecting any errors that - # might involve, so here we can just silently return. - config = responsedata[:configs][file] - if !config - puts "No configuration for #{file}, skipping" if (@debug) - return continue_processing - end - - # Skip files we've already processed in response to <depend> - # statements. - if @already_processed.has_key?(file) - puts "Skipping already processed #{file}" if (@debug) - return continue_processing - end - - # Prep the results capturing for this file - result = {} - result['file'] = file - result['success'] = true - result['message'] = '' - - # catch/throw for expected/non-error events that end processing - # begin/raise for error events that end processing - # Within this block you should throw :process_done if you've reached - # a natural stopping point and nothing further needs to be done. You - # should raise an exception if you encounter an error condition. - # Do not 'return' or 'abort'. - catch :process_done do - begin - start_output_capture - - puts "Processing #{file}" if (@debug) - - # The %locked_files hash provides a convenient way to - # detect circular dependancies. It doesn't give us an ordered - # list of dependencies, which might be handy to help the user - # debug the problem, but I don't think it's worth maintaining a - # seperate array just for that purpose. - if @locked_files.has_key?(file) - raise "Circular dependancy detected. " + - "Dependancy list (unsorted) contains:\n " + - @locked_files.keys.join(', ') - end - - # This needs to be after the circular dependency check - lock_file(file) - - # 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) - 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) - end - - # See what type of action the user has requested - - # Check to see if the user has requested that we revert back to the - # original file. - if config.elements['/config/revert'] - origpathbase = File.join(@origbase, file) - origpath = nil - - # Restore the original file if it is around - revert_occurred = false - if File.exist?("#{origpathbase}.ORIG") - origpath = "#{origpathbase}.ORIG" - origdir = File.dirname(origpath) - origbase = File.basename(origpath) - filedir = File.dirname(file) - - # Remove anything we might have written out for this file - remove_file(file) if (!@dryrun) - - puts "Restoring #{origpath} to #{file}" - recursive_copy_and_rename(origdir, origbase, file) if (!@dryrun) - revert_occurred = true - elsif File.exist?("#{origpathbase}.TAR") - origpath = "#{origpathbase}.TAR" - filedir = File.dirname(file) - - # Remove anything we might have written out for this file - remove_file(file) if (!@dryrun) - - puts "Restoring #{file} from #{origpath}" - system("cd #{filedir} && tar xf #{origpath}") if (!@dryrun) - revert_occurred = true - elsif File.exist?("#{origpathbase}.NOORIG") - origpath = "#{origpathbase}.NOORIG" - puts "Original #{file} didn't exist, restoring that state" - - # Remove anything we might have written out for this file - remove_file(file) if (!@dryrun) - revert_occurred = true - end - - # Update the history log - if revert_occurred - save_history(file) - end - - # Now remove the backed-up original so that future runs - # don't do anything - if origpath - remove_file(origpath) if (!@dryrun) - end - - throw :process_done - end - - # Perform any setup commands that the user has requested. - # These are occasionally needed to install software that is - # required to generate the file (think m4 for sendmail.cf) or to - # install a package containing a sample config file which we - # then edit with a script, and thus doing the install in <pre> - # is too late. - if config.elements['/config/setup'] - process_setup(file, config) - end - - if config.elements['/config/file'] # Regular file - newcontents = nil - if config.elements['/config/file/contents'] - newcontents = Base64.decode64(config.elements['/config/file/contents'].text) - end - - permstring = config.elements['/config/file/perms'].text - perms = permstring.oct - owner = config.elements['/config/file/owner'].text - group = config.elements['/config/file/group'].text - uid = lookup_uid(owner) - gid = lookup_gid(group) - - set_file_contents = false - if newcontents - set_file_contents = !compare_file_contents(file, newcontents) - end - set_permissions = nil - set_ownership = nil - # If the file is currently something other than a plain file then - # always set the flags to set the permissions and ownership. - # Checking the permissions/ownership of whatever is there currently - # is useless. - if set_file_contents && (!File.file?(file) || File.symlink?(file)) - set_permissions = true - set_ownership = true - else - set_permissions = !compare_permissions(file, perms) - set_ownership = !compare_ownership(file, uid, gid) - end - - # Proceed if: - # - The new contents are different from the current file - # - The permissions or ownership requested don't match the - # current permissions or ownership - if !set_file_contents && - !set_permissions && - !set_ownership - puts "No change to #{file} necessary" if (@debug) - throw :process_done - else - # Tell the user what we're going to do - if set_file_contents - # If the new contents are different from the current file - # show that to the user in the format they've requested. - # If the requested permissions are not world-readable then - # use the filenameonly format so that we don't disclose - # non-public data, unless we're in interactive mode - if @filenameonly || (permstring.to_i(8) & 0004 == 0 && !@interactive) - puts "Will write out new #{file}" - elsif @fullfile - # Grab the first 8k of the contents - first8k = newcontents.slice(0, 8192) - # Then check it for null characters. If it has any it's - # likely a binary file. - hasnulls = true if (first8k =~ /\0/) - - if !hasnulls - puts "Generated contents for #{file}:" - puts "=============================================" - puts newcontents - puts "=============================================" - else - puts "Will write out new #{file}, but " + - "generated contents are not plain text so " + - "they will not be displayed" - end - else - # Default is to show a diff of the current file and the - # newly generated file. - puts "Will make the following changes to #{file}, diff -c:" - tempfile = Tempfile.new(File.basename(file)) - tempfile.write(newcontents) - tempfile.close - puts "=============================================" - if File.file?(file) && !File.symlink?(file) - system("diff -c #{file} #{tempfile.path}") - else - # Either the file doesn't currently exist, - # or is something other than a normal file - # that we'll be replacing with a file. In - # either case diffing against /dev/null will - # produce the most logical output. - system("diff -c /dev/null #{tempfile.path}") - end - puts "=============================================" - tempfile.delete - end - end - if set_permissions - puts "Will set permissions on #{file} to #{permstring}" - end - if set_ownership - puts "Will set ownership of #{file} to #{uid}:#{gid}" - end - - # If the user requested interactive mode ask them for - # confirmation to proceed. - if @interactive - case get_user_confirmation() - when CONFIRM_PROCEED - # No need to do anything - when CONFIRM_SKIP - save_results = false - throw :process_done - when CONFIRM_QUIT - unlock_all_files - continue_processing = false - save_results = false - throw :process_done - else - raise "Unexpected result from get_user_confirmation()" - end - end - - # Perform any pre-action commands that the user has requested - if config.elements['/config/pre'] - process_pre(file, config) - end - - # If the original "file" is a directory and the user hasn't - # specifically told us we can overwrite it then raise an exception. - # - # The test is here, rather than a bit earlier where you might - # expect it, because the pre section may be used to address - # originals which are directories. So we don't check until - # after any pre commands are run. - if File.directory?(file) && !File.symlink?(file) && - !config.elements['/config/file/overwrite_directory'] - raise "Can't proceed, original of #{file} is a directory,\n" + - " consider the overwrite_directory flag if appropriate." - end - - # Give save_orig a definitive answer on whether or not to save the - # contents of an original directory. - origpath = save_orig(file, true) - # Update the history log - save_history(file) - - # Make sure the directory tree for this file exists - filedir = File.dirname(file) - if !File.directory?(filedir) - puts "Making directory tree #{filedir}" - FileUtils.mkpath(filedir) if (!@dryrun) - end - - # Make a backup in case we need to roll back. We have no use - # for a backup if there are no test commands defined (since we - # only use the backup to roll back if the test fails), so don't - # bother to create a backup unless there is a test command defined. - backup = nil - if config.elements['/config/test_before_post'] || - config.elements['/config/test'] - backup = make_backup(file) - puts "Created backup #{backup}" - end - - # If the new contents are different from the current file, - # replace the file. - if set_file_contents - if !@dryrun - # Write out the new contents into a temporary file - filebase = File.basename(file) - filedir = File.dirname(file) - newfile = Tempfile.new(filebase, filedir) - - # Set the proper permissions on the file before putting - # data into it. - newfile.chmod(perms) - begin - newfile.chown(uid, gid) - rescue Errno::EPERM - raise if Process.euid == 0 - end - - puts "Writing new contents of #{file} to #{newfile.path}" if (@debug) - newfile.write(newcontents) - newfile.close - - # If the current file is not a plain file, remove it. - # Plain files are left alone so that the replacement is - # atomic. - if File.symlink?(file) || (File.exist?(file) && ! File.file?(file)) - puts "Current #{file} is not a plain file, removing it" if (@debug) - remove_file(file) - end - - # Move the new file into place - File.rename(newfile.path, file) - - # Check the permissions and ownership now to ensure they - # end up set properly - set_permissions = !compare_permissions(file, perms) - set_ownership = !compare_ownership(file, uid, gid) - end - end - - # Ensure the permissions are set properly - if set_permissions - File.chmod(perms, file) if (!@dryrun) - end - - # Ensure the ownership is set properly - if set_ownership - begin - File.chown(uid, gid, file) if (!@dryrun) - rescue Errno::EPERM - raise if Process.euid == 0 - end - end - - # Perform any test_before_post commands that the user has requested - if config.elements['/config/test_before_post'] - if !process_test_before_post(file, config) - restore_backup(file, backup) - raise "test_before_post failed" - end - end - - # Perform any post-action commands that the user has requested - if config.elements['/config/post'] - process_post(file, config) - end - - # Perform any test commands that the user has requested - if config.elements['/config/test'] - if !process_test(file, config) - restore_backup(file, backup) - - # Re-run any post commands - if config.elements['/config/post'] - process_post(file, config) - end - end - end - - # Clean up the backup, we don't need it anymore - if config.elements['/config/test_before_post'] || - config.elements['/config/test'] - puts "Removing backup #{backup}" - remove_file(backup) if (!@dryrun) - end - - # Update the history log again - save_history(file) - - throw :process_done - end - end - - if config.elements['/config/link'] # Symbolic link - - dest = config.elements['/config/link/dest'].text - - set_link_destination = !compare_link_destination(file, dest) - absdest = File.expand_path(dest, File.dirname(file)) - - permstring = config.elements['/config/link/perms'].text - perms = permstring.oct - owner = config.elements['/config/link/owner'].text - group = config.elements['/config/link/group'].text - uid = lookup_uid(owner) - gid = lookup_gid(group) - - # lchown and lchmod are not supported on many platforms. The server - # always includes ownership and permissions settings with any link - # (pulling them from defaults.xml if the user didn't specify them in - # the config.xml file.) As such link management would always fail - # on systems which don't support lchown/lchmod, which seems like bad - # behavior. So instead we check to see if they are implemented, and - # if not just ignore ownership/permissions settings. I suppose the - # ideal would be for the server to tell the client whether the - # ownership/permissions were specifically requested (in config.xml) - # rather than just defaults, and then for the client to always try to - # manage ownership/permissions if the settings are not defaults (and - # fail in the event that they aren't implemented.) - if @lchown_supported.nil? - lchowntestlink = Tempfile.new('etchlchowntest').path - lchowntestfile = Tempfile.new('etchlchowntest').path - File.delete(lchowntestlink) - File.symlink(lchowntestfile, lchowntestlink) - begin - File.lchown(0, 0, lchowntestfile) - @lchown_supported = true - rescue NotImplementedError - @lchown_supported = false - rescue Errno::EPERM - raise if Process.euid == 0 - end - File.delete(lchowntestlink) - end - if @lchmod_supported.nil? - lchmodtestlink = Tempfile.new('etchlchmodtest').path - lchmodtestfile = Tempfile.new('etchlchmodtest').path - File.delete(lchmodtestlink) - File.symlink(lchmodtestfile, lchmodtestlink) - begin - File.lchmod(0644, lchmodtestfile) - @lchmod_supported = true - rescue NotImplementedError - @lchmod_supported = false - end - File.delete(lchmodtestlink) - end - - set_permissions = false - if @lchmod_supported - # If the file is currently something other than a link then - # always set the flags to set the permissions and ownership. - # Checking the permissions/ownership of whatever is there currently - # is useless. - if set_link_destination && !File.symlink?(file) - set_permissions = true - else - set_permissions = !compare_permissions(file, perms) - end - end - set_ownership = false - if @lchown_supported - if set_link_destination && !File.symlink?(file) - set_ownership = true - else - set_ownership = !compare_ownership(file, uid, gid) - end - end - - # Proceed if: - # - The new link destination differs from the current one - # - The permissions or ownership requested don't match the - # current permissions or ownership - if !set_link_destination && - !set_permissions && - !set_ownership - puts "No change to #{file} necessary" if (@debug) - throw :process_done - # Check that the link destination exists, and refuse to create - # the link unless it does exist or the user told us to go ahead - # anyway. - # - # Note that the destination may be a relative path, and the - # target directory may not exist yet, so we have to convert the - # destination to an absolute path and test that for existence. - # expand_path should handle paths that are already absolute - # properly. - elsif ! File.exist?(absdest) && ! File.symlink?(absdest) && - ! config.elements['/config/link/allow_nonexistent_dest'] - puts "Destination #{dest} for link #{file} does not exist," + - " consider the allow_nonexistent_dest flag if appropriate." - throw :process_done - else - # Tell the user what we're going to do - if set_link_destination - puts "Linking #{file} -> #{dest}" - end - if set_permissions - puts "Will set permissions on #{file} to #{permstring}" - end - if set_ownership - puts "Will set ownership of #{file} to #{uid}:#{gid}" - end - - # If the user requested interactive mode ask them for - # confirmation to proceed. - if @interactive - case get_user_confirmation() - when CONFIRM_PROCEED - # No need to do anything - when CONFIRM_SKIP - save_results = false - throw :process_done - when CONFIRM_QUIT - unlock_all_files - continue_processing = false - save_results = false - throw :process_done - else - raise "Unexpected result from get_user_confirmation()" - end - end - - # Perform any pre-action commands that the user has requested - if config.elements['/config/pre'] - process_pre(file, config) - end - - # If the original "file" is a directory and the user hasn't - # specifically told us we can overwrite it then raise an exception. - # - # The test is here, rather than a bit earlier where you might - # expect it, because the pre section may be used to address - # originals which are directories. So we don't check until - # after any pre commands are run. - if File.directory?(file) && !File.symlink?(file) && - !config.elements['/config/link/overwrite_directory'] - raise "Can't proceed, original of #{file} is a directory,\n" + - " consider the overwrite_directory flag if appropriate." - end - - # Give save_orig a definitive answer on whether or not to save the - # contents of an original directory. - origpath = save_orig(file, true) - # Update the history log - save_history(file) - - # Make sure the directory tree for this link exists - filedir = File.dirname(file) - if !File.directory?(filedir) - puts "Making directory tree #{filedir}" - FileUtils.mkpath(filedir) if (!@dryrun) - end - - # Make a backup in case we need to roll back. We have no use - # for a backup if there are no test commands defined (since we - # only use the backup to roll back if the test fails), so don't - # bother to create a backup unless there is a test command defined. - backup = nil - if config.elements['/config/test_before_post'] || - config.elements['/config/test'] - backup = make_backup(file) - puts "Created backup #{backup}" - end - - # Create the link - if set_link_destination - remove_file(file) if (!@dryrun) - File.symlink(dest, file) if (!@dryrun) - - # Check the permissions and ownership now to ensure they - # end up set properly - if @lchmod_supported - set_permissions = !compare_permissions(file, perms) - end - if @lchown_supported - set_ownership = !compare_ownership(file, uid, gid) - end - end - - # Ensure the permissions are set properly - if set_permissions - # Note: lchmod - File.lchmod(perms, file) if (!@dryrun) - end - - # Ensure the ownership is set properly - if set_ownership - begin - # Note: lchown - File.lchown(uid, gid, file) if (!@dryrun) - rescue Errno::EPERM - raise if Process.euid == 0 - end - end - - # Perform any test_before_post commands that the user has requested - if config.elements['/config/test_before_post'] - if !process_test_before_post(file, config) - restore_backup(file, backup) - raise "test_before_post failed" - end - end - - # Perform any post-action commands that the user has requested - if config.elements['/config/post'] - process_post(file, config) - end - - # Perform any test commands that the user has requested - if config.elements['/config/test'] - if !process_test(file, config) - restore_backup(file, backup) - - # Re-run any post commands - if config.elements['/config/post'] - process_post(file, config) - end - end - end - - # Clean up the backup, we don't need it anymore - if config.elements['/config/test_before_post'] || - config.elements['/config/test'] - puts "Removing backup #{backup}" - remove_file(backup) if (!@dryrun) - end - - # Update the history log again - save_history(file) - - throw :process_done - end - end - - if config.elements['/config/directory'] # Directory - - # A little safety check - create = config.elements['/config/directory/create'] - raise "No create element found in directory section" if !create - - permstring = config.elements['/config/directory/perms'].text - perms = permstring.oct - owner = config.elements['/config/directory/owner'].text - group = config.elements['/config/directory/group'].text - uid = lookup_uid(owner) - gid = lookup_gid(group) - - set_directory = !File.directory?(file) || File.symlink?(file) - set_permissions = nil - set_ownership = nil - # If the file is currently something other than a directory then - # always set the flags to set the permissions and ownership. - # Checking the permissions/ownership of whatever is there currently - # is useless. - if set_directory - set_permissions = true - set_ownership = true - else - set_permissions = !compare_permissions(file, perms) - set_ownership = !compare_ownership(file, uid, gid) - end - - # Proceed if: - # - The current file is not a directory - # - The permissions or ownership requested don't match the - # current permissions or ownership - if !set_directory && - !set_permissions && - !set_ownership - puts "No change to #{file} necessary" if (@debug) - throw :process_done - else - # Tell the user what we're going to do - if set_directory - puts "Making directory #{file}" - end - if set_permissions - puts "Will set permissions on #{file} to #{permstring}" - end - if set_ownership - puts "Will set ownership of #{file} to #{uid}:#{gid}" - end - - # If the user requested interactive mode ask them for - # confirmation to proceed. - if @interactive - case get_user_confirmation() - when CONFIRM_PROCEED - # No need to do anything - when CONFIRM_SKIP - save_results = false - throw :process_done - when CONFIRM_QUIT - unlock_all_files - continue_processing = false - save_results = false - throw :process_done - else - raise "Unexpected result from get_user_confirmation()" - end - end - - # Perform any pre-action commands that the user has requested - if config.elements['/config/pre'] - process_pre(file, config) - end - - # Give save_orig a definitive answer on whether or not to save the - # contents of an original directory. - origpath = save_orig(file, false) - # Update the history log - save_history(file) - - # Make sure the directory tree for this directory exists - filedir = File.dirname(file) - if !File.directory?(filedir) - puts "Making directory tree #{filedir}" - FileUtils.mkpath(filedir) if (!@dryrun) - end - - # Make a backup in case we need to roll back. We have no use - # for a backup if there are no test commands defined (since we - # only use the backup to roll back if the test fails), so don't - # bother to create a backup unless there is a test command defined. - backup = nil - if config.elements['/config/test_before_post'] || - config.elements['/config/test'] - backup = make_backup(file) - puts "Created backup #{backup}" - end - - # Create the directory - if set_directory - remove_file(file) if (!@dryrun) - Dir.mkdir(file) if (!@dryrun) - - # Check the permissions and ownership now to ensure they - # end up set properly - set_permissions = !compare_permissions(file, perms) - set_ownership = !compare_ownership(file, uid, gid) - end - - # Ensure the permissions are set properly - if set_permissions - File.chmod(perms, file) if (!@dryrun) - end - - # Ensure the ownership is set properly - if set_ownership - begin - File.chown(uid, gid, file) if (!@dryrun) - rescue Errno::EPERM - raise if Process.euid == 0 - end - end - - # Perform any test_before_post commands that the user has requested - if config.elements['/config/test_before_post'] - if !process_test_before_post(file, config) - restore_backup(file, backup) - raise "test_before_post failed" - end - end - - # Perform any post-action commands that the user has requested - if config.elements['/config/post'] - process_post(file, config) - end - - # Perform any test commands that the user has requested - if config.elements['/config/test'] - if !process_test(file, config) - restore_backup(file, backup) - - # Re-run any post commands - if config.elements['/config/post'] - process_post(file, config) - end - end - end - - # Clean up the backup, we don't need it anymore - if config.elements['/config/test_before_post'] || - config.elements['/config/test'] - puts "Removing backup #{backup}" - remove_file(backup) if (!@dryrun) -... [truncated message content] |
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. |
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-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-28 01:31:26
|
Revision: 333 http://etch.svn.sourceforge.net/etch/?rev=333&view=rev Author: jheiss Date: 2012-04-28 01:31:19 +0000 (Sat, 28 Apr 2012) Log Message: ----------- Run unicorn based on whether the user has enabled it in their Gemfile rather than based on a hard-coded constant in the test suite. Modified Paths: -------------- trunk/test/etchtest.rb Modified: trunk/test/etchtest.rb =================================================================== --- trunk/test/etchtest.rb 2012-04-28 01:26:02 UTC (rev 332) +++ trunk/test/etchtest.rb 2012-04-28 01:31:19 UTC (rev 333) @@ -97,7 +97,6 @@ File.symlink(newrepo, server[:repo]) end - UNICORN = false def start_server(repo='no_repo_yet') # We want the running server's notion of the server base to be a symlink # that we can easily change later in swap_repository. @@ -130,10 +129,10 @@ raise "Etch server failed to start" end else - if UNICORN - exec("cd #{SERVERDIR} && #{RUBY} `which unicorn_rails` -p #{port}") + if `cd #{SERVERDIR} && #{RUBY} \`which bundle\` list`.include?('unicorn') + exec("cd #{SERVERDIR} && #{RUBY} `which bundle` exec unicorn -p #{port}") else - exec("cd #{SERVERDIR} && #{RUBY} `which rails` server -p #{port}") + exec("cd #{SERVERDIR} && #{RUBY} `which bundle` exec rails server -p #{port}") end end {:port => port, :pid => pid, :repo => serverbase} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-28 01:26:09
|
Revision: 332 http://etch.svn.sourceforge.net/etch/?rev=332&view=rev Author: jheiss Date: 2012-04-28 01:26:02 +0000 (Sat, 28 Apr 2012) Log Message: ----------- Split the tests up into individual test methods Modified Paths: -------------- trunk/test/test_file.rb Modified: trunk/test/test_file.rb =================================================================== --- trunk/test/test_file.rb 2012-04-27 02:25:53 UTC (rev 331) +++ trunk/test/test_file.rb 2012-04-28 01:26:02 UTC (rev 332) @@ -23,8 +23,7 @@ #puts "Using #{@testroot} as client working directory" end - def test_files - + def test_plain # # Run a test of basic file creation # @@ -59,7 +58,9 @@ correctcontents << sourcecontents assert_equal(correctcontents, get_file_contents(@targetfile), 'file') + end + def test_template # # Test with a template # @@ -95,7 +96,9 @@ correctcontents << sourcecontents assert_equal(correctcontents, get_file_contents(@targetfile), 'template') + end + def test_warning # # Test using a different warning file # @@ -135,7 +138,9 @@ correctcontents << sourcecontents assert_equal(correctcontents, get_file_contents(@targetfile), 'different warning file') + end + def test_no_warning # # Test using no warning file # @@ -164,7 +169,9 @@ # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), 'no warning file') + end + def test_comment_line # # Test using a different line comment string # @@ -200,7 +207,9 @@ correctcontents << sourcecontents assert_equal(correctcontents, get_file_contents(@targetfile), 'different line comment') + end + def test_comment_open_close # # Test using comment open/close # @@ -239,7 +248,9 @@ correctcontents << sourcecontents assert_equal(correctcontents, get_file_contents(@targetfile), 'comment open/close') + end + def test_warning_on_second_line # # Test warning on second line # @@ -278,7 +289,9 @@ correctcontents << sourcecontents_remainder assert_equal(correctcontents, get_file_contents(@targetfile), 'warning on second line') + end + def test_no_space_around_warning # # Test no space around warning # @@ -298,7 +311,7 @@ EOF end - sourcecontents = "This is a test\n" + sourcecontents = "Test #{testname}\n" File.open("#{@repodir}/source/#{@targetfile}/source", 'w') do |file| file.write(sourcecontents) end @@ -313,7 +326,9 @@ correctcontents << sourcecontents assert_equal(correctcontents, get_file_contents(@targetfile), 'file') + end + def test_ownership_and_permissions # # Test ownership and permissions # @@ -335,6 +350,11 @@ EOF end + sourcecontents = "Test #{testname}\n" + File.open("#{@repodir}/source/#{@targetfile}/source", 'w') do |file| + file.write(sourcecontents) + end + run_etch(@server, @testroot, :testname => testname) # Verify that the file ownership got set correctly @@ -370,6 +390,11 @@ EOF end + sourcecontents = "Test #{testname}\n" + File.open("#{@repodir}/source/#{@targetfile}/source", 'w') do |file| + file.write(sourcecontents) + end + run_etch(@server, @testroot, :testname => testname) # Verify that the ownership defaulted to UID/GID 0 @@ -381,7 +406,9 @@ else warn "Not running as root, skipping bogus ownership test" end - + end + + def test_always_manage_metadata # # Run a test of always_manage_metadata # @@ -413,7 +440,9 @@ # And verify that the file contents didn't change assert_equal(testcontents, get_file_contents(@targetfile), 'always_manage_metadata contents') - + end + + def test_duplicate_plain # # Test duplicate plain instructions # @@ -448,7 +477,9 @@ # Verify that the file contents were updated assert_equal(sourcecontents, get_file_contents(@targetfile), 'duplicate plain instructions') - + end + + def test_contradictory_plain # # Test contradictory plain instructions # @@ -486,7 +517,9 @@ # Verify that the file contents didn't change assert_equal(origcontents, get_file_contents(@targetfile), 'contradictory plain instructions') - + end + + def test_duplicate_template # # Test duplicate template instructions # @@ -521,7 +554,9 @@ # Verify that the file contents were updated assert_equal(sourcecontents, get_file_contents(@targetfile), 'duplicate template instructions') - + end + + def test_contradictory_template # # Test contradictory template instructions # @@ -559,7 +594,9 @@ # Verify that the file contents didn't change assert_equal(origcontents, get_file_contents(@targetfile), 'contradictory template instructions') - + end + + def test_duplicate_script # # Test duplicate script instructions # @@ -594,7 +631,9 @@ # Verify that the file contents were updated assert_equal(sourcecontents, get_file_contents(@targetfile), 'duplicate script instructions') - + end + + def test_contradictory_script # # Test contradictory script instructions # 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-27 02:00:35
|
Revision: 330 http://etch.svn.sourceforge.net/etch/?rev=330&view=rev Author: jheiss Date: 2012-04-27 02:00:29 +0000 (Fri, 27 Apr 2012) Log Message: ----------- Add test_output_encoding Do a proper skip in test_output_capture_timeout rather than just commenting out the assertion. Modified Paths: -------------- trunk/test/test_outputcapture.rb Modified: trunk/test/test_outputcapture.rb =================================================================== --- trunk/test/test_outputcapture.rb 2012-04-27 01:59:26 UTC (rev 329) +++ trunk/test/test_outputcapture.rb 2012-04-27 02:00:29 UTC (rev 330) @@ -37,8 +37,6 @@ postoutput = "This is output from\nthe post\ncommand" postcmd = Tempfile.new('etchoutputtest') postcmd.puts '#!/bin/sh' - # echo may or may not add a trailing \n depending on which echo we end - # up, so use printf, which doesn't add things. postcmd.puts "printf \"#{postoutput}\"" postcmd.close File.chmod(0755, postcmd.path) @@ -69,6 +67,70 @@ assert_match(postoutput, latest_result_message, testname) end + def test_output_encoding + # + # Run a test where a post command outputs something outside the ASCII + # character set + # + + # The code being tested here is not active under ruby 1.8, and these tests + # use features that don't exist in ruby 1.8 + if RUBY_VERSION.split('.')[0..1].join('.').to_f < 1.9 + return + end + + postoutput = "This is output from\nthe post\ncommand\nwith Unicode: ol\u00E9" + # This test depends on Ruby correct interpreting the LANG environment + # variable and setting an appropriate Encoding.default_external so that + # data captured by the output capturing process is interpreted and + # transcoded to UTF-8 (if necessary) correctly. It seems that at the moment + # (ruby 1.9.3-p194) ruby only correctly handles LANG set to a variant of + # UTF-8 ("UTF-8", "en_US.UTF-8", etc.) If you sent LANG to "ISO-8859-1" or + # "UTF-16LE" then ruby sets Encoding.default_external to "US-ASCII". Which + # is horribly wrong. Sigh. So for now we only test UTF-8. Which means we + # aren't actually testing transcoding. If ruby ever decides to properly + # handle users in other locales we should expand the languages tested here. + ['UTF-8'].each do |lang| + testname = "output capture encoding, #{lang}" + + postcmd = Tempfile.new('etchoutputtest') + postcmd.puts '#!/bin/sh' + postcmd.print 'printf "' + postcmd.print postoutput.encode(lang) + postcmd.puts '"' + postcmd.close + File.chmod(0755, postcmd.path) + + FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") + File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| + file.puts <<-EOF + <config> + <file> + <source> + <plain>source</plain> + </source> + </file> + <post> + <exec>#{postcmd.path}</exec> + </post> + </config> + EOF + end + + sourcecontents = "Test #{testname}\n" + File.open("#{@repodir}/source/#{@targetfile}/source", 'w') do |file| + file.write(sourcecontents) + end + + oldlang = ENV['LANG'] + ENV['LANG'] = "en_US.#{lang}" + run_etch(@server, @testroot, :testname => testname) + ENV['LANG'] = oldlang + + assert_match(postoutput, latest_result_message, testname) + end + end + def test_output_capture_timeout # # Run a test where a post command does not properly daemonize, ensure that @@ -76,6 +138,12 @@ # testname = 'output capture timeout' + if RUBY_VERSION.split('.')[0..1].join('.').to_f >= 1.9 + skip('This test is not normally run because the timeout is so long.') + else + return + end + FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| file.puts <<-EOF @@ -99,10 +167,7 @@ begin Timeout.timeout(Etch::Client::OUTPUT_CAPTURE_TIMEOUT + 15) do - # NOTE: This test is not normally run because the timeout is so long. - # Uncomment this run_etch line to run this test. - # - #run_etch(@server, @testroot, :testname => testname) + run_etch(@server, @testroot, :testname => testname) end rescue Timeout::Error flunk('output capturing did not time out as expected') 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 01:50:59
|
Revision: 328 http://etch.svn.sourceforge.net/etch/?rev=328&view=rev Author: jheiss Date: 2012-04-27 01:50:53 +0000 (Fri, 27 Apr 2012) Log Message: ----------- Switch some instances of ruby 1.9 hash syntax back to 1.8-compatible syntax. Since Rails still supports 1.8 I won't otherwise force folks to 1.9 yet. Modified Paths: -------------- trunk/server/config/initializers/session_store.rb trunk/server/config/initializers/wrap_parameters.rb Modified: trunk/server/config/initializers/session_store.rb =================================================================== --- trunk/server/config/initializers/session_store.rb 2012-04-27 01:50:09 UTC (rev 327) +++ trunk/server/config/initializers/session_store.rb 2012-04-27 01:50:53 UTC (rev 328) @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -Server::Application.config.session_store :cookie_store, key: '_server_session' +Server::Application.config.session_store :cookie_store, :key => '_server_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information Modified: trunk/server/config/initializers/wrap_parameters.rb =================================================================== --- trunk/server/config/initializers/wrap_parameters.rb 2012-04-27 01:50:09 UTC (rev 327) +++ trunk/server/config/initializers/wrap_parameters.rb 2012-04-27 01:50:53 UTC (rev 328) @@ -5,7 +5,7 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] + wrap_parameters :format => [:json] end # Disable root element in JSON by default. 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:50:15
|
Revision: 327 http://etch.svn.sourceforge.net/etch/?rev=327&view=rev Author: jheiss Date: 2012-04-27 01:50:09 +0000 (Fri, 27 Apr 2012) Log Message: ----------- When passing a params key to Rails for possible storage in the database (various find_or_create_by_* calls), dup the key. This eliminates intermittent "RuntimeError: can't modify frozen String" errors I was getting from the test suite. The wisdom of the Internets seems to indicate that a hash key (all hash keys? or just params hash keys? it's not clear) can be or always are frozen, and thus dup'ing the key fixes the problem. It's a little strange that it's an intermittent problem, but the dup fix seems fairly cheap and harmless. Modified Paths: -------------- trunk/server/lib/etch/server.rb Modified: trunk/server/lib/etch/server.rb =================================================================== --- trunk/server/lib/etch/server.rb 2012-04-27 01:44:06 UTC (rev 326) +++ trunk/server/lib/etch/server.rb 2012-04-27 01:50:09 UTC (rev 327) @@ -231,7 +231,7 @@ # Update the stored facts for this client @client = Client.find_or_create_by_name(@fqdn) @facts.each do |key, value| - fact = Fact.find_or_create_by_client_id_and_key(:client_id => @client.id, :key => key, :value => value) + fact = Fact.find_or_create_by_client_id_and_key(:client_id => @client.id, :key => key.dup, :value => value) if fact.value != value fact.update_attributes(:value => value) end @@ -326,7 +326,7 @@ end request[:files][name][:orig] = origpath # Update the stored record of the original - original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name, :sum => sha1) + original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name.dup, :sum => sha1) if original.sum != sha1 original.update_attributes(:sum => sha1) end @@ -334,7 +334,7 @@ if filehash['sha1sum'] sha1 = filehash['sha1sum'] # Update the stored record of the original - original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name, :sum => sha1) + original = Original.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => name.dup, :sum => sha1) if original.sum != sha1 original.update_attributes(:sum => sha1) end @@ -379,7 +379,7 @@ # setup and depend elements that we send to the client to ensure it # supplies a proper orig file. if !response[:need_orig][file] - config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => file, :config => config_xml.to_s) + config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => file.dup, :config => config_xml.to_s) if config.config != config_xml.to_s config.update_attributes(:config => config_xml.to_s) end @@ -429,7 +429,7 @@ commands_xml = Etch.xmlnewelem('allcommands', response_xml) response[:allcommands].each do |commandname, command_xml| # Update the stored record of the command - config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => commandname, :config => command_xml.to_s) + config = EtchConfig.find_or_create_by_client_id_and_file(:client_id => @client.id, :file => commandname.dup, :config => command_xml.to_s) if config.config != command_xml.to_s config.update_attributes(:config => command_xml.to_s) 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:44:12
|
Revision: 326 http://etch.svn.sourceforge.net/etch/?rev=326&view=rev Author: jheiss Date: 2012-04-27 01:44:06 +0000 (Fri, 27 Apr 2012) Log Message: ----------- Update some instances of old search syntax to ransack syntax. Plus a few other minor updates in etchtest.rb Modified Paths: -------------- trunk/test/etchtest.rb trunk/test/test_auth.rb trunk/test/test_conf.rb Modified: trunk/test/etchtest.rb =================================================================== --- trunk/test/etchtest.rb 2012-04-27 01:42:43 UTC (rev 325) +++ trunk/test/etchtest.rb 2012-04-27 01:44:06 UTC (rev 326) @@ -121,7 +121,7 @@ throw :serverstarted end end - rescue => e + rescue end sleep(1) end @@ -133,7 +133,7 @@ if UNICORN exec("cd #{SERVERDIR} && #{RUBY} `which unicorn_rails` -p #{port}") else - exec("cd #{SERVERDIR} && #{RUBY} ./script/server -p #{port}") + exec("cd #{SERVERDIR} && #{RUBY} `which rails` server -p #{port}") end end {:port => port, :pid => pid, :repo => serverbase} @@ -209,7 +209,7 @@ hostname = Facter['fqdn'].value lrm = '' Net::HTTP.start('localhost', @server[:port]) do |http| - response = http.get("/results.xml?clients.name=#{hostname}&sort=created_at_reverse") + response = http.get("/results.xml?q[client_name_eq]=#{hostname}&q[s]=created_at+desc") if !response.kind_of?(Net::HTTPSuccess) response.error! end Modified: trunk/test/test_auth.rb =================================================================== --- trunk/test/test_auth.rb 2012-04-27 01:42:43 UTC (rev 325) +++ trunk/test/test_auth.rb 2012-04-27 01:44:06 UTC (rev 326) @@ -39,7 +39,7 @@ hostname = Facter['fqdn'].value Net::HTTP.start('localhost', @server[:port]) do |http| # Find our client id - response = http.get("/clients.xml?name=#{hostname}") + response = http.get("/clients.xml?q[name_eq]=#{hostname}") if !response.kind_of?(Net::HTTPSuccess) response.error! end Modified: trunk/test/test_conf.rb =================================================================== --- trunk/test/test_conf.rb 2012-04-27 01:42:43 UTC (rev 325) +++ trunk/test/test_conf.rb 2012-04-27 01:44:06 UTC (rev 326) @@ -159,7 +159,7 @@ # these changes. Net::HTTP.start('localhost', @server[:port]) do |http| # Find our client id - response = http.get("/clients.xml?name=#{hostname}") + response = http.get("/clients.xml?q[name_eq]=#{hostname}") if !response.kind_of?(Net::HTTPSuccess) response.error! end @@ -169,8 +169,8 @@ client_id = response_xml.elements['/clients/client/id'].text # If there's an existing "sshrsakey" fact for this client then # delete it - response = http.get("/facts.xml?search[client_id]=#{client_id}&" + - "search[key]=sshrsakey") + response = http.get("/facts.xml?q[client_id_eq]=#{client_id}&" + + "q[key_eq]=sshrsakey") if !response.kind_of?(Net::HTTPSuccess) response.error! 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:42:49
|
Revision: 325 http://etch.svn.sourceforge.net/etch/?rev=325&view=rev Author: jheiss Date: 2012-04-27 01:42:43 +0000 (Fri, 27 Apr 2012) Log Message: ----------- Switch some instances of ruby 1.9 hash syntax back to 1.8-compatible syntax. Since Rails still supports 1.8 I won't otherwise force folks to 1.9 yet. Modified Paths: -------------- trunk/server/app/controllers/dashboard_controller.rb Modified: trunk/server/app/controllers/dashboard_controller.rb =================================================================== --- trunk/server/app/controllers/dashboard_controller.rb 2012-04-27 01:41:04 UTC (rev 324) +++ trunk/server/app/controllers/dashboard_controller.rb 2012-04-27 01:42:43 UTC (rev 325) @@ -28,16 +28,16 @@ set_counts data = [] if @healthy_count > 0 - data << { label: "Healthy: #{@healthy_count}", data: @healthy_count } + data << { :label => "Healthy: #{@healthy_count}", :data => @healthy_count } end if @broken_count > 0 - data << { label: "Broken: #{@broken_count}", data: @broken_count } + data << { :label => "Broken: #{@broken_count}", :data => @broken_count } end if @disabled_count > 0 - data << { label: "Disabled: #{@disabled_count}", data: @disabled_count } + data << { :label => "Disabled: #{@disabled_count}", :data => @disabled_count } end if @stale_count > 0 - data << { label: "Stale: #{@stale_count}", data: @stale_count } + data << { :label => "Stale: #{@stale_count}", :data => @stale_count } end render :json => data and return when 'client' @@ -55,7 +55,7 @@ # Throw in an entry for right now so the graph has current data client_counts << [now.to_i * 1000, Client.count] end - data = [{label: "# of Clients", data: client_counts}] + data = [{:label => "# of Clients", :data => client_counts}] render :json => data and return 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:41:10
|
Revision: 324 http://etch.svn.sourceforge.net/etch/?rev=324&view=rev Author: jheiss Date: 2012-04-27 01:41:04 +0000 (Fri, 27 Apr 2012) Log Message: ----------- Remove old comment about starting the server as needed, did that a while ago Modified Paths: -------------- trunk/test/TODO Modified: trunk/test/TODO =================================================================== --- trunk/test/TODO 2012-04-26 23:34:09 UTC (rev 323) +++ trunk/test/TODO 2012-04-27 01:41:04 UTC (rev 324) @@ -1,9 +1,3 @@ -FIXME: Seems like we could restructure this so that the server is just started -as needed (i.e. for the first test that runs) and then the config repo is -cleaned out and recreated as needed. That should speed up the test runs quite -a bit, and reduce the occurrence of the occasional timing-related failures -where the server doesn't finish starting up before we unleash the client. - Restructure so that tests can run in local or server mode directory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-26 23:34:15
|
Revision: 323 http://etch.svn.sourceforge.net/etch/?rev=323&view=rev Author: jheiss Date: 2012-04-26 23:34:09 +0000 (Thu, 26 Apr 2012) Log Message: ----------- Update now that this is client-specific Modified Paths: -------------- trunk/client/Gemfile trunk/client/Gemfile.lock Modified: trunk/client/Gemfile =================================================================== --- trunk/client/Gemfile 2012-04-26 23:32:47 UTC (rev 322) +++ trunk/client/Gemfile 2012-04-26 23:34:09 UTC (rev 323) @@ -1,7 +1,2 @@ source :rubygems gem 'facter' -gem 'nokogiri' -# Tests will be run with nokogiri by default, but it might be nice to have -# libxml available too if you want to test with it as well. -gem 'libxml-ruby' - Modified: trunk/client/Gemfile.lock =================================================================== --- trunk/client/Gemfile.lock 2012-04-26 23:32:47 UTC (rev 322) +++ trunk/client/Gemfile.lock 2012-04-26 23:34:09 UTC (rev 323) @@ -2,13 +2,9 @@ remote: http://rubygems.org/ specs: facter (1.6.5) - libxml-ruby (2.2.2) - nokogiri (1.5.0) PLATFORMS ruby DEPENDENCIES facter - libxml-ruby - nokogiri This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-26 23:32:53
|
Revision: 322 http://etch.svn.sourceforge.net/etch/?rev=322&view=rev Author: jheiss Date: 2012-04-26 23:32:47 +0000 (Thu, 26 Apr 2012) Log Message: ----------- Move the top-level Gemfile I created a while back into the client directory now that the server directory has its own proper Gemfile. Added Paths: ----------- trunk/client/Gemfile trunk/client/Gemfile.lock Removed Paths: ------------- trunk/Gemfile trunk/Gemfile.lock Deleted: trunk/Gemfile =================================================================== --- trunk/Gemfile 2012-04-24 19:59:57 UTC (rev 321) +++ trunk/Gemfile 2012-04-26 23:32:47 UTC (rev 322) @@ -1,14 +0,0 @@ -source :rubygems -gem 'facter' -gem 'nokogiri' -# Tests will be run with nokogiri by default, but it might be nice to have -# libxml available too if you want to test with it as well. -gem 'libxml-ruby' - -group :server do - gem 'rails', '2.3.14' - gem 'sqlite3' - gem 'will_paginate', '~> 2.3.15' - gem 'searchlogic' -end - Deleted: trunk/Gemfile.lock =================================================================== --- trunk/Gemfile.lock 2012-04-24 19:59:57 UTC (rev 321) +++ trunk/Gemfile.lock 2012-04-26 23:32:47 UTC (rev 322) @@ -1,42 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - actionmailer (2.3.14) - actionpack (= 2.3.14) - actionpack (2.3.14) - activesupport (= 2.3.14) - rack (~> 1.1.0) - activerecord (2.3.14) - activesupport (= 2.3.14) - activeresource (2.3.14) - activesupport (= 2.3.14) - activesupport (2.3.14) - facter (1.6.5) - libxml-ruby (2.2.2) - nokogiri (1.5.0) - rack (1.1.3) - rails (2.3.14) - actionmailer (= 2.3.14) - actionpack (= 2.3.14) - activerecord (= 2.3.14) - activeresource (= 2.3.14) - activesupport (= 2.3.14) - rake (>= 0.8.3) - rake (0.9.2) - searchlogic (2.5.8) - activerecord (~> 2.3.12) - activerecord (~> 2.3.12) - sqlite3 (1.3.5) - will_paginate (2.3.16) - -PLATFORMS - ruby - -DEPENDENCIES - facter - libxml-ruby - nokogiri - rails (= 2.3.14) - searchlogic - sqlite3 - will_paginate (~> 2.3.15) Copied: trunk/client/Gemfile (from rev 315, trunk/Gemfile) =================================================================== --- trunk/client/Gemfile (rev 0) +++ trunk/client/Gemfile 2012-04-26 23:32:47 UTC (rev 322) @@ -0,0 +1,7 @@ +source :rubygems +gem 'facter' +gem 'nokogiri' +# Tests will be run with nokogiri by default, but it might be nice to have +# libxml available too if you want to test with it as well. +gem 'libxml-ruby' + Copied: trunk/client/Gemfile.lock (from rev 315, trunk/Gemfile.lock) =================================================================== --- trunk/client/Gemfile.lock (rev 0) +++ trunk/client/Gemfile.lock 2012-04-26 23:32:47 UTC (rev 322) @@ -0,0 +1,14 @@ +GEM + remote: http://rubygems.org/ + specs: + facter (1.6.5) + libxml-ruby (2.2.2) + nokogiri (1.5.0) + +PLATFORMS + ruby + +DEPENDENCIES + facter + libxml-ruby + nokogiri This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-24 20:00:03
|
Revision: 321 http://etch.svn.sourceforge.net/etch/?rev=321&view=rev Author: jheiss Date: 2012-04-24 19:59:57 +0000 (Tue, 24 Apr 2012) Log Message: ----------- Wrap the config.xml load step with wrap_exception so that the user gets a useful error message. Modified Paths: -------------- trunk/server/lib/etch.rb Modified: trunk/server/lib/etch.rb =================================================================== --- trunk/server/lib/etch.rb 2012-04-24 19:52:53 UTC (rev 320) +++ trunk/server/lib/etch.rb 2012-04-24 19:59:57 UTC (rev 321) @@ -285,7 +285,11 @@ end # Load the config.xml file - config_xml = Etch.xmlload(config_xml_file) + begin + config_xml = Etch.xmlload(config_xml_file) + rescue Exception => e + raise Etch.wrap_exception(e, "Error loading config.xml for #{file}:\n" + e.message) + end # Filter the config.xml file by looking for attributes begin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-24 19:53:02
|
Revision: 320 http://etch.svn.sourceforge.net/etch/?rev=320&view=rev Author: jheiss Date: 2012-04-24 19:52:53 +0000 (Tue, 24 Apr 2012) Log Message: ----------- In fixing the syntax error in my last commit I ended up setting the wrong color. Fixing that now. Modified Paths: -------------- trunk/server/app/assets/stylesheets/design.css Modified: trunk/server/app/assets/stylesheets/design.css =================================================================== --- trunk/server/app/assets/stylesheets/design.css 2012-04-24 17:14:10 UTC (rev 319) +++ trunk/server/app/assets/stylesheets/design.css 2012-04-24 19:52:53 UTC (rev 320) @@ -125,7 +125,6 @@ table.styled thead a { color: #fff; - background-color: #666; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-24 17:14:16
|
Revision: 319 http://etch.svn.sourceforge.net/etch/?rev=319&view=rev Author: jheiss Date: 2012-04-24 17:14:10 +0000 (Tue, 24 Apr 2012) Log Message: ----------- Comment out the links to login/logout. There has never been support for them, and with some of the recent routing changes there is no longer routing to even generate the links. Modified Paths: -------------- trunk/server/app/views/layouts/application.html.erb Modified: trunk/server/app/views/layouts/application.html.erb =================================================================== --- trunk/server/app/views/layouts/application.html.erb 2012-04-24 17:02:42 UTC (rev 318) +++ trunk/server/app/views/layouts/application.html.erb 2012-04-24 17:14:10 UTC (rev 319) @@ -14,11 +14,11 @@ <p id="account_links"> <%- if session && session[:account_id] -%> Welcome back, <%= link_to logged_in_account.name, account_path(logged_in_account) %>! - | <%= link_to "Help", "http://etch.sourceforge.net/" %> - | <%= link_to "Logout", :controller => 'login', :action => 'logout' %> + | <%#= link_to "Logout", :controller => 'login', :action => 'logout' %> <%- else -%> -<%= link_to "Login", :controller => 'login', :action => 'login' %> +<%#= link_to "Login", :controller => 'login', :action => 'login' %> <%- end -%> +<%= link_to "Help", "http://etch.sourceforge.net/" %> </p> <h1 id="branding"><%= link_to "Etch", { :controller => 'dashboard' } %></h1> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-24 17:02:48
|
Revision: 318 http://etch.svn.sourceforge.net/etch/?rev=318&view=rev Author: jheiss Date: 2012-04-24 17:02:42 +0000 (Tue, 24 Apr 2012) Log Message: ----------- Ignore public/assets, which is where assets end up when you do a "rake assets:precompile" Property Changed: ---------------- trunk/server/public/ Property changes on: trunk/server/public ___________________________________________________________________ Added: svn:ignore + assets This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2012-04-24 17:01:18
|
Revision: 317 http://etch.svn.sourceforge.net/etch/?rev=317&view=rev Author: jheiss Date: 2012-04-24 17:01:12 +0000 (Tue, 24 Apr 2012) Log Message: ----------- chdir back to / after processing individual files or commands. We chdir into the directory for the individual file/command before processing it so that the user can refer to other files in the same directory using relative paths. In practice it hasn't caused any problems to leave the server chdir'd into that directory until it processes the next file, but it does generate sporadic errors from the test suite when the directory disappears as the repository is updated. So to be on the safe and robust side we now chdir back to / after processing an individual file or command. Modified Paths: -------------- trunk/server/lib/etch.rb Modified: trunk/server/lib/etch.rb =================================================================== --- trunk/server/lib/etch.rb 2012-04-24 16:58:35 UTC (rev 316) +++ trunk/server/lib/etch.rb 2012-04-24 17:01:12 UTC (rev 317) @@ -822,6 +822,10 @@ end end + # Earlier we chdir'd into the file's directory in the repository. It + # seems best not to leave this process with that as the cwd. + Dir.chdir('/') + # In addition to successful configs return configs for files that need # orig data (generation_status==false) because any setup commands might be # needed to create the original file. @@ -961,6 +965,10 @@ generation_status = :success end + # Earlier we chdir'd into the command's directory in the repository. It + # seems best not to leave this process with that as the cwd. + Dir.chdir('/') + # If filtering didn't remove all the content then add this to the list of # commands to be returned to the client. if generation_status && generation_status != :unknown && This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |