summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-11 17:33:12 -0600
committerLuke Kanies <luke@madstop.com>2008-02-11 17:33:12 -0600
commite247b56d9941b4a636d3a3d9935d6b9cd9b199ea (patch)
tree97bf0cff97633125ed2fd76b14b8555723b296f3 /lib/puppet
parent6a4cf6c978e8c8aebba4ed0f16d3de7bb31a0ce0 (diff)
downloadpuppet-e247b56d9941b4a636d3a3d9935d6b9cd9b199ea.tar.gz
puppet-e247b56d9941b4a636d3a3d9935d6b9cd9b199ea.tar.xz
puppet-e247b56d9941b4a636d3a3d9935d6b9cd9b199ea.zip
Changing some methods in the Compile class to
be more internally consistent (switched store_resource to add_resource, and store_override to add_override).
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/ast/definition.rb2
-rw-r--r--lib/puppet/parser/ast/resource.rb2
-rw-r--r--lib/puppet/parser/ast/resource_override.rb2
-rw-r--r--lib/puppet/parser/collector.rb2
-rw-r--r--lib/puppet/parser/compile.rb46
5 files changed, 27 insertions, 27 deletions
diff --git a/lib/puppet/parser/ast/definition.rb b/lib/puppet/parser/ast/definition.rb
index e3f6414c3..992bb1f5e 100644
--- a/lib/puppet/parser/ast/definition.rb
+++ b/lib/puppet/parser/ast/definition.rb
@@ -31,7 +31,7 @@ class Puppet::Parser::AST::Definition < Puppet::Parser::AST::Branch
scope.catalog.tag(*resource.tags)
- scope.compile.store_resource(scope, resource)
+ scope.compile.add_resource(scope, resource)
return resource
end
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index 606beb537..2dadf9ed6 100644
--- a/lib/puppet/parser/ast/resource.rb
+++ b/lib/puppet/parser/ast/resource.rb
@@ -51,7 +51,7 @@ class Resource < AST::ResourceReference
# And then store the resource in the compile.
# At some point, we need to switch all of this to return
# objects instead of storing them like this.
- scope.compile.store_resource(scope, obj)
+ scope.compile.add_resource(scope, obj)
obj
end
}.reject { |obj| obj.nil? }
diff --git a/lib/puppet/parser/ast/resource_override.rb b/lib/puppet/parser/ast/resource_override.rb
index d15f68608..db0986a8e 100644
--- a/lib/puppet/parser/ast/resource_override.rb
+++ b/lib/puppet/parser/ast/resource_override.rb
@@ -42,7 +42,7 @@ class Puppet::Parser::AST
# Now we tell the scope that it's an override, and it behaves as
# necessary.
- scope.compile.store_override(obj)
+ scope.compile.add_override(obj)
obj
end
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb
index b8165a84f..efd64a320 100644
--- a/lib/puppet/parser/collector.rb
+++ b/lib/puppet/parser/collector.rb
@@ -150,7 +150,7 @@ class Puppet::Parser::Collector
resource.exported = false
- scope.compile.store_resource(scope, resource)
+ scope.compile.add_resource(scope, resource)
return resource
end
diff --git a/lib/puppet/parser/compile.rb b/lib/puppet/parser/compile.rb
index bceead271..f68796843 100644
--- a/lib/puppet/parser/compile.rb
+++ b/lib/puppet/parser/compile.rb
@@ -17,6 +17,28 @@ class Puppet::Parser::Compile
@collections << coll
end
+ # Store a resource override.
+ def add_override(override)
+ # If possible, merge the override in immediately.
+ if resource = @catalog.resource(override.ref)
+ resource.merge(override)
+ else
+ # Otherwise, store the override for later; these
+ # get evaluated in Resource#finish.
+ @resource_overrides[override.ref] << override
+ end
+ end
+
+ # Store a resource in our resource table.
+ def add_resource(scope, resource)
+ @catalog.add_resource(resource)
+
+ # And in the resource graph. At some point, this might supercede
+ # the global resource table, but the table is a lot faster
+ # so it makes sense to maintain for now.
+ @catalog.add_edge!(scope.resource, resource)
+ end
+
# Do we use nodes found in the code, vs. the external node sources?
def ast_nodes?
parser.nodes.length > 0
@@ -186,28 +208,6 @@ class Puppet::Parser::Compile
@catalog.vertices
end
- # Store a resource override.
- def store_override(override)
- # If possible, merge the override in immediately.
- if resource = @catalog.resource(override.ref)
- resource.merge(override)
- else
- # Otherwise, store the override for later; these
- # get evaluated in Resource#finish.
- @resource_overrides[override.ref] << override
- end
- end
-
- # Store a resource in our resource table.
- def store_resource(scope, resource)
- @catalog.add_resource(resource)
-
- # And in the resource graph. At some point, this might supercede
- # the global resource table, but the table is a lot faster
- # so it makes sense to maintain for now.
- @catalog.add_edge!(scope.resource, resource)
- end
-
# The top scope is usually the top-level scope, but if we're using AST nodes,
# then it is instead the node's scope.
def topscope
@@ -233,7 +233,7 @@ class Puppet::Parser::Compile
# Create a resource to model this node, and then add it to the list
# of resources.
resource = Puppet::Parser::Resource.new(:type => "node", :title => astnode.classname, :scope => topscope, :source => topscope.source)
- store_resource(topscope, resource)
+ add_resource(topscope, resource)
@catalog.tag(astnode.classname)
resource.evaluate