Scope
A scope is a specific area of code that is partially isolated from other areas of code.
Scopes limit the reach of:
Scopes do not limit the reach of:
Resource titles, which are all global.
Resource references, which can refer to a resource declared in any scope.
A particular scope has access to its own contents, and also receives additional contents from its parent scope, node scope, and top scope. The rules for how Puppet determines a local scope’s parent are described in scope lookup rules.
In the diagram above:
Top scope can access variables and defaults only from its own scope.
Node scope can access variables and defaults from its own scope and top scope.
Each of the
example::parent
,example::other
, andexample::four
classes can access variables and defaults from their own scope, node scope, and top scope.The
example::child
class can access variables and defaults from its own scope, theexample::parent
scope, node scope, and top scope.
Sections