| Module | Puppet::DSL |
| In: |
lib/puppet/dsl.rb
|
# File lib/puppet/dsl.rb, line 57
57: def acquire(*names)
58: names.each do |name|
59: if aspect = Puppet::DSL::Aspect[name]
60: unless aspect.evaluated?
61: aspect.evaluate
62: end
63: else
64: raise "Could not find aspect %s" % name
65: end
66: end
67: end
# File lib/puppet/dsl.rb, line 69
69: def apply
70: bucket = export()
71: catalog = bucket.to_catalog
72: catalog.apply
73: end
# File lib/puppet/dsl.rb, line 53
53: def aspect(name, options = {}, &block)
54: Puppet::DSL::Aspect.new(name, options, &block)
55: end
# File lib/puppet/dsl.rb, line 75
75: def export
76: objects = Puppet::DSL::Aspect.collect do |name, aspect|
77: if aspect.evaluated?
78: aspect.export
79: end
80: end.reject { |a| a.nil? }.flatten.collect do |obj|
81: obj.to_trans
82: end
83: bucket = Puppet::TransBucket.new(objects)
84: bucket.name = "top"
85: bucket.type = "class"
86:
87: return bucket
88: end
# File lib/puppet/dsl.rb, line 90
90: def init
91: unless Process.uid == 0
92: Puppet[:confdir] = File.expand_path("~/.puppet")
93: Puppet[:vardir] = File.expand_path("~/.puppet/var")
94: end
95: Puppet[:user] = Process.uid
96: Puppet[:group] = Process.gid
97: Puppet::Util::Log.newdestination(:console)
98: Puppet::Util::Log.level = :info
99: end