summaryrefslogtreecommitdiffstats
path: root/lib/puppet/client
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-11 20:44:38 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-11 20:44:38 +0000
commite287d1e1f1f4ff912ad8c049f8abe44d085011fa (patch)
tree65f7cc668024b3da308732e4bec95dfb71695372 /lib/puppet/client
parent37a059be9538bc90e09a17a45573fc44da6861b4 (diff)
Almost all tests now pass. I have basically reached the point where I was before I integrated graphing, except that all of the relationship handling is now inside the transaction, and any kind of recursion (including file) is *tons* easier to model and manage.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1905 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/client')
-rw-r--r--lib/puppet/client/master.rb37
1 files changed, 26 insertions, 11 deletions
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb
index 97d224065..fb7922937 100644
--- a/lib/puppet/client/master.rb
+++ b/lib/puppet/client/master.rb
@@ -125,20 +125,16 @@ class Puppet::Client::MasterClient < Puppet::Client
ensure
Puppet::Storage.store
end
-
+
if Puppet[:report]
- begin
- report = transaction.report()
- if Puppet[:rrdgraph] == true
- report.graph()
- end
- reportclient().report(report)
- rescue => detail
- Puppet.err "Reporting failed: %s" % detail
- end
+ report(transaction)
end
return transaction
+ ensure
+ if defined? transaction and transaction
+ transaction.cleanup
+ end
end
# Cache the config
@@ -496,6 +492,8 @@ class Puppet::Client::MasterClient < Puppet::Client
private
+ # Download files from the remote server, returning a list of all
+ # changed files.
def self.download(args)
objects = Puppet::Type.type(:component).create(
:name => "#{args[:name]}_collector"
@@ -529,12 +527,16 @@ class Puppet::Client::MasterClient < Puppet::Client
# Now source all of the changed objects, but only source those
# that are top-level.
+ files = []
trans.changed?.find_all do |object|
- yield object
+ yield object if block_given?
+ files << object[:path]
end
+ trans.cleanup
# Now clean up after ourselves
objects.remove
+ files
end
# Retrieve facts from the central server.
@@ -610,6 +612,19 @@ class Puppet::Client::MasterClient < Puppet::Client
loaddir(dir, "fact")
end
end
+
+ # Send off the transaction report.
+ def report(transaction)
+ begin
+ report = transaction.report()
+ if Puppet[:rrdgraph] == true
+ report.graph()
+ end
+ reportclient().report(report)
+ rescue => detail
+ Puppet.err "Reporting failed: %s" % detail
+ end
+ end
def reportclient
unless defined? @reportclient