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: <jh...@us...> - 2010-10-20 18:37:30
|
Revision: 218 http://etch.svn.sourceforge.net/etch/?rev=218&view=rev Author: jheiss Date: 2010-10-20 18:37:23 +0000 (Wed, 20 Oct 2010) Log Message: ----------- Add --debug flag Ensure timezone is always set to UTC, see comments in script for details. Add support for a 'badfwd' state where we roll the client forward to the next good/non-bad tag, rather than rolling them back to the previous good/non-bad tag. Switch to nVentory's new get_objects syntax. Update with the actual field name (config_mgmt_tag) used in nVentory. Add logic to handle "temporary bump to trunk" tags from nVentory. Modified Paths: -------------- trunk/etchserver-samples/nventory/nodetagger Modified: trunk/etchserver-samples/nventory/nodetagger =================================================================== --- trunk/etchserver-samples/nventory/nodetagger 2010-10-05 00:23:29 UTC (rev 217) +++ trunk/etchserver-samples/nventory/nodetagger 2010-10-20 18:37:23 UTC (rev 218) @@ -4,11 +4,45 @@ # http://etch.wiki.sourceforge.net/ControlledDeployment ############################################################################## +require 'optparse' require 'nventory' -name = ARGV[0] or abort "No hostname passed" +# +# Parse the command line options +# +@debug = false + +opts = OptionParser.new +opts.banner = "Usage: #{File.basename($0)} [--debug] <hostname>" +opts.on('--debug', "Print messages about how the client's tag is determined") do |opt| + @debug = opt +end + +opts.on_tail("-h", "--help", "Show this message") do + puts opts + exit +end + +name = nil +leftovers = opts.parse(ARGV) +if leftovers.size == 1 + name = leftovers.first +else + puts opts + exit +end + # +# This script normally runs only on the etch servers and thus doesn't need to +# worry about timezone differences under standard operation. But for +# development and troubleshooting users might run it elsewhere. In which case +# it needs to execute with the same timezone setting as the etch servers. +# + +ENV['TZ'] = 'UTC' + +# # Load the tag state data # # This allows users to mark tags as good or bad. Here's a scenario to @@ -27,46 +61,89 @@ # implement a human review or change management process where only known-good # tags are allowed to propagate to production. # +# The rollback behavior doesn't work well when the bad change is a new +# file and the last not-bad tag doesn't contain any configuration for +# that file so the bad configuration remains in place until the fixed +# configuration catches up, which could be 5 hours. In those cases you +# can mark the bad tags with 'badfwd' if you want to have clients roll +# forward right away to the next not-bad tag so they pick up the fixed +# configuration right away. +# @tagstate = {} +valid_states = ['good', 'bad', 'badfwd'] tagstatefile = File.join(File.dirname(__FILE__), 'tagstate') if File.exist?(tagstatefile) IO.foreach(tagstatefile) do |line| next if line =~ /^\s*$/ # Skip blank lines next if line =~ /^\s*#/ # Skip comments tag, state = line.split - if state == 'good' || state == 'bad' + if valid_states.include?(state) @tagstate[tag] = state else - warn "Ignoring state #{state} for tag #{tag}, it's not 'good' or 'bad'" + warn "Ignoring state #{state} for tag #{tag}, it's not one of the valid states: #{valid_states.join(',')}" end end end -# This finds an autotag that is at least 'hoursago' old, isn't marked as bad, -# and is marked as good if 'needgoodtag' is true +# Shared with the repo_update script +def convert_tagtime_to_unixtime(tagdate, tagtime) + year, month, day = tagdate.unpack('A4A2A2') + hour, minute = tagtime.unpack('A2A2') + unixtime = Time.local(year, month, day, hour, minute, 0, 0) + unixtime +end + +def tagforhours(hours) + Time.at(Time.now - hours * 60 * 60).strftime('etchautotag-%Y%m%d-%H00') +end + def findautotag(hoursago, needgoodtag=false) tag = nil - hourcounter = hoursago - # Check back up to three days for an acceptable tag. The three day - # limit is arbitrary, but we need something so that we avoid going - # into an infinite loop if there simply isn't an acceptable tag. - while tag.nil? && hourcounter < 24*3 - proposedtag = Time.at(Time.now - hourcounter * 60 * 60).strftime('etchautotag-%Y%m%d-%H00') + + # Check the state for the 'hoursago' tag. If it is 'badfwd' then look + # forward for the next not-bad or good tag (depending on + # 'needgoodtag'). Otherwise check from that point backwards. + hoursagotag = tagforhours(hoursago) + hours_to_check = [] + if @tagstate[hoursagotag] == 'badfwd' + puts "Tag #{hoursagotag} is badfwd, looking forward rather than backward" if (@debug) + (hoursago-1).downto(0) do |hour| + hours_to_check << hour + end + else + # Check back up to three days for an acceptable tag. The three day + # limit is arbitrary, but we need something so that we avoid going + # into an infinite loop if there simply isn't an acceptable tag. + hoursago.upto(24*3) do |hour| + hours_to_check << hour + end + end + + hours_to_check.each do |hour| + proposedtag = tagforhours(hour) + puts "Checking tag #{proposedtag} for #{hour} hours ago" if (@debug) # If we need a 'good' tag then check that the proposed tag is # marked as 'good'. - if needgoodtag && - !@tagstate[proposedtag].nil? && - @tagstate[proposedtag] == 'good' - tag = proposedtag - end + if needgoodtag + if @tagstate[proposedtag] == 'good' + tag = proposedtag + puts "Need good tag, proposed tag is good" if (@debug) + break + else + puts "Need good tag, proposed tag is not good" if (@debug) + end + else # If we don't need a 'good' tag then check that either the # proposed tag has no state (unknown, and presumed good in this # case), or has a state that isn't 'bad'. - if !needgoodtag && - (@tagstate[proposedtag].nil? || @tagstate[proposedtag] != 'bad') - tag = proposedtag + if @tagstate[proposedtag].nil? || @tagstate[proposedtag] !~ /^bad/ + tag = proposedtag + puts "Need !bad tag, proposed tag is #{@tagstate[proposedtag]} and thus acceptable" if (@debug) + break + else + puts "Need !bad tag, proposed tag is #{@tagstate[proposedtag]} and thus not acceptable" if (@debug) + end end - hourcounter += 1 end if tag.nil? @@ -82,45 +159,74 @@ # nvclient = NVentory::Client.new -results = nvclient.get_objects('nodes', {}, { 'name' => name }, {}, {}, ['node_groups']) +results = nvclient.get_objects(:objecttype => 'nodes', :exactget => { 'name' => name }, :includes => ['node_groups']) -tag = '' +tag = nil DEFAULT_HOURS = 4 hours = DEFAULT_HOURS if !results.empty? && !results[name].nil? - if !results[name]['config_management_tag'].nil? && - !results[name]['config_management_tag'].empty? - tag = results[name]['config_management_tag'] - else - if !results[name]['node_groups'].nil? - node_group_names = results[name]['node_groups'].collect { |ng| ng['name'] } - case - when node_group_names.include?('dev') || node_group_names.include?('int') - hours = 0 - when node_group_names.include?('qa') - hours = 1 - when node_group_names.include?('stg') - hours = 2 - end + if !results[name]['node_groups'].nil? + node_group_names = results[name]['node_groups'].collect { |ng| ng['name'] } + case + when node_group_names.include?('dev') || node_group_names.include?('int') + hours = 0 + when node_group_names.include?('qa') + hours = 1 + when node_group_names.include?('stg') + hours = 2 end - - # For production nodes we want to divide them based on our - # failover/BCP strategy so that we deploy changes in such a way that - # a bad change doesn't take out all failover groups at once. With - # multiple data centers and global load balancing this could mean - # deploying to one data center and then the other. Or you could base - # it on other node groups. In other words this section should set about - # half your machines to hours = 3, and then the remaining systems will - # get the default number of hours below. - if hours == DEFAULT_HOURS - # nVentory query for DC goes here + end + + # For production nodes we want to divide them based on our + # failover/BCP strategy so that we deploy changes in such a way that + # a bad change doesn't take out all failover groups at once. With + # multiple data centers and global load balancing this could mean + # deploying to one data center and then the other. Or you could base + # it on other node groups. In other words this section should set about + # half your machines to hours = 3, and then the remaining systems will + # get the default number of hours below. + if hours == DEFAULT_HOURS + if false # <-- YOU NEED TO PUT SITE-APPROPRIATE LOGIC HERE + hours = 3 end end + + puts "Based on node groups and location this node gets hours #{hours}" if (@debug) + + if !results[name]['config_mgmt_tag'].nil? && + !results[name]['config_mgmt_tag'].empty? + nvtag = results[name]['config_mgmt_tag'] + puts "Tag from nVentory: #{nvtag}" if (@debug) + # Tags starting with trunk- are used to temporarily bump clients to trunk + if nvtag =~ /^trunk-(\d{8})-(\d{4})$/ + tagunixtime = convert_tagtime_to_unixtime($1, $2) + puts "nVentory tag looks like a temporary bump to trunk tag" if (@debug) + puts "tagunixtime #{tagunixtime}" if (@debug) + # If the timestamp is less than "hours" old the client gets trunk, + # otherwise the client gets its normal tag based on "hours". Ignore + # timestamps in the future too, so if someone inserts something way in + # the future the client isn't stuck on trunk forever. + timelimit = Time.at(Time.now - 60 * 60 * hours) + puts "timelimit #{timelimit}" if (@debug) + puts "now #{Time.now}" if (@debug) + if tagunixtime > timelimit && tagunixtime <= Time.now + puts "Temporary bump to trunk tag is within acceptable time window" if (@debug) + tag = 'trunk' + else + puts "Temporary bump to trunk tag is outside acceptable time window" if (@debug) + end + else + puts "nVentory tag not a temporary bump to trunk tag, using tag as-is" if (@debug) + tag = nvtag + end + else + puts "No tag found in nVentory for this node" if (@debug) + end end if tag.nil? || tag.empty? - tag = findautotag(hours) + tag = File.join('tags', findautotag(hours)) end -puts File.join('tags', tag) +puts tag This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-10-05 00:23:35
|
Revision: 217 http://etch.svn.sourceforge.net/etch/?rev=217&view=rev Author: jheiss Date: 2010-10-05 00:23:29 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Comment on the non-standard options to OptionParser since they are decidely non-obvious. Modified Paths: -------------- trunk/client/etch Modified: trunk/client/etch =================================================================== --- trunk/client/etch 2010-10-05 00:22:27 UTC (rev 216) +++ trunk/client/etch 2010-10-05 00:23:29 UTC (rev 217) @@ -16,6 +16,9 @@ options = {} @generateall = nil +# Extra options to OptionParser reduce the amount of whitespace it introduces +# into the help message, making it easier to make the help message fit in a +# 80x24 window. opts = OptionParser.new(nil, 24, ' ') opts.banner = 'Usage: etch [options] [/path/to/config/file | command] [otherfile ...]' opts.on('--generate-all', 'Request all configuration.') do |opt| This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-10-05 00:22:33
|
Revision: 216 http://etch.svn.sourceforge.net/etch/?rev=216&view=rev Author: jheiss Date: 2010-10-05 00:22:27 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Test that we don't follow redirects. This was part of an aborted plan to implement support for following redirects. Modified Paths: -------------- trunk/test/test_options.rb Modified: trunk/test/test_options.rb =================================================================== --- trunk/test/test_options.rb 2010-10-05 00:21:22 UTC (rev 215) +++ trunk/test/test_options.rb 2010-10-05 00:22:27 UTC (rev 216) @@ -5,6 +5,7 @@ # require File.join(File.dirname(__FILE__), 'etchtest') +require 'webrick' class EtchOptionTests < Test::Unit::TestCase include EtchTests @@ -421,6 +422,87 @@ assert_equal(sourcecontents, get_file_contents(targetfile3), testname + ' cmdandfile file 3') end + def test_redirects + # + # Test that we do not follow HTTP redirects + # + testname = 'do not follow redirects by default' + + # Put some text into the original file so that we can make sure it is + # not touched. + origcontents = "This is the original text\n" + File.open(@targetfile, 'w') do |file| + file.write(origcontents) + end + + FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") + File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| + file.puts <<-EOF + <config> + <file> + <warning_file/> + <source> + <plain>source</plain> + </source> + </file> + </config> + EOF + end + + sourcecontents = "This is a test\n" + File.open("#{@repodir}/source/#{@targetfile}/source", 'w') do |file| + file.write(sourcecontents) + end + + # Set up a web server which redirects to the test server + redirect_port = 3500 + server = WEBrick::HTTPServer.new(:Port => redirect_port) + # Trap signals to invoke the shutdown procedure cleanly + ['INT', 'TERM'].each do |signal| + trap(signal){ server.shutdown } + end + server.mount_proc("/") do |request, response| + # Oddly request.request_uri is a URI::HTTP object, so you have to call + # the request_uri method on it to get the actual request uri + response.set_redirect( + WEBrick::HTTPStatus::Found, + URI.join("http://localhost:#{@server[:port]}/", request.request_uri.request_uri)) + end + t = Thread.new { server.start } + # Give webrick time to start + sleep(5) + + # Test that we don't follow redirects by default + run_etch(@server, @testbase, true, '', redirect_port) + assert_equal(origcontents, get_file_contents(@targetfile), testname) + + # Check that we do follow redirects with the appropriate option + # NOTE: Due to lack of need/demand we have not yet implemented an option + # to follow redirects + # testname = 'follow redirects with --follow-redirects' + # run_etch(@server, @testbase, false, '--follow-redirects', redirect_port) + # assert_equal(sourcecontents, get_file_contents(@targetfile), testname) + + # Test redirect with valid SSL + + # Test redirect where the first server has an invalid SSL cert but + # redirects to a server with an valid cert + + # Test redirect where the first server has a valid SSL cert but + # redirects to a server with an invalid cert + + # Test that we don't follow infinite redirects + testname = 'infinite redirects' + server.mount_proc("/") do |request, response| + response.set_redirect( + WEBrick::HTTPStatus::Found, "http://localhost:#{redirect_port}/") + end + run_etch(@server, @testbase, true, '', redirect_port) + + server.shutdown + t.kill + end + def teardown remove_repository(@repodir) FileUtils.rm_rf(@testbase) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-10-05 00:21:29
|
Revision: 215 http://etch.svn.sourceforge.net/etch/?rev=215&view=rev Author: jheiss Date: 2010-10-05 00:21:22 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Add a port argument to the run_etch method to allow callers to specify a port other than the one the server is listening on. Modified Paths: -------------- trunk/test/etchtest.rb Modified: trunk/test/etchtest.rb =================================================================== --- trunk/test/etchtest.rb 2010-10-05 00:19:13 UTC (rev 214) +++ trunk/test/etchtest.rb 2010-10-05 00:21:22 UTC (rev 215) @@ -74,6 +74,11 @@ def get_server(newrepo=nil) if !@@server @@server = start_server + # FIXME: This doesn't get called for some reason, I suspect TestTask or + # Test::Unit are interfering since they probably also use trap to + # implement their magic. As a result we end up leaving the server + # running in the background. + trap("EXIT") { stop_server(@@server) } end if newrepo swap_repository(@@server, newrepo) @@ -117,8 +122,11 @@ Process.waitpid(server[:pid]) end - def run_etch(server, testbase, errors_expected=false, extra_args='') + def run_etch(server, testbase, errors_expected=false, extra_args='', port=nil) extra_args = extra_args + " --debug" + if !port + port = server[:port] + end if errors_expected # Warn the user that errors are expected. Otherwise it can be # disconcerting if you're watching the tests run and see errors. @@ -128,7 +136,7 @@ puts "#" #sleep 3 end - result = system("ruby #{CLIENTDIR}/etch --generate-all --server=http://localhost:#{server[:port]} --test-base=#{testbase} --key=#{File.dirname(__FILE__)}/keys/testkey #{extra_args}") + result = system("ruby #{CLIENTDIR}/etch --generate-all --server=http://localhost:#{port} --test-base=#{testbase} --key=#{File.dirname(__FILE__)}/keys/testkey #{extra_args}") if errors_expected assert(!result) else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-10-05 00:19:19
|
Revision: 214 http://etch.svn.sourceforge.net/etch/?rev=214&view=rev Author: jheiss Date: 2010-10-05 00:19:13 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Update years in copyright declaration. Modified Paths: -------------- trunk/LICENSE Modified: trunk/LICENSE =================================================================== --- trunk/LICENSE 2010-10-05 00:18:42 UTC (rev 213) +++ trunk/LICENSE 2010-10-05 00:19:13 UTC (rev 214) @@ -3,7 +3,7 @@ etch 1.x Copyright (c) <2003> <Jason Heiss> etch 3.x is a derivative work of etch 1.x -Copyright (c) <2008,2009> <YELLOWPAGES.COM LLC> +Copyright (c) <2008,2009,2010> <YELLOWPAGES.COM LLC> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-10-05 00:18:48
|
Revision: 213 http://etch.svn.sourceforge.net/etch/?rev=213&view=rev Author: jheiss Date: 2010-10-05 00:18:42 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Increase production sqlite timeout per recommendations I found on the interwebs. Only one client can lock sqlite for writing at a time. In a large environment this lock contention can lead to client timeouts even though the server has sufficient resources to serve the number of clients. Very few requests are associated with interactive users so a relatively long timeout is acceptable. Modified Paths: -------------- trunk/server/config/database.yml Modified: trunk/server/config/database.yml =================================================================== --- trunk/server/config/database.yml 2010-08-12 08:06:28 UTC (rev 212) +++ trunk/server/config/database.yml 2010-10-05 00:18:42 UTC (rev 213) @@ -16,4 +16,4 @@ production: adapter: sqlite3 database: db/production.sqlite3 - timeout: 5000 + timeout: 20000 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-08-12 08:06:35
|
Revision: 212 http://etch.svn.sourceforge.net/etch/?rev=212&view=rev Author: jheiss Date: 2010-08-12 08:06:28 +0000 (Thu, 12 Aug 2010) Log Message: ----------- Tag 3.16.0 release Modified Paths: -------------- Rakefile tags/release-3.16.0/VERSION Added Paths: ----------- tags/release-3.16.0/ Modified: Rakefile =================================================================== --- Rakefile 2010-08-12 08:05:44 UTC (rev 211) +++ Rakefile 2010-08-12 08:06:28 UTC (rev 212) @@ -1,4 +1,4 @@ -ETCHVER = '3.15.2' +ETCHVER = '3.16.0' TAGNAME = "release-#{ETCHVER}" TAGDIR = "tags/#{TAGNAME}" DIST = "etch-#{ETCHVER}" Modified: tags/release-3.16.0/VERSION =================================================================== --- trunk/VERSION 2010-08-12 07:48:08 UTC (rev 210) +++ tags/release-3.16.0/VERSION 2010-08-12 08:06:28 UTC (rev 212) @@ -1 +1 @@ -trunk +3.16.0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-08-12 08:05:50
|
Revision: 211 http://etch.svn.sourceforge.net/etch/?rev=211&view=rev Author: jheiss Date: 2010-08-12 08:05:44 +0000 (Thu, 12 Aug 2010) Log Message: ----------- Remove Makefile, it has been deprecated in favor of the Rakefile for a while Removed Paths: ------------- Makefile Deleted: Makefile =================================================================== --- Makefile 2010-08-12 07:48:08 UTC (rev 210) +++ Makefile 2010-08-12 08:05:44 UTC (rev 211) @@ -1,27 +0,0 @@ -# Deprecated, see Rakefile - -VER=3.11 -TAGNAME=release-$(VER) - -all: dist - -test: - -dist: test - mkdir etch-$(VER) - (cd tags/$(TAGNAME) && find client server test etchserver-* README | grep -v '\.svn' | cpio -pdum ../../etch-$(VER)) - tar czf etch-$(VER).tar.gz etch-$(VER) - rm -rf etch-$(VER) - openssl md5 etch-$(VER).tar.gz > etch-$(VER).tar.gz.md5 - openssl sha1 etch-$(VER).tar.gz > etch-$(VER).tar.gz.sha1 - gpg --detach --armor etch-$(VER).tar.gz - -tag: - svn copy trunk tags/$(TAGNAME) -# Remove files that aren't in svn -# $$ to escape $ from make - svn status tags/$(TAGNAME) | grep '^?' | awk '{print $$2}' | xargs rm -rf - -clean: - rm etch-*.tar.gz* - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-08-12 07:48:14
|
Revision: 210 http://etch.svn.sourceforge.net/etch/?rev=210&view=rev Author: jheiss Date: 2010-08-12 07:48:08 +0000 (Thu, 12 Aug 2010) Log Message: ----------- Adjust require of facter to also require rubygems if needed Modified Paths: -------------- trunk/test/test_auth.rb Modified: trunk/test/test_auth.rb =================================================================== --- trunk/test/test_auth.rb 2010-08-12 06:24:51 UTC (rev 209) +++ trunk/test/test_auth.rb 2010-08-12 07:48:08 UTC (rev 210) @@ -7,7 +7,14 @@ require File.join(File.dirname(__FILE__), 'etchtest') require 'net/http' require 'rexml/document' -require 'facter' +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 class EtchAuthTests < Test::Unit::TestCase include EtchTests This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-08-12 06:24:58
|
Revision: 209 http://etch.svn.sourceforge.net/etch/?rev=209&view=rev Author: jheiss Date: 2010-08-12 06:24:51 +0000 (Thu, 12 Aug 2010) Log Message: ----------- In the test_nested_target method in test_actions.rb there was a section of code which called Tempfile.new('etchtest').path, then immediately deleted the file and replaced it with a directory. The Tempfile object would get garbage collected later and Tempfile would throw an error attempting to delete what was now a directory. Replace that with a call to deleted_tempfile so that Tempfile doesn't try to clean things up later. Replace a bunch of instances of Tempfile.new('etchtest').path with a new method released_tempfile, which explicitly does a close! on the Tempfile and then recreates the file. It may be overly paranoid of me, but it seems that depending on Ruby to more or less immediately garbage collect the Tempfile object is not ideal. Modified Paths: -------------- trunk/test/etchtest.rb trunk/test/test_actions.rb trunk/test/test_attributes.rb trunk/test/test_auth.rb trunk/test/test_commands.rb trunk/test/test_delete.rb trunk/test/test_depend.rb trunk/test/test_file.rb trunk/test/test_history.rb trunk/test/test_link.rb trunk/test/test_local_requests.rb trunk/test/test_nodegroups.rb trunk/test/test_options.rb trunk/test/test_outputcapture.rb trunk/test/test_scripts.rb trunk/test/test_transitions.rb Modified: trunk/test/etchtest.rb =================================================================== --- trunk/test/etchtest.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/etchtest.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,12 +11,32 @@ SERVERDIR = "#{File.dirname(File.dirname(File.expand_path(__FILE__)))}/server" CLIENTDIR = "#{File.dirname(File.dirname(File.expand_path(__FILE__)))}/client" + # Creates a temporary file via Tempfile, capture the filename, tell Tempfile + # to clean up, then return the path. This gives the caller a filename that + # they should be able to write to, that was recently unused and unique, and + # that Tempfile won't try to clean up later. This can be useful when the + # caller might want a path to use for symlinks, directories, etc. where + # Tempfile might choke trying to clean up what it expects to be a plain + # file. + def deleted_tempfile + tmpfile = Tempfile.new('etchtest') + tmppath = tmpfile.path + tmpfile.close! + tmppath + end + # Creates a file via Tempfile but then arranges for Tempfile to release it + # so that the caller doesn't have to worry about Tempfile cleaning it up + # later at an inopportune time. It is up to the caller to ensure the file + # is cleaned up. + def released_tempfile + tmppath = deleted_tempfile + File.open(tmppath, 'w') {|file|} + tmppath + end # Haven't found a Ruby method for creating temporary directories, # so create a temporary file and replace it with a directory. def tempdir - tmpfile = Tempfile.new('etchtest') - tmpdir = tmpfile.path - tmpfile.close! + tmpdir = deleted_tempfile Dir.mkdir(tmpdir) tmpdir end Modified: trunk/test/test_actions.rb =================================================================== --- trunk/test/test_actions.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_actions.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,7 +11,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository @@ -23,7 +23,7 @@ #puts "Using #{@testbase} as client working directory" # Generate another file to use as our link target - @destfile = Tempfile.new('etchtest').path + @destfile = released_tempfile #puts "Using #{@destfile} as link destination file" end @@ -345,8 +345,7 @@ # that /etc/foo exist first. # - nestedtargetdir = Tempfile.new('etchtest').path - File.delete(nestedtargetdir) + nestedtargetdir = deleted_tempfile nestedtargetfile = File.join(nestedtargetdir, 'etchnestedtest') FileUtils.mkdir_p("#{@repodir}/source/#{nestedtargetfile}") @@ -377,6 +376,8 @@ # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(nestedtargetfile), 'nested target with test') + + FileUtils.rm_rf(nestedtargetdir) end def test_action_with_xml_escape Modified: trunk/test/test_attributes.rb =================================================================== --- trunk/test/test_attributes.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_attributes.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -13,7 +13,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository Modified: trunk/test/test_auth.rb =================================================================== --- trunk/test/test_auth.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_auth.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -14,7 +14,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository Modified: trunk/test/test_commands.rb =================================================================== --- trunk/test/test_commands.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_commands.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,7 +11,7 @@ def setup # Generate a file to use as a target in commands - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository @@ -249,7 +249,7 @@ # testname = 'command with file dependency' - targetfile2 = Tempfile.new('etchtest').path + targetfile2 = released_tempfile FileUtils.mkdir_p("#{@repodir}/source/#{targetfile2}") File.open("#{@repodir}/source/#{targetfile2}/config.xml", 'w') do |file| file.puts <<-EOF Modified: trunk/test/test_delete.rb =================================================================== --- trunk/test/test_delete.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_delete.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,7 +11,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository @@ -23,7 +23,7 @@ #puts "Using #{@testbase} as client working directory" # Generate another file to use as our link target - @destfile = Tempfile.new('etchtest').path + @destfile = released_tempfile #puts "Using #{@destfile} as link destination file" end Modified: trunk/test/test_depend.rb =================================================================== --- trunk/test/test_depend.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_depend.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,9 +11,9 @@ def setup # Generate a couple of files to use as our etch target/destinations - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" - @targetfile2 = Tempfile.new('etchtest').path + @targetfile2 = released_tempfile #puts "Using #{@targetfile2} as 2nd target file" # Generate a directory for our test repository Modified: trunk/test/test_file.rb =================================================================== --- trunk/test/test_file.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_file.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,7 +11,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository Modified: trunk/test/test_history.rb =================================================================== --- trunk/test/test_history.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_history.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -12,7 +12,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository @@ -256,7 +256,7 @@ # # Generate another file to use as our link target - @destfile = Tempfile.new('etchtest').path + @destfile = released_tempfile # Make the original target a link File.delete(@targetfile) Modified: trunk/test/test_link.rb =================================================================== --- trunk/test/test_link.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_link.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -12,7 +12,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Delete the target file so that we're starting with nothing. Creating @@ -28,8 +28,8 @@ #puts "Using #{@testbase} as client working directory" # Generate a couple more files to use as our link targets - @destfile = Tempfile.new('etchtest').path - @destfile2 = Tempfile.new('etchtest').path + @destfile = released_tempfile + @destfile2 = released_tempfile #puts "Using #{@destfile} as link destination file" end Modified: trunk/test/test_local_requests.rb =================================================================== --- trunk/test/test_local_requests.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_local_requests.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,7 +11,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository Modified: trunk/test/test_nodegroups.rb =================================================================== --- trunk/test/test_nodegroups.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_nodegroups.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,7 +11,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository Modified: trunk/test/test_options.rb =================================================================== --- trunk/test/test_options.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_options.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -11,7 +11,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository @@ -136,7 +136,7 @@ </config> EOF end - targetfile2 = Tempfile.new('etchtest').path + targetfile2 = released_tempfile FileUtils.mkdir_p("#{@repodir}/source/#{targetfile2}") File.open("#{@repodir}/source/#{targetfile2}/config.xml", 'w') do |file| file.puts <<-EOF @@ -150,7 +150,7 @@ </config> EOF end - targetfile3 = Tempfile.new('etchtest').path + targetfile3 = released_tempfile FileUtils.mkdir_p("#{@repodir}/source/#{targetfile3}") File.open("#{@repodir}/source/#{targetfile3}/config.xml", 'w') do |file| file.puts <<-EOF @@ -172,7 +172,7 @@ end end - cmdtargetfile1 = Tempfile.new('etchtest').path + cmdtargetfile1 = released_tempfile FileUtils.mkdir_p("#{@repodir}/commands/etchtest1") File.open("#{@repodir}/commands/etchtest1/commands.xml", 'w') do |file| file.puts <<-EOF @@ -188,7 +188,7 @@ </commands> EOF end - cmdtargetfile2 = Tempfile.new('etchtest').path + cmdtargetfile2 = released_tempfile FileUtils.mkdir_p("#{@repodir}/commands/etchtest2") File.open("#{@repodir}/commands/etchtest2/commands.xml", 'w') do |file| file.puts <<-EOF @@ -204,7 +204,7 @@ </commands> EOF end - cmdtargetfile3 = Tempfile.new('etchtest').path + cmdtargetfile3 = released_tempfile FileUtils.mkdir_p("#{@repodir}/commands/etchtest3") File.open("#{@repodir}/commands/etchtest3/commands.xml", 'w') do |file| file.puts <<-EOF @@ -266,8 +266,8 @@ # testname = 'command line file requests with depends' - targetfile2 = Tempfile.new('etchtest').path - targetfile3 = Tempfile.new('etchtest').path + targetfile2 = released_tempfile + targetfile3 = released_tempfile FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| file.puts <<-EOF @@ -333,8 +333,8 @@ # testname = 'mixed command line requests with depends' - targetfile2 = Tempfile.new('etchtest').path - targetfile3 = Tempfile.new('etchtest').path + targetfile2 = released_tempfile + targetfile3 = released_tempfile FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| file.puts <<-EOF @@ -384,7 +384,7 @@ end end - cmdtargetfile1 = Tempfile.new('etchtest').path + cmdtargetfile1 = released_tempfile FileUtils.mkdir_p("#{@repodir}/commands/etchtest1") File.open("#{@repodir}/commands/etchtest1/commands.xml", 'w') do |file| file.puts <<-EOF Modified: trunk/test/test_outputcapture.rb =================================================================== --- trunk/test/test_outputcapture.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_outputcapture.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -15,7 +15,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository Modified: trunk/test/test_scripts.rb =================================================================== --- trunk/test/test_scripts.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_scripts.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -12,7 +12,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository @@ -233,7 +233,7 @@ end # Generate a file to use as our link target - @destfile = Tempfile.new('etchtest').path + @destfile = released_tempfile File.open("#{@repodir}/source/#{@targetfile}/link.script", 'w') do |file| file.puts("@contents << '#{@destfile}'") end Modified: trunk/test/test_transitions.rb =================================================================== --- trunk/test/test_transitions.rb 2010-06-28 22:02:45 UTC (rev 208) +++ trunk/test/test_transitions.rb 2010-08-12 06:24:51 UTC (rev 209) @@ -12,7 +12,7 @@ def setup # Generate a file to use as our etch target/destination - @targetfile = Tempfile.new('etchtest').path + @targetfile = released_tempfile #puts "Using #{@targetfile} as target file" # Generate a directory for our test repository @@ -24,7 +24,7 @@ #puts "Using #{@testbase} as client working directory" # Generate another file to use as our link target - @destfile = Tempfile.new('etchtest').path + @destfile = released_tempfile end # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-06-28 22:02:51
|
Revision: 208 http://etch.svn.sourceforge.net/etch/?rev=208&view=rev Author: jheiss Date: 2010-06-28 22:02:45 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Fix paths in test tasks Modified Paths: -------------- Rakefile Modified: Rakefile =================================================================== --- Rakefile 2010-06-25 17:03:50 UTC (rev 207) +++ Rakefile 2010-06-28 22:02:45 UTC (rev 208) @@ -5,12 +5,12 @@ desc 'Run test suite in trunk' task :test_trunk do - system('cd trunk/client && rake test') + system('cd trunk && rake test') end desc 'Run test suite in current tag' task :test_tag do - system("cd #{TAGDIR}/client && rake test") + system("cd #{TAGDIR} && rake test") end desc 'Build distribution files for new release' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-06-25 17:04:00
|
Revision: 207 http://etch.svn.sourceforge.net/etch/?rev=207&view=rev Author: jheiss Date: 2010-06-25 17:03:50 +0000 (Fri, 25 Jun 2010) Log Message: ----------- Update from rails 2.3.4 to rails 2.3.8. Update gem name mislav-will_paginate to will_paginate. Change :session_key to :key per deprecation warning with newer rails version. Modified Paths: -------------- trunk/server/config/environment.rb Modified: trunk/server/config/environment.rb =================================================================== --- trunk/server/config/environment.rb 2010-06-25 16:59:05 UTC (rev 206) +++ trunk/server/config/environment.rb 2010-06-25 17:03:50 UTC (rev 207) @@ -5,7 +5,7 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -25,7 +25,7 @@ # config.gem "bj" # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" # config.gem "aws-s3", :lib => "aws/s3" - config.gem 'mislav-will_paginate', :version => '~> 2.3.8', :lib => 'will_paginate', :source => 'http://gems.github.com' + config.gem 'will_paginate', :version => '~> 2.3.8' # Only load the plugins named here, in the order given. By default, all plugins # in vendor/plugins are loaded in alphabetical order. @@ -49,8 +49,8 @@ # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. config.action_controller.session = { - :session_key => '_trunk_session', - :secret => '9b1c27a35892d8fbbb50ed309d09c02962f56b739f3ce521c99df3c4f8a2f611bc21ab9fdce060de62b091b06b9e879a7b10a82ab908c286463659f73cace48f' + :key => '_trunk_session', + :secret => '9b1c27a35892d8fbbb50ed309d09c02962f56b739f3ce521c99df3c4f8a2f611bc21ab9fdce060de62b091b06b9e879a7b10a82ab908c286463659f73cace48f' } # Use the database for sessions instead of the cookie-based default, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-06-25 16:59:11
|
Revision: 206 http://etch.svn.sourceforge.net/etch/?rev=206&view=rev Author: jheiss Date: 2010-06-25 16:59:05 +0000 (Fri, 25 Jun 2010) Log Message: ----------- Fix it so that things don't blow up if the local option is not specified. Modified Paths: -------------- trunk/client/etchclient.rb Modified: trunk/client/etchclient.rb =================================================================== --- trunk/client/etchclient.rb 2010-04-20 00:45:31 UTC (rev 205) +++ trunk/client/etchclient.rb 2010-06-25 16:59:05 UTC (rev 206) @@ -53,7 +53,7 @@ @server = options[:server] ? options[:server] : 'https://etch' @tag = options[:tag] @varbase = options[:varbase] ? options[:varbase] : '/var/etch' - @local = File.expand_path(options[:local]) + @local = options[:local] ? File.expand_path(options[:local]) : nil @debug = options[:debug] @dryrun = options[:dryrun] @interactive = options[:interactive] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-04-20 00:45:37
|
Revision: 205 http://etch.svn.sourceforge.net/etch/?rev=205&view=rev Author: jheiss Date: 2010-04-20 00:45:31 +0000 (Tue, 20 Apr 2010) Log Message: ----------- Pass local path through File.expand_path so that @sitelibbase and other variables still work regardless of any chdir activity. Modified Paths: -------------- trunk/client/etchclient.rb Modified: trunk/client/etchclient.rb =================================================================== --- trunk/client/etchclient.rb 2010-03-31 17:00:15 UTC (rev 204) +++ trunk/client/etchclient.rb 2010-04-20 00:45:31 UTC (rev 205) @@ -53,7 +53,7 @@ @server = options[:server] ? options[:server] : 'https://etch' @tag = options[:tag] @varbase = options[:varbase] ? options[:varbase] : '/var/etch' - @local = options[:local] + @local = File.expand_path(options[:local]) @debug = options[:debug] @dryrun = options[:dryrun] @interactive = options[:interactive] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-03-31 17:00:23
|
Revision: 204 http://etch.svn.sourceforge.net/etch/?rev=204&view=rev Author: jheiss Date: 2010-03-31 17:00:15 +0000 (Wed, 31 Mar 2010) Log Message: ----------- When we catch and re-raise exceptions (in order to add additional info to the exception message) from user code (processing user XML, scripts, and templates) set the re-raised exception's backtrace to the original backtrace so that the backtrace info is not lost. Added method self.wrap_exception to handle this. Modified Paths: -------------- trunk/server/lib/etch.rb Modified: trunk/server/lib/etch.rb =================================================================== --- trunk/server/lib/etch.rb 2010-03-31 01:29:46 UTC (rev 203) +++ trunk/server/lib/etch.rb 2010-03-31 17:00:15 UTC (rev 204) @@ -266,7 +266,7 @@ begin configfilter!(Etch.xmlroot(config_xml)) rescue Exception => e - raise e.exception("Error filtering config.xml for #{file}:\n" + e.message) + raise Etch.wrap_exception(e, "Error filtering config.xml for #{file}:\n" + e.message) end # Validate the filtered file against config.dtd @@ -842,7 +842,7 @@ begin configfilter!(Etch.xmlroot(commands_xml)) rescue Exception => e - raise e.exception("Error filtering commands.xml for #{command}:\n" + e.message) + raise Etch.wrap_exception(e, "Error filtering commands.xml for #{command}:\n" + e.message) end # Validate the filtered file against commands.dtd @@ -911,12 +911,12 @@ raise "Inconsistent command 'exec' entries for #{command}: " + command_exec_elements.collect {|elem| Etch.xmltext(elem)}.join(',') end - # If filtering has removed both the guard and command elements - # we can remove this step. + # If filtering has removed both the guard and command elements + # we can remove this step. if guard_exec_elements.empty? && command_exec_elements.empty? remove << step - # If filtering has removed the guard but not the command or vice - # versa that's an error. + # If filtering has removed the guard but not the command or vice + # versa that's an error. elsif guard_exec_elements.empty? raise "Filtering removed guard, but left command: " + Etch.xmltext(command_exec_elements.first) @@ -1328,6 +1328,16 @@ raise "Unknown @xmllib #{@xmllib}" end end + + # Used where we wish to capture an exception and modify the message. This + # method returns a new exception with desired message but with the backtrace + # from the original exception so that the backtrace info is not lost. This + # is necessary because Exception lacks a set_message method. + def self.wrap_exception(e, message) + eprime = e.exception(message) + eprime.set_backtrace(e.backtrace) + eprime + end end class EtchExternalSource @@ -1363,7 +1373,7 @@ rescue Exception => e # Help the user figure out where the exception occurred, otherwise they # just get told it happened here, which isn't very helpful. - raise e.exception("Exception while processing template #{template} for file #{@file}:\n" + e.message) + raise Etch.wrap_exception(e, "Exception while processing template #{template} for file #{@file}:\n" + e.message) end end @@ -1382,7 +1392,7 @@ else # Help the user figure out where the exception occurred, otherwise they # just get told it happened here in eval, which isn't very helpful. - raise e.exception("Exception while processing script #{script} for file #{@file}:\n" + e.message) + raise Etch.wrap_exception(e, "Exception while processing script #{script} for file #{@file}:\n" + e.message) end end @contents This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-03-31 01:29:52
|
Revision: 203 http://etch.svn.sourceforge.net/etch/?rev=203&view=rev Author: jheiss Date: 2010-03-31 01:29:46 +0000 (Wed, 31 Mar 2010) Log Message: ----------- Fix the logic in start_server so that we call close! on the Tempfile before repurposing it. Otherwise we risk having Tempfile do its automatic cleanup later on if the object hasn't yet be destroyed. Modified Paths: -------------- trunk/test/etchtest.rb Modified: trunk/test/etchtest.rb =================================================================== --- trunk/test/etchtest.rb 2010-03-30 23:54:35 UTC (rev 202) +++ trunk/test/etchtest.rb 2010-03-31 01:29:46 UTC (rev 203) @@ -71,13 +71,15 @@ 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. - serverbase = Tempfile.new('etchtest').path - File.delete(serverbase) + serverbasefile = Tempfile.new('etchtest') + serverbase = serverbasefile.path + serverbasefile.close! File.symlink(repo, serverbase) ENV['etchserverbase'] = serverbase # Pick a random port in the 3001-6000 range (range somewhat randomly chosen) port = 3001 + rand(3000) if pid = fork + # FIXME: replace this with a check that the server has started puts "Giving the server some time to start up" sleep(5) else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-03-30 23:54:41
|
Revision: 202 http://etch.svn.sourceforge.net/etch/?rev=202&view=rev Author: jheiss Date: 2010-03-30 23:54:35 +0000 (Tue, 30 Mar 2010) Log Message: ----------- Remove the comment about the server getting started for each test method since that hasn't been the case for a while. Modified Paths: -------------- trunk/test/README Modified: trunk/test/README =================================================================== --- trunk/test/README 2010-03-02 21:34:41 UTC (rev 201) +++ trunk/test/README 2010-03-30 23:54:35 UTC (rev 202) @@ -6,10 +6,9 @@ To force a particular XML library set xmllib=libxml or xmllib=rexml in your environment before running the tests. -Some of the older files here have all of their tests in one method. Over time -I'm breaking those up into multiple methods so that it is easier to run a -specific test when debugging an issue. New test cases should be placed in -their own test method. It's a bit slower because the server has to be started -up for each method, but it makes running individual tests for debugging much -more pleasant. +Some of the older files here have all of their tests in one method. Over +time I'm breaking those up into multiple methods so that it is easier to +run a specific test when debugging an issue. New test cases should be +placed in their own test method. It makes running individual tests for +debugging much more pleasant. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-03-02 21:34:48
|
Revision: 201 http://etch.svn.sourceforge.net/etch/?rev=201&view=rev Author: jheiss Date: 2010-03-02 21:34:41 +0000 (Tue, 02 Mar 2010) Log Message: ----------- Fix typo Modified Paths: -------------- trunk/server/config/repo_update Modified: trunk/server/config/repo_update =================================================================== --- trunk/server/config/repo_update 2010-01-27 23:40:40 UTC (rev 200) +++ trunk/server/config/repo_update 2010-03-02 21:34:41 UTC (rev 201) @@ -3,7 +3,7 @@ require 'fileutils' require 'tempfile' -if !File.directory('/etc/etchserver/trunk') +if !File.directory?('/etc/etchserver/trunk') abort "Please check out an etch config repo in /etc/etchserver/trunk" end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-01-27 23:40:47
|
Revision: 200 http://etch.svn.sourceforge.net/etch/?rev=200&view=rev Author: jheiss Date: 2010-01-27 23:40:40 +0000 (Wed, 27 Jan 2010) Log Message: ----------- Move the two dashboard charts to partials so that they can be accessed by themselves (for possible inclusion in an Architecture dashboard). Move the chart generation logic into a separate method in the dashboard controller so that we don't compute the client status counts when generating the client count chart. We need the client status counts when generating the dashboard itself, and when generating the client status chart. It's bad enough computing them twice, computing them a third time unnecessarily bugged me (and the dashboard loads rather slowly in production, so this should help a bit). Clean up the loop when computing the month-by-month client counts, the old code worked fine but was ugly. Simplify the formatting of the months on the month-by-month client count chart, the fancier formatting I had cut-n-pasted from somewhere didn't look very good. Add a style to the chart titles to make them stand out more. Wrap the charts in <div> and apply formatting in the stylesheet to center them. Makes the dashboard look a bit better, although there's still some non-optimal formatting going on. (The status chart moves off-center sooner than it seems like it should when narrowing the browser window.) Modified Paths: -------------- trunk/server/app/controllers/dashboard_controller.rb trunk/server/app/views/dashboard/index.html.erb trunk/server/public/stylesheets/design.css Added Paths: ----------- trunk/server/app/views/dashboard/_client_chart.html.erb trunk/server/app/views/dashboard/_status_chart.html.erb Modified: trunk/server/app/controllers/dashboard_controller.rb =================================================================== --- trunk/server/app/controllers/dashboard_controller.rb 2010-01-21 04:12:08 UTC (rev 199) +++ trunk/server/app/controllers/dashboard_controller.rb 2010-01-27 23:40:40 UTC (rev 200) @@ -1,30 +1,52 @@ +require 'date' + class DashboardController < ApplicationController - def index + def set_counts @total_count = Client.count @healthy_count = Client.count(:conditions => ["status = 0 AND updated_at > ?", 24.hours.ago]) @broken_count = Client.count(:conditions => ["status != 0 AND status != 200 AND updated_at > ?", 24.hours.ago]) @disabled_count = Client.count(:conditions => ["status = 200 AND updated_at > ?", 24.hours.ago]) @stale_count = Client.count(:conditions => ["updated_at <= ?", 24.hours.ago]) - + end + def set_charts + @status_chart = open_flash_chart_object(300, 300, url_for( :action => 'chart', :chart => 'status', :format => :json )) + @client_chart = open_flash_chart_object(500, 300, url_for( :action => 'chart', :chart => 'client', :format => :json )) + end + + def index + set_counts + set_charts + end + + def chart respond_to do |format| format.html { - @status_graph = open_flash_chart_object(300, 300, url_for( :action => 'index', :graph => 'status', :format => :json )) - @client_graph = open_flash_chart_object(500, 300, url_for( :action => 'index', :graph => 'client', :format => :json )) + set_charts + case params[:chart] + when 'status' + render :partial => 'status_chart', :layout => false + return + when 'client' + render :partial => 'client_chart', :layout => false + return + end } format.json { - case params[:graph] + case params[:chart] when 'status' pie = Pie.new pie.start_angle = 0 pie.animate = true pie.tooltip = '#label# of #total#' pie.colours = ['#36E728', '#D01F1F', '#E9F11D', '#741FD0'] + set_counts pie.values = [PieValue.new(@healthy_count, @healthy_count == 0 ? '' : "Healthy: #{@healthy_count}"), PieValue.new(@broken_count, @broken_count == 0 ? '' : "Broken: #{@broken_count}"), PieValue.new(@disabled_count, @disabled_count == 0 ? '' : "Disabled: #{@disabled_count}"), PieValue.new(@stale_count, @stale_count == 0 ? '' : "Stale: #{@stale_count}")] title = Title.new("Client Status") + title.set_style('{font-size: 20px; color: #778877}') chart = OpenFlashChart.new chart.title = title @@ -34,37 +56,21 @@ chart.x_axis = nil render :text => chart, :layout => false + return when 'client' clients = [] months = [] - # Find the oldest client oldest = Client.find(:first, :order => 'created_at') if oldest - # Get the month and year of that date - month = oldest.created_at.mon - year = oldest.created_at.year - # Iterate months to present - (year..Time.now.year).each do |y| - start_month = 1 - end_month = 12 - if y == year - start_month = month - end - if y == Time.now.year - end_month = Time.now.month - end - (start_month..end_month).each do |m| - end_time = nil - if m == 12 - end_time = Time.local(y+1, 1) - else - end_time = Time.local(y, m+1) - end - # This should get us the last second of the desired month - end_time - 1 - clients << Client.count(:conditions => ["created_at <= ?", end_time]) - months << end_time.strftime('%b %Y') - end + start = Date.new(oldest.created_at.year, oldest.created_at.month, 1) + next_month = Date.new(Time.now.year, Time.now.month, 1).next_month + month = start + while month != next_month + # Combination of next_month and -1 gets us the last second of the month + monthtime = Time.local(month.next_month.year, month.next_month.month) - 1 + clients << Client.count(:conditions => ["created_at <= ?", monthtime]) + months << "#{monthtime.strftime('%b')}\n#{monthtime.year}" + month = month.next_month end end @@ -75,15 +81,8 @@ line_dot.dot_size = 5 line_dot.values = clients - tmp = [] - x_labels = XAxisLabels.new - x_labels.set_vertical() - months.each do |text| - tmp << XAxisLabel.new(text, '#0000ff', 12, 'diagonal') - end - x_labels.labels = tmp x = XAxis.new - x.set_labels(x_labels) + x.set_labels(months) y = YAxis.new # Set the top of the y scale to be the largest number of clients @@ -95,6 +94,8 @@ y.set_range(0, ymax, ydiv) title = Title.new("Number of Clients") + title.set_style('{font-size: 20px; color: #778877}') + chart = OpenFlashChart.new chart.set_title(title) chart.x_axis = x @@ -104,6 +105,7 @@ chart.add_element(line_dot) render :text => chart.to_s + return end } end Added: trunk/server/app/views/dashboard/_client_chart.html.erb =================================================================== --- trunk/server/app/views/dashboard/_client_chart.html.erb (rev 0) +++ trunk/server/app/views/dashboard/_client_chart.html.erb 2010-01-27 23:40:40 UTC (rev 200) @@ -0,0 +1,5 @@ +<script type="text/javascript" src="/javascripts/swfobject.js"></script> +<div id="client_chart"> +<%= @client_chart %> +</div> + Added: trunk/server/app/views/dashboard/_status_chart.html.erb =================================================================== --- trunk/server/app/views/dashboard/_status_chart.html.erb (rev 0) +++ trunk/server/app/views/dashboard/_status_chart.html.erb 2010-01-27 23:40:40 UTC (rev 200) @@ -0,0 +1,5 @@ +<script type="text/javascript" src="/javascripts/swfobject.js"></script> +<div id="status_chart"> +<%= @status_chart %> +</div> + Modified: trunk/server/app/views/dashboard/index.html.erb =================================================================== --- trunk/server/app/views/dashboard/index.html.erb 2010-01-21 04:12:08 UTC (rev 199) +++ trunk/server/app/views/dashboard/index.html.erb 2010-01-27 23:40:40 UTC (rev 200) @@ -18,9 +18,8 @@ </tbody> </table> -<script type="text/javascript" src="/javascripts/swfobject.js"></script> -<%= @status_graph %> -<%= @client_graph %> +<%= render :partial => "status_chart" %> +<%= render :partial => "client_chart" %> </div> <!-- end dashboard_body --> Modified: trunk/server/public/stylesheets/design.css =================================================================== --- trunk/server/public/stylesheets/design.css 2010-01-21 04:12:08 UTC (rev 199) +++ trunk/server/public/stylesheets/design.css 2010-01-27 23:40:40 UTC (rev 200) @@ -348,5 +348,20 @@ #loginbox p { text-align: right; } +#status_chart +{ + /* Center this chart */ + margin-left: auto; + margin-right: auto; + /* The chart is defined as 300px wide when created in the dashboard controller */ + width: 300px; +} +#client_chart +{ + margin-left: auto; + margin-right: auto; + width: 500px; +} + /* Hide all HRs, they are only meant for print, or non CSS browsers */ hr { display: none; } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-01-21 04:12:15
|
Revision: 199 http://etch.svn.sourceforge.net/etch/?rev=199&view=rev Author: jheiss Date: 2010-01-21 04:12:08 +0000 (Thu, 21 Jan 2010) Log Message: ----------- Tag 3.15.2 release Modified Paths: -------------- Rakefile tags/release-3.15.2/VERSION Added Paths: ----------- tags/release-3.15.2/ tags/release-3.15.2/client/Rakefile Removed Paths: ------------- tags/release-3.15.2/client/Rakefile Modified: Rakefile =================================================================== --- Rakefile 2010-01-21 04:09:46 UTC (rev 198) +++ Rakefile 2010-01-21 04:12:08 UTC (rev 199) @@ -1,4 +1,4 @@ -ETCHVER = '3.15.1' +ETCHVER = '3.15.2' TAGNAME = "release-#{ETCHVER}" TAGDIR = "tags/#{TAGNAME}" DIST = "etch-#{ETCHVER}" Modified: tags/release-3.15.2/VERSION =================================================================== --- trunk/VERSION 2010-01-21 01:17:36 UTC (rev 197) +++ tags/release-3.15.2/VERSION 2010-01-21 04:12:08 UTC (rev 199) @@ -1 +1 @@ -trunk +3.15.2 Deleted: tags/release-3.15.2/client/Rakefile =================================================================== --- trunk/client/Rakefile 2010-01-21 01:17:36 UTC (rev 197) +++ tags/release-3.15.2/client/Rakefile 2010-01-21 04:12:08 UTC (rev 199) @@ -1,446 +0,0 @@ -require 'rbconfig' -require 'tempfile' -require 'tmpdir' -require 'open-uri' - -ETCHVER = IO.read('../VERSION').chomp -TARBALLFILE = "etch-#{ETCHVER}.tar.gz" -TARBALL = File.expand_path(TARBALLFILE) - -BUILDROOT = '/var/tmp/etch-client-buildroot' - -# Copies the etch client files to destdir. If any of the dir options -# are not specified the files that would go in that directory will not -# be copied. -# options: -# :bindir -# :libdir -# :etcdir -# :mandir -# :crondir -# :ruby (#! lines in scripts will be changed to specified ruby) -def copy_etch_files(destdir, options={}) - if options[:bindir] - bindir = File.join(destdir, options[:bindir]) - mkdir_p(bindir) - binapps = ['etch', 'etch_to_trunk', 'etch_cron_wrapper'] - binapps.each do |binapp| - if options[:ruby] - # Change #! line - File.open(File.join(bindir, binapp), 'w') do |newfile| - File.open(binapp) do |oldfile| - # Modify the first line - firstline = oldfile.gets - # Preserve any options. I.e. #!/usr/bin/ruby -w - shebang, shebangopts = firstline.split(' ', 2) - newfile.puts "#!#{options[:ruby]} #{shebangopts}" - # Then dump in the rest of the file - newfile.write(oldfile.read) - end - end - else - cp(binapp, bindir, :preserve => true) - end - chmod(0555, File.join(bindir, binapp)) - end - end - - if options[:libdir] - libdir = File.join(destdir, options[:libdir]) - mkdir_p(libdir) - - # Substitute ETCHVER into etchclient.rb - # Substitute proper path into CONFIGDIR in etchclient.rb if appropriate - File.open(File.join(libdir, 'etchclient.rb'), 'w') do |newfile| - IO.foreach('etchclient.rb') do |line| - if line =~ /^\s*VERSION/ - line.sub!(/=.*/, "= '#{ETCHVER}'") - end - if options[:etcdir] && line =~ /^\s*CONFIGDIR/ - line.sub!(/=.*/, "= #{options[:etcdir]}") - end - newfile.write(line) - end - end - chmod(0444, File.join(libdir, 'etchclient.rb')) - - serverlibs = ['etch.rb', 'versiontype.rb'] - serverlibs.each do |serverlib| - cp(File.join('..', 'server', 'lib', serverlib), libdir, :preserve => true) - chmod(0444, File.join(libdir, serverlib)) - end - end - - if options[:mandir] - mandir = File.join(destdir, options[:mandir]) - man8dir = File.join(mandir, 'man8') - mkdir_p(man8dir) - cp('etch.8', man8dir, :preserve => true) - chmod(0444, File.join(man8dir, 'etch.8')) - end - - if options[:etcdir] - etcdir = File.join(destdir, options[:etcdir]) - # FIXME: Need to add support for etch.conf to the code - #mkdir_p(etcdir) - #cp('etch.conf', etcdir, :preserve => true) - #chmod(0644, File.join(etcdir, 'etch.conf')) - # All of the supporting config files go into a subdirectory - etcetchdir = File.join(etcdir, 'etch') - mkdir_p(etcetchdir) - etcetchfiles = ['ca.pem', 'dhparams'] - etcetchfiles.each do |etcetchfile| - cp(etcetchfile, etcetchdir, :preserve => true) - chmod(0644, File.join(etcetchdir, etcetchfile)) - end - end - - if options[:crondir] - crondir = File.join(destdir, options[:crondir]) - mkdir_p(crondir) - # Note file renamed to 'etch' here. Filename is different in the repo for - # clarity and to avoid conflict with the main executable. - cp('etch_cron', File.join(crondir, 'etch'), :preserve => true) - chmod(0444, File.join(crondir, 'etch')) - end -end - -desc 'Build an etch client RPM on a Red Hat box' -task :redhat => [:redhatprep, :rpm] -desc 'Prep a Red Hat box for building an RPM' -task :redhatprep do - # Install the package which contains the rpmbuild command - system('rpm --quiet -q rpm-build || sudo yum install rpm-build') -end -desc 'Build an etch client RPM' -task :rpm do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - sbindir = File.join('usr', 'sbin') - libdir = File.join('usr', 'lib', 'ruby', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = '/etc' - crondir = File.join('etc', 'cron.d') - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, :crondir => crondir) - - # - # Prep spec file - # - - spec = Tempfile.new('etchrpm') - IO.foreach('etch-client.spec') do |line| - line.sub!('%VER%', ETCHVER) - spec.puts(line) - end - spec.close - - # - # Build the package - # - - system("rpmbuild -bb --buildroot #{BUILDROOT} #{spec.path}") - - # - # Cleanup - # - - rm_rf(BUILDROOT) -end - -desc 'Build an etch client deb' -task :deb do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - mkdir_p(File.join(BUILDROOT, 'DEBIAN')) - File.open(File.join(BUILDROOT, 'DEBIAN', 'control'), 'w') do |control| - IO.foreach('control') do |line| - next if line =~ /^\s*#/ # Remove comments - line.sub!('%VER%', ETCHVER) - control.puts(line) - end - end - - sbindir = File.join('usr', 'sbin') - libdir = File.join('usr', 'local', 'lib', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = '/etc' - crondir = File.join('etc', 'cron.d') - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, :crondir => crondir) - - # - # Set permissions - # - - system("sudo chown -R 0:0 #{BUILDROOT}") - - # - # Build the package - # - - system("dpkg --build #{BUILDROOT} etch-client-#{ETCHVER}.deb") - - # - # Cleanup - # - - rm_rf(BUILDROOT) -end - -desc 'Build etch client SysV packages for Solaris' -task :solaris => [:sysvpkg, :sysvpkgsparc] -desc 'Build an etch client SysV package' -task :sysvpkg do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - sbindir = File.join('usr', 'sbin') - libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = '/etc' - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, - :ruby => '/opt/csw/bin/ruby') - - # - # Prep packaging files - # - - rm_rf('solbuild') - mkdir('solbuild') - File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| - IO.foreach('pkginfo') do |line| - line.sub!('%VER%', ETCHVER) - pkginfo.puts(line) - end - end - File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| - prototype.puts("i pkginfo=./pkginfo") - cp('depend', 'solbuild/depend') - prototype.puts("i depend=./depend") - cp('postinstall.solaris', 'solbuild/postinstall') - prototype.puts("i postinstall=./postinstall") - cp('postremove.solaris', 'solbuild/postremove') - prototype.puts("i postremove=./postremove") - # The tail +2 removes the first line, which is the base directory - # and doesn't need to be included in the package. - IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| - pipe.each do |line| - # Clean up the directory names - line.sub!(BUILDROOT, '') - # Don't force our permissions on directories - if line =~ /^d/ - line.sub!(/\S+ \S+ \S+$/, '? ? ?') - end - prototype.write(line) - end - end - end - - # - # Build the package - # - - system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") - system("pkgtrans solbuild ../OSSetch-#{ETCHVER}.pkg OSSetch") - - # - # Cleanup - # - - rm_rf('solbuild') - rm_rf(BUILDROOT) -end - -# On Sparc systems we're having problems with the CSW/Blastwave ruby core -# dumping when running etch. The Sunfreeware ruby seems to work. Sunfreeware -# doesn't play well with pkg-get, so we create a bit of a hybrid. We still -# express all the dependencies against CSW, and put our library file -# (etchclient.rb) into /opt/csw. We modify etch to use the Sunfreeware ruby -# in /usr/local/bin, but then tell it to also look in the /opt/csw directory -# for libraries. Users will have to manually install the Sunfreeware ruby -# package. -desc 'Build an etch client SysV package with hybrid CSW/Sunfreeware dependencies' -task :sysvpkgsparc do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - sbindir = File.join('usr', 'sbin') - libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = '/etc' - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, - :ruby => '/usr/local/bin/ruby') - - # Since we're using the Sunfreeware ruby but CSW libraries we need to add - # the CSW ruby library directory to the search path - newetch = File.join(BUILDROOT, 'usr', 'sbin', 'etch.new') - etch = File.join(BUILDROOT, 'usr', 'sbin', 'etch') - File.open(newetch, 'w') do |newfile| - IO.foreach(etch) do |line| - if line =~ /unshift.*__FILE__/ - line << "$:.unshift('/opt/csw/lib/ruby/site_ruby/1.8')\n" - end - newfile.write(line) - end - end - mv(newetch, etch) - chmod(0555, etch) - - # - # Prep packaging files - # - - rm_rf('solbuild') - mkdir('solbuild') - File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| - IO.foreach('pkginfo') do |line| - line.sub!('%VER%', ETCHVER) - pkginfo.puts(line) - end - end - File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| - prototype.puts("i pkginfo=./pkginfo") - cp('depend', 'solbuild/depend') - prototype.puts("i depend=./depend") - cp('postinstall.solaris', 'solbuild/postinstall') - prototype.puts("i postinstall=./postinstall") - cp('postremove.solaris', 'solbuild/postremove') - prototype.puts("i postremove=./postremove") - # The tail +2 removes the first line, which is the base directory - # and doesn't need to be included in the package. - IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| - pipe.each do |line| - # Clean up the directory names - line.sub!(BUILDROOT, '') - # Don't force our permissions on directories - if line =~ /^d/ - line.sub!(/\S+ \S+ \S+$/, '? ? ?') - end - prototype.write(line) - end - end - end - - # - # Build the package - # - - system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") - system("pkgtrans solbuild ../OSSetch-#{ETCHVER}-sparc.pkg OSSetch") - - # - # Cleanup - # - - rm_rf('solbuild') - rm_rf(BUILDROOT) -end - -# Install based on Config::CONFIG paths -task :install, :destdir do |t, args| - destdir = nil - if args.destdir - destdir = args.destdir - else - destdir = '/' - end - copy_etch_files(destdir, - :bindir => Config::CONFIG['sbindir'], - :libdir => Config::CONFIG['sitelibdir'], - :mandir => Config::CONFIG['mandir'], - :etcdir => Config::CONFIG['sysconfdir'], - # Can't find a better way to get the path to the current ruby - :ruby => File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])) -end - -desc 'Fetch tarball from sourceforge' -task :fetch do - if !File.exist?(TARBALL) - url = "http://downloads.sourceforge.net/project/etch/etch/#{ETCHVER}/#{TARBALLFILE}" - puts "Fetching tarball from #{url}" - open(url) do |df| - open(TARBALL, 'w') do |lf| - lf.write(df.read) - end - end - end -end - -desc 'Prepare portfile for submission to MacPorts' -task :macport => :fetch do - md5 = `openssl md5 #{TARBALL}`.chomp.split.last - sha1 = `openssl sha1 #{TARBALL}`.chomp.split.last - rmd160 = `openssl rmd160 #{TARBALL}`.chomp.split.last - - portfile = File.join(Dir.tmpdir, 'Portfile') - rm_f(portfile) - File.open(portfile, 'w') do |newfile| - IO.foreach('Portfile') do |line| - line.sub!('%VER%', ETCHVER) - line.sub!('%MD5%', md5) - line.sub!('%SHA1%', sha1) - line.sub!('%RMD160%', rmd160) - newfile.puts(line) - end - end - puts "Portfile is #{portfile}" -end - -task :gem do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - copy_etch_files(BUILDROOT, - :bindir => 'bin', - :libdir => 'lib') - - # - # Prep gemspec (renaming to Rakefile in the process) - # - File.open(File.join(BUILDROOT, 'Rakefile'), 'w') do |gemspec| - IO.foreach('gemspec') do |line| - line.sub!('%VER%', ETCHVER) - gemspec.puts(line) - end - end - - # - # Build the package - # - - system("cd #{BUILDROOT} && rake gem") - gemglob = File.join(BUILDROOT, 'pkg', '*.gem') - gemfile = Dir.glob(gemglob).first - if gemfile - mv(gemfile, Dir.tmpdir) - puts "Gem is #{File.join(Dir.tmpdir, File.basename(gemfile))}" - else - warn "Gem file #{gemglob} not found!" - end - - # - # Cleanup - # - - rm_rf(BUILDROOT) -end - Copied: tags/release-3.15.2/client/Rakefile (from rev 198, trunk/client/Rakefile) =================================================================== --- tags/release-3.15.2/client/Rakefile (rev 0) +++ tags/release-3.15.2/client/Rakefile 2010-01-21 04:12:08 UTC (rev 199) @@ -0,0 +1,446 @@ +require 'rbconfig' +require 'tempfile' +require 'tmpdir' +require 'open-uri' + +ETCHVER = IO.read('../VERSION').chomp +TARBALLFILE = "etch-#{ETCHVER}.tar.gz" +TARBALL = File.expand_path(TARBALLFILE) + +BUILDROOT = '/var/tmp/etch-client-buildroot' + +# Copies the etch client files to destdir. If any of the dir options +# are not specified the files that would go in that directory will not +# be copied. +# options: +# :bindir +# :libdir +# :etcdir +# :mandir +# :crondir +# :ruby (#! lines in scripts will be changed to specified ruby) +def copy_etch_files(destdir, options={}) + if options[:bindir] + bindir = File.join(destdir, options[:bindir]) + mkdir_p(bindir) + binapps = ['etch', 'etch_to_trunk', 'etch_cron_wrapper'] + binapps.each do |binapp| + if options[:ruby] + # Change #! line + File.open(File.join(bindir, binapp), 'w') do |newfile| + File.open(binapp) do |oldfile| + # Modify the first line + firstline = oldfile.gets + # Preserve any options. I.e. #!/usr/bin/ruby -w + shebang, shebangopts = firstline.split(' ', 2) + newfile.puts "#!#{options[:ruby]} #{shebangopts}" + # Then dump in the rest of the file + newfile.write(oldfile.read) + end + end + else + cp(binapp, bindir, :preserve => true) + end + chmod(0555, File.join(bindir, binapp)) + end + end + + if options[:libdir] + libdir = File.join(destdir, options[:libdir]) + mkdir_p(libdir) + + # Substitute ETCHVER into etchclient.rb + # Substitute proper path into CONFIGDIR in etchclient.rb if appropriate + File.open(File.join(libdir, 'etchclient.rb'), 'w') do |newfile| + IO.foreach('etchclient.rb') do |line| + if line =~ /^\s*VERSION/ + line.sub!(/=.*/, "= '#{ETCHVER}'") + end + if options[:etcdir] && line =~ /^\s*CONFIGDIR/ + line.sub!(/=.*/, "= '#{options[:etcdir]}'") + end + newfile.write(line) + end + end + chmod(0444, File.join(libdir, 'etchclient.rb')) + + serverlibs = ['etch.rb', 'versiontype.rb'] + serverlibs.each do |serverlib| + cp(File.join('..', 'server', 'lib', serverlib), libdir, :preserve => true) + chmod(0444, File.join(libdir, serverlib)) + end + end + + if options[:mandir] + mandir = File.join(destdir, options[:mandir]) + man8dir = File.join(mandir, 'man8') + mkdir_p(man8dir) + cp('etch.8', man8dir, :preserve => true) + chmod(0444, File.join(man8dir, 'etch.8')) + end + + if options[:etcdir] + etcdir = File.join(destdir, options[:etcdir]) + # FIXME: Need to add support for etch.conf to the code + #mkdir_p(etcdir) + #cp('etch.conf', etcdir, :preserve => true) + #chmod(0644, File.join(etcdir, 'etch.conf')) + # All of the supporting config files go into a subdirectory + etcetchdir = File.join(etcdir, 'etch') + mkdir_p(etcetchdir) + etcetchfiles = ['ca.pem', 'dhparams'] + etcetchfiles.each do |etcetchfile| + cp(etcetchfile, etcetchdir, :preserve => true) + chmod(0644, File.join(etcetchdir, etcetchfile)) + end + end + + if options[:crondir] + crondir = File.join(destdir, options[:crondir]) + mkdir_p(crondir) + # Note file renamed to 'etch' here. Filename is different in the repo for + # clarity and to avoid conflict with the main executable. + cp('etch_cron', File.join(crondir, 'etch'), :preserve => true) + chmod(0444, File.join(crondir, 'etch')) + end +end + +desc 'Build an etch client RPM on a Red Hat box' +task :redhat => [:redhatprep, :rpm] +desc 'Prep a Red Hat box for building an RPM' +task :redhatprep do + # Install the package which contains the rpmbuild command + system('rpm --quiet -q rpm-build || sudo yum install rpm-build') +end +desc 'Build an etch client RPM' +task :rpm do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + sbindir = File.join('usr', 'sbin') + libdir = File.join('usr', 'lib', 'ruby', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = '/etc' + crondir = File.join('etc', 'cron.d') + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, :crondir => crondir) + + # + # Prep spec file + # + + spec = Tempfile.new('etchrpm') + IO.foreach('etch-client.spec') do |line| + line.sub!('%VER%', ETCHVER) + spec.puts(line) + end + spec.close + + # + # Build the package + # + + system("rpmbuild -bb --buildroot #{BUILDROOT} #{spec.path}") + + # + # Cleanup + # + + rm_rf(BUILDROOT) +end + +desc 'Build an etch client deb' +task :deb do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + mkdir_p(File.join(BUILDROOT, 'DEBIAN')) + File.open(File.join(BUILDROOT, 'DEBIAN', 'control'), 'w') do |control| + IO.foreach('control') do |line| + next if line =~ /^\s*#/ # Remove comments + line.sub!('%VER%', ETCHVER) + control.puts(line) + end + end + + sbindir = File.join('usr', 'sbin') + libdir = File.join('usr', 'local', 'lib', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = '/etc' + crondir = File.join('etc', 'cron.d') + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, :crondir => crondir) + + # + # Set permissions + # + + system("sudo chown -R 0:0 #{BUILDROOT}") + + # + # Build the package + # + + system("dpkg --build #{BUILDROOT} etch-client-#{ETCHVER}.deb") + + # + # Cleanup + # + + rm_rf(BUILDROOT) +end + +desc 'Build etch client SysV packages for Solaris' +task :solaris => [:sysvpkg, :sysvpkgsparc] +desc 'Build an etch client SysV package' +task :sysvpkg do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + sbindir = File.join('usr', 'sbin') + libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = '/etc' + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, + :ruby => '/opt/csw/bin/ruby') + + # + # Prep packaging files + # + + rm_rf('solbuild') + mkdir('solbuild') + File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| + IO.foreach('pkginfo') do |line| + line.sub!('%VER%', ETCHVER) + pkginfo.puts(line) + end + end + File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| + prototype.puts("i pkginfo=./pkginfo") + cp('depend', 'solbuild/depend') + prototype.puts("i depend=./depend") + cp('postinstall.solaris', 'solbuild/postinstall') + prototype.puts("i postinstall=./postinstall") + cp('postremove.solaris', 'solbuild/postremove') + prototype.puts("i postremove=./postremove") + # The tail +2 removes the first line, which is the base directory + # and doesn't need to be included in the package. + IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| + pipe.each do |line| + # Clean up the directory names + line.sub!(BUILDROOT, '') + # Don't force our permissions on directories + if line =~ /^d/ + line.sub!(/\S+ \S+ \S+$/, '? ? ?') + end + prototype.write(line) + end + end + end + + # + # Build the package + # + + system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") + system("pkgtrans solbuild ../OSSetch-#{ETCHVER}.pkg OSSetch") + + # + # Cleanup + # + + rm_rf('solbuild') + rm_rf(BUILDROOT) +end + +# On Sparc systems we're having problems with the CSW/Blastwave ruby core +# dumping when running etch. The Sunfreeware ruby seems to work. Sunfreeware +# doesn't play well with pkg-get, so we create a bit of a hybrid. We still +# express all the dependencies against CSW, and put our library file +# (etchclient.rb) into /opt/csw. We modify etch to use the Sunfreeware ruby +# in /usr/local/bin, but then tell it to also look in the /opt/csw directory +# for libraries. Users will have to manually install the Sunfreeware ruby +# package. +desc 'Build an etch client SysV package with hybrid CSW/Sunfreeware dependencies' +task :sysvpkgsparc do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + sbindir = File.join('usr', 'sbin') + libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = '/etc' + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, + :ruby => '/usr/local/bin/ruby') + + # Since we're using the Sunfreeware ruby but CSW libraries we need to add + # the CSW ruby library directory to the search path + newetch = File.join(BUILDROOT, 'usr', 'sbin', 'etch.new') + etch = File.join(BUILDROOT, 'usr', 'sbin', 'etch') + File.open(newetch, 'w') do |newfile| + IO.foreach(etch) do |line| + if line =~ /unshift.*__FILE__/ + line << "$:.unshift('/opt/csw/lib/ruby/site_ruby/1.8')\n" + end + newfile.write(line) + end + end + mv(newetch, etch) + chmod(0555, etch) + + # + # Prep packaging files + # + + rm_rf('solbuild') + mkdir('solbuild') + File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| + IO.foreach('pkginfo') do |line| + line.sub!('%VER%', ETCHVER) + pkginfo.puts(line) + end + end + File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| + prototype.puts("i pkginfo=./pkginfo") + cp('depend', 'solbuild/depend') + prototype.puts("i depend=./depend") + cp('postinstall.solaris', 'solbuild/postinstall') + prototype.puts("i postinstall=./postinstall") + cp('postremove.solaris', 'solbuild/postremove') + prototype.puts("i postremove=./postremove") + # The tail +2 removes the first line, which is the base directory + # and doesn't need to be included in the package. + IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| + pipe.each do |line| + # Clean up the directory names + line.sub!(BUILDROOT, '') + # Don't force our permissions on directories + if line =~ /^d/ + line.sub!(/\S+ \S+ \S+$/, '? ? ?') + end + prototype.write(line) + end + end + end + + # + # Build the package + # + + system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") + system("pkgtrans solbuild ../OSSetch-#{ETCHVER}-sparc.pkg OSSetch") + + # + # Cleanup + # + + rm_rf('solbuild') + rm_rf(BUILDROOT) +end + +# Install based on Config::CONFIG paths +task :install, :destdir do |t, args| + destdir = nil + if args.destdir + destdir = args.destdir + else + destdir = '/' + end + copy_etch_files(destdir, + :bindir => Config::CONFIG['sbindir'], + :libdir => Config::CONFIG['sitelibdir'], + :mandir => Config::CONFIG['mandir'], + :etcdir => Config::CONFIG['sysconfdir'], + # Can't find a better way to get the path to the current ruby + :ruby => File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])) +end + +desc 'Fetch tarball from sourceforge' +task :fetch do + if !File.exist?(TARBALL) + url = "http://downloads.sourceforge.net/project/etch/etch/#{ETCHVER}/#{TARBALLFILE}" + puts "Fetching tarball from #{url}" + open(url) do |df| + open(TARBALL, 'w') do |lf| + lf.write(df.read) + end + end + end +end + +desc 'Prepare portfile for submission to MacPorts' +task :macport => :fetch do + md5 = `openssl md5 #{TARBALL}`.chomp.split.last + sha1 = `openssl sha1 #{TARBALL}`.chomp.split.last + rmd160 = `openssl rmd160 #{TARBALL}`.chomp.split.last + + portfile = File.join(Dir.tmpdir, 'Portfile') + rm_f(portfile) + File.open(portfile, 'w') do |newfile| + IO.foreach('Portfile') do |line| + line.sub!('%VER%', ETCHVER) + line.sub!('%MD5%', md5) + line.sub!('%SHA1%', sha1) + line.sub!('%RMD160%', rmd160) + newfile.puts(line) + end + end + puts "Portfile is #{portfile}" +end + +task :gem do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + copy_etch_files(BUILDROOT, + :bindir => 'bin', + :libdir => 'lib') + + # + # Prep gemspec (renaming to Rakefile in the process) + # + File.open(File.join(BUILDROOT, 'Rakefile'), 'w') do |gemspec| + IO.foreach('gemspec') do |line| + line.sub!('%VER%', ETCHVER) + gemspec.puts(line) + end + end + + # + # Build the package + # + + system("cd #{BUILDROOT} && rake gem") + gemglob = File.join(BUILDROOT, 'pkg', '*.gem') + gemfile = Dir.glob(gemglob).first + if gemfile + mv(gemfile, Dir.tmpdir) + puts "Gem is #{File.join(Dir.tmpdir, File.basename(gemfile))}" + else + warn "Gem file #{gemglob} not found!" + end + + # + # Cleanup + # + + rm_rf(BUILDROOT) +end + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-01-21 04:09:53
|
Revision: 198 http://etch.svn.sourceforge.net/etch/?rev=198&view=rev Author: jheiss Date: 2010-01-21 04:09:46 +0000 (Thu, 21 Jan 2010) Log Message: ----------- Add some missing quotes. Modified Paths: -------------- trunk/client/Rakefile Modified: trunk/client/Rakefile =================================================================== --- trunk/client/Rakefile 2010-01-21 01:17:36 UTC (rev 197) +++ trunk/client/Rakefile 2010-01-21 04:09:46 UTC (rev 198) @@ -57,7 +57,7 @@ line.sub!(/=.*/, "= '#{ETCHVER}'") end if options[:etcdir] && line =~ /^\s*CONFIGDIR/ - line.sub!(/=.*/, "= #{options[:etcdir]}") + line.sub!(/=.*/, "= '#{options[:etcdir]}'") end newfile.write(line) end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-01-21 01:17:43
|
Revision: 197 http://etch.svn.sourceforge.net/etch/?rev=197&view=rev Author: jheiss Date: 2010-01-21 01:17:36 +0000 (Thu, 21 Jan 2010) Log Message: ----------- Tag 3.15.1 release Modified Paths: -------------- Rakefile tags/release-3.15.1/VERSION Added Paths: ----------- tags/release-3.15.1/ Modified: Rakefile =================================================================== --- Rakefile 2010-01-21 01:08:34 UTC (rev 196) +++ Rakefile 2010-01-21 01:17:36 UTC (rev 197) @@ -1,4 +1,4 @@ -ETCHVER = '3.15.0' +ETCHVER = '3.15.1' TAGNAME = "release-#{ETCHVER}" TAGDIR = "tags/#{TAGNAME}" DIST = "etch-#{ETCHVER}" Modified: tags/release-3.15.1/VERSION =================================================================== --- trunk/VERSION 2010-01-21 01:08:34 UTC (rev 196) +++ tags/release-3.15.1/VERSION 2010-01-21 01:17:36 UTC (rev 197) @@ -1 +1 @@ -trunk +3.15.1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-01-21 01:08:40
|
Revision: 196 http://etch.svn.sourceforge.net/etch/?rev=196&view=rev Author: jheiss Date: 2010-01-21 01:08:34 +0000 (Thu, 21 Jan 2010) Log Message: ----------- Fix bug that prevented the rpm task from working. Modified Paths: -------------- trunk/client/Rakefile Modified: trunk/client/Rakefile =================================================================== --- trunk/client/Rakefile 2010-01-21 00:41:53 UTC (rev 195) +++ trunk/client/Rakefile 2010-01-21 01:08:34 UTC (rev 196) @@ -137,6 +137,7 @@ line.sub!('%VER%', ETCHVER) spec.puts(line) end + spec.close # # Build the package This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-01-21 00:41:59
|
Revision: 195 http://etch.svn.sourceforge.net/etch/?rev=195&view=rev Author: jheiss Date: 2010-01-21 00:41:53 +0000 (Thu, 21 Jan 2010) Log Message: ----------- Fix a bug and a cut-n-paste typo. Modified Paths: -------------- trunk/client/Rakefile Modified: trunk/client/Rakefile =================================================================== --- trunk/client/Rakefile 2010-01-21 00:01:49 UTC (rev 194) +++ trunk/client/Rakefile 2010-01-21 00:41:53 UTC (rev 195) @@ -51,8 +51,8 @@ # Substitute ETCHVER into etchclient.rb # Substitute proper path into CONFIGDIR in etchclient.rb if appropriate - File.open(File.join(libdir, 'etchclient.rb.new'), 'w') do |newfile| - IO.foreach(File.join(libdir, 'etchclient.rb')) do |line| + File.open(File.join(libdir, 'etchclient.rb'), 'w') do |newfile| + IO.foreach('etchclient.rb') do |line| if line =~ /^\s*VERSION/ line.sub!(/=.*/, "= '#{ETCHVER}'") end @@ -408,7 +408,7 @@ # rm_rf(BUILDROOT) - copy_tpkg_files(BUILDROOT, + copy_etch_files(BUILDROOT, :bindir => 'bin', :libdir => 'lib') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jh...@us...> - 2010-01-21 00:01:56
|
Revision: 194 http://etch.svn.sourceforge.net/etch/?rev=194&view=rev Author: jheiss Date: 2010-01-21 00:01:49 +0000 (Thu, 21 Jan 2010) Log Message: ----------- Tag 3.15.0 release Modified Paths: -------------- tags/release-3.15.0/VERSION Added Paths: ----------- tags/release-3.15.0/ Modified: tags/release-3.15.0/VERSION =================================================================== --- trunk/VERSION 2010-01-20 23:55:26 UTC (rev 193) +++ tags/release-3.15.0/VERSION 2010-01-21 00:01:49 UTC (rev 194) @@ -1 +1 @@ -trunk +3.15.0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |