etch 3.15.2 → 3.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/etch.rb +18 -8
  3. data/lib/etchclient.rb +2 -2
  4. metadata +2 -2
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ spec = Gem::Specification.new do |s|
3
3
  s.name = 'etch'
4
4
  s.summary = 'Etch system configuration management client'
5
5
  s.add_dependency('facter')
6
- s.version = '3.15.2'
6
+ s.version = '3.16.0'
7
7
  s.author = 'Jason Heiss'
8
8
  s.email = 'etch-users@lists.sourceforge.net'
9
9
  s.homepage = 'http://etch.sourceforge.net'
data/lib/etch.rb CHANGED
@@ -266,7 +266,7 @@ class Etch
266
266
  begin
267
267
  configfilter!(Etch.xmlroot(config_xml))
268
268
  rescue Exception => e
269
- raise e.exception("Error filtering config.xml for #{file}:\n" + e.message)
269
+ raise Etch.wrap_exception(e, "Error filtering config.xml for #{file}:\n" + e.message)
270
270
  end
271
271
 
272
272
  # Validate the filtered file against config.dtd
@@ -842,7 +842,7 @@ class Etch
842
842
  begin
843
843
  configfilter!(Etch.xmlroot(commands_xml))
844
844
  rescue Exception => e
845
- raise e.exception("Error filtering commands.xml for #{command}:\n" + e.message)
845
+ raise Etch.wrap_exception(e, "Error filtering commands.xml for #{command}:\n" + e.message)
846
846
  end
847
847
 
848
848
  # Validate the filtered file against commands.dtd
@@ -911,12 +911,12 @@ class Etch
911
911
  raise "Inconsistent command 'exec' entries for #{command}: " +
912
912
  command_exec_elements.collect {|elem| Etch.xmltext(elem)}.join(',')
913
913
  end
914
- # If filtering has removed both the guard and command elements
915
- # we can remove this step.
914
+ # If filtering has removed both the guard and command elements
915
+ # we can remove this step.
916
916
  if guard_exec_elements.empty? && command_exec_elements.empty?
917
917
  remove << step
918
- # If filtering has removed the guard but not the command or vice
919
- # versa that's an error.
918
+ # If filtering has removed the guard but not the command or vice
919
+ # versa that's an error.
920
920
  elsif guard_exec_elements.empty?
921
921
  raise "Filtering removed guard, but left command: " +
922
922
  Etch.xmltext(command_exec_elements.first)
@@ -1328,6 +1328,16 @@ class Etch
1328
1328
  raise "Unknown @xmllib #{@xmllib}"
1329
1329
  end
1330
1330
  end
1331
+
1332
+ # Used where we wish to capture an exception and modify the message. This
1333
+ # method returns a new exception with desired message but with the backtrace
1334
+ # from the original exception so that the backtrace info is not lost. This
1335
+ # is necessary because Exception lacks a set_message method.
1336
+ def self.wrap_exception(e, message)
1337
+ eprime = e.exception(message)
1338
+ eprime.set_backtrace(e.backtrace)
1339
+ eprime
1340
+ end
1331
1341
  end
1332
1342
 
1333
1343
  class EtchExternalSource
@@ -1363,7 +1373,7 @@ class EtchExternalSource
1363
1373
  rescue Exception => e
1364
1374
  # Help the user figure out where the exception occurred, otherwise they
1365
1375
  # just get told it happened here, which isn't very helpful.
1366
- raise e.exception("Exception while processing template #{template} for file #{@file}:\n" + e.message)
1376
+ raise Etch.wrap_exception(e, "Exception while processing template #{template} for file #{@file}:\n" + e.message)
1367
1377
  end
1368
1378
  end
1369
1379
 
@@ -1382,7 +1392,7 @@ class EtchExternalSource
1382
1392
  else
1383
1393
  # Help the user figure out where the exception occurred, otherwise they
1384
1394
  # just get told it happened here in eval, which isn't very helpful.
1385
- raise e.exception("Exception while processing script #{script} for file #{@file}:\n" + e.message)
1395
+ raise Etch.wrap_exception(e, "Exception while processing script #{script} for file #{@file}:\n" + e.message)
1386
1396
  end
1387
1397
  end
1388
1398
  @contents
data/lib/etchclient.rb CHANGED
@@ -35,7 +35,7 @@ require 'logger'
35
35
  require 'etch'
36
36
 
37
37
  class Etch::Client
38
- VERSION = '3.15.2'
38
+ VERSION = '3.16.0'
39
39
 
40
40
  CONFIRM_PROCEED = 1
41
41
  CONFIRM_SKIP = 2
@@ -53,7 +53,7 @@ class Etch::Client
53
53
  @server = options[:server] ? options[:server] : 'https://etch'
54
54
  @tag = options[:tag]
55
55
  @varbase = options[:varbase] ? options[:varbase] : '/var/etch'
56
- @local = options[:local]
56
+ @local = options[:local] ? File.expand_path(options[:local]) : nil
57
57
  @debug = options[:debug]
58
58
  @dryrun = options[:dryrun]
59
59
  @interactive = options[:interactive]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etch
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.2
4
+ version: 3.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Heiss
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-20 00:00:00 -08:00
12
+ date: 2010-08-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency