summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/handler
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-04 16:59:30 -0500
committerLuke Kanies <luke@madstop.com>2007-09-04 16:59:30 -0500
commitb0a947589ea6c7abf5658d9e5038eb7d96a11339 (patch)
tree484b6a7ac6f33b23cc022e3b972bde6982e1ff3f /lib/puppet/network/handler
parent11b127bd6708a18b512ca5b3018ccff1200cc47a (diff)
downloadpuppet-b0a947589ea6c7abf5658d9e5038eb7d96a11339.tar.gz
puppet-b0a947589ea6c7abf5658d9e5038eb7d96a11339.tar.xz
puppet-b0a947589ea6c7abf5658d9e5038eb7d96a11339.zip
Flipped the switch so that compiles now return a Configuration instance instead of pre-extracting the configuration.
Diffstat (limited to 'lib/puppet/network/handler')
-rw-r--r--lib/puppet/network/handler/configuration.rb6
-rw-r--r--lib/puppet/network/handler/master.rb13
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/puppet/network/handler/configuration.rb b/lib/puppet/network/handler/configuration.rb
index 1dbb16370..05c86f22e 100644
--- a/lib/puppet/network/handler/configuration.rb
+++ b/lib/puppet/network/handler/configuration.rb
@@ -37,7 +37,9 @@ class Puppet::Network::Handler
# Add any external data to the node.
add_node_data(node)
- return translate(compile(node))
+ configuration = compile(node)
+
+ return translate(configuration)
end
def initialize(options = {})
@@ -214,5 +216,3 @@ class Puppet::Network::Handler
end
end
end
-
-# $Id$
diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb
index ace383e9f..18f37ca4a 100644
--- a/lib/puppet/network/handler/master.rb
+++ b/lib/puppet/network/handler/master.rb
@@ -77,7 +77,9 @@ class Puppet::Network::Handler
fact_handler.set(client, facts)
# And get the configuration from the config handler
- return config_handler.configuration(client)
+ config = config_handler.configuration(client)
+
+ return translate(config.extract)
end
def local=(val)
@@ -139,5 +141,14 @@ class Puppet::Network::Handler
end
@fact_handler
end
+
+ # Translate our configuration appropriately for sending back to a client.
+ def translate(config)
+ if local?
+ config
+ else
+ CGI.escape(config.to_yaml(:UseBlock => true))
+ end
+ end
end
end