Class: Puppet::Network::Handler::Master
- Includes:
- Util
- Defined in:
- lib/vendor/puppet/network/handler/master.rb
Constant Summary
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows
Instance Attribute Summary collapse
-
#ast ⇒ Object
Returns the value of attribute ast.
-
#ca ⇒ Object
readonly
Returns the value of attribute ca.
Instance Method Summary collapse
- #decode_facts(facts) ⇒ Object
-
#freshness(client = nil, clientip = nil) ⇒ Object
Tell a client whether there’s a fresh config for it.
-
#getconfig(facts, format = "marshal", client = nil, clientip = nil) ⇒ Object
Call our various handlers; this handler is getting deprecated.
-
#initialize(hash = {}) ⇒ Master
constructor
A new instance of Master.
-
#translate(config) ⇒ Object
Translate our configuration appropriately for sending back to a client.
Methods included from Util
absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Constructor Details
#initialize(hash = {}) ⇒ Master
Returns a new instance of Master.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vendor/puppet/network/handler/master.rb', line 29 def initialize(hash = {}) args = {} @local = hash[:Local] args[:Local] = true # This is only used by the cfengine module, or if --loadclasses was # specified in +puppet+. args[:Classes] = hash[:Classes] if hash.include?(:Classes) end |
Instance Attribute Details
#ast ⇒ Object
Returns the value of attribute ast.
15 16 17 |
# File 'lib/vendor/puppet/network/handler/master.rb', line 15 def ast @ast end |
#ca ⇒ Object (readonly)
Returns the value of attribute ca.
16 17 18 |
# File 'lib/vendor/puppet/network/handler/master.rb', line 16 def ca @ca end |
Instance Method Details
#decode_facts(facts) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/vendor/puppet/network/handler/master.rb', line 63 def decode_facts(facts) if @local # we don't need to do anything, since we should already # have raw objects Puppet.debug "Our client is local" else Puppet.debug "Our client is remote" begin facts = YAML.load(CGI.unescape(facts)) rescue => detail raise XMLRPC::FaultException.new( 1, "Could not rebuild facts" ) end end facts end |
#freshness(client = nil, clientip = nil) ⇒ Object
Tell a client whether there’s a fresh config for it
24 25 26 27 |
# File 'lib/vendor/puppet/network/handler/master.rb', line 24 def freshness(client = nil, clientip = nil) # Always force a recompile. Newer clients shouldn't do this (as of April 2008). Time.now.to_i end |
#getconfig(facts, format = "marshal", client = nil, clientip = nil) ⇒ Object
Call our various handlers; this handler is getting deprecated.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/vendor/puppet/network/handler/master.rb', line 42 def getconfig(facts, format = "marshal", client = nil, clientip = nil) facts = decode_facts(facts) client ||= facts["hostname"] # Pass the facts to the fact handler Puppet::Node::Facts.indirection.save(Puppet::Node::Facts.new(client, facts)) unless local? catalog = Puppet::Resource::Catalog.indirection.find(client) case format when "yaml" return CGI.escape(catalog.extract.to_yaml) when "marshal" return CGI.escape(Marshal.dump(catalog.extract)) else raise "Invalid markup format '#{format}'" end end |
#translate(config) ⇒ Object
Translate our configuration appropriately for sending back to a client.
84 85 |
# File 'lib/vendor/puppet/network/handler/master.rb', line 84 def translate(config) end |