From: <jh...@us...> - 2011-06-01 01:04:27
|
Revision: 289 http://etch.svn.sourceforge.net/etch/?rev=289&view=rev Author: jheiss Date: 2011-06-01 01:04:21 +0000 (Wed, 01 Jun 2011) Log Message: ----------- Change varbase to vardir, to match configdir. Having configdir and varbase seemed odd in retrospect. Make configdir and vardir configurable via command-line options. Suggestion from Nate Johnston. Add additional debugging statement about the server URL in use. Suggestion from Nate Johnston. Modified Paths: -------------- trunk/client/bin/etch trunk/client/lib/etch/client.rb Modified: trunk/client/bin/etch =================================================================== --- trunk/client/bin/etch 2011-05-19 17:55:25 UTC (rev 288) +++ trunk/client/bin/etch 2011-06-01 01:04:21 UTC (rev 289) @@ -69,6 +69,12 @@ opts.on('--key PRIVATE_KEY', 'Use this private key for signing messages to server.') do |opt| options[:key] = opt end +opts.on('--configdir DIR', 'Directory containing etch.conf.') do |opt| + options[:configdir] = opt +end +opts.on('--vardir DIR', 'Directory for etch state and logs.') do |opt| + options[:vardir] = opt +end opts.on('--test-root TESTDIR', 'For use by the test suite only.') do |opt| options[:file_system_root] = opt end Modified: trunk/client/lib/etch/client.rb =================================================================== --- trunk/client/lib/etch/client.rb 2011-05-19 17:55:25 UTC (rev 288) +++ trunk/client/lib/etch/client.rb 2011-06-01 01:04:21 UTC (rev 289) @@ -49,7 +49,7 @@ CONFIRM_QUIT = 3 PRIVATE_KEY_PATHS = ["/etc/ssh/ssh_host_rsa_key", "/etc/ssh_host_rsa_key"] DEFAULT_CONFIGDIR = '/etc' - DEFAULT_VARBASE = '/var/etch' + DEFAULT_VARDIR = '/var/etch' DEFAULT_DETAILED_RESULTS = ['SERVER'] # We need these in relation to the output capturing @@ -60,6 +60,8 @@ 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] @@ -71,17 +73,14 @@ @key = options[:key] ? options[:key] : get_private_key_path @disableforce = options[:disableforce] @lockforce = options[:lockforce] - + @last_response = "" - @configdir = DEFAULT_CONFIGDIR - @varbase = DEFAULT_VARBASE - @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] - @varbase = File.join(@file_system_root, @varbase) + @vardir = File.join(@file_system_root, @vardir) @configdir = File.join(@file_system_root, @configdir) end @@ -149,10 +148,10 @@ @detailed_results = DEFAULT_DETAILED_RESULTS end - @origbase = File.join(@varbase, 'orig') - @historybase = File.join(@varbase, 'history') - @lockbase = File.join(@varbase, 'locks') - @requestbase = File.join(@varbase, 'requests') + @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'] @@ -222,6 +221,7 @@ # 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 @@ -572,7 +572,7 @@ end def check_for_disable_etch_file - disable_etch = File.join(@varbase, 'disable_etch') + disable_etch = File.join(@vardir, 'disable_etch') message = '' if File.exist?(disable_etch) if !@disableforce This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |