summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
Commit message (Collapse)AuthorAgeFilesLines
* (#7523) Refactor the grammar to reduce duplicationNick Lewis2011-05-173-1261/+952
| | | | | | | | | | | | | | | | | | This commit unifies some paths in the grammar, which had previously been duplicated to avoid shift/reduce conflicts. Merging these paths together and separating only the conflicting structures leads to a cleaner grammar, with fewer holes. Several bugs are fixed as a result: (#3129) Nested class names beginning with numbers work correctly (#5268) Hyphens in class names work correctly (#5817) Hashes and arrays can now be passed to functions (hashes require parentheses) Additionally, expressions are now legal in most places where they would make sense, when previously only bare rvalues were allowed. Paired-With: Markus Roberts Reviewed-By: Matt Robinson
* Merge branch '2.7.x' into 2.7.nextDaniel Pittman2011-05-061-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: * spec/unit/node/facts_spec.rb Updates: * spec/unit/interface/action{,_builder}_spec.rb => update for 'when_invoked' block being required.
| * (#7101) Fix template error messages in Ruby 1.8.5Max Martin2011-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | lib/puppet/parser/templatewrapper.rb#script_line was calling .first on a String object, which in Ruby > 1.8.5 will return the entire string, but in 1.8.5 will cause an exception. This change (proposed by Markus Roberts) removes the call to .first and adds a condition for when the template error involves the file not being found. Reviewed-by: Jesse Wolfe
* | Merge branch '2.6.next' into 2.7.nextJosh Cooper2011-04-211-0/+2
|\ \ | | | | | | | | | | | | | | | | | | Manually resolved conflicts: lib/puppet/parser/resource.rb lib/puppet/parser/scope.rb spec/unit/parser/scope_spec.rb
| * | Maint: Fix a #4655 introduced log inconsistencyJesse Wolfe2011-04-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we moved code from the compiler to parser/resource, we lost a conditional that prevented defined resources from gaining containment edges to stages. Adding a stage to a defined resource was usually harmless, but it violated the invariant of "resources should only have exactly one container as their direct parent", producing a 50% chance of a malformed containment path in log messages. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
| * | (#4655) Allow stage to be set using a default class parameterJacob Helwig2011-04-193-14/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example: stage{ pre: before => Stage[main] } class someclass ($stage=pre ) { ... } class { someclass: } This transplants adding the edge from the resource to the stage from the compiler into when the resource is evaluated. This moves adding the stage edges to after when the defaults are copied into the resources, making them available. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
| * | (#5477) Allow watch_file to watch non-existent files, especially site.ppJesse Wolfe2011-03-252-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The watch_file mechanism would refuse to monitor paths to files that didn't exist. This patch makes it possible to watch a file that hasn't been created yet, so when it is created, you manifests will get reparsed. Backported this change to 2.6.x Paired-With: Jacob Helwig <jacob@puppetlabs.com>
| * | (4576) - if ENC declares invalid class, it is logged at warning.Dan Bode2011-03-161-1/+1
| | | | | | | | | | | | | | | used to be at info, so you had to run the master on verbose to see it an ENC was trying to declare a class that could not be loaded.
* | | Merge branch 'tickets/2.7.x/4655-parameterized-classes-default-stages' into nextJacob Helwig2011-04-193-14/+26
|\ \ \ | |_|/ |/| | | | | | | | * tickets/2.7.x/4655-parameterized-classes-default-stages: (#4655) Allow stage to be set using a default class parameter
| * | (#4655) Allow stage to be set using a default class parameterJacob Helwig2011-04-193-14/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example: stage{ pre: before => Stage[main] } class someclass ($stage=pre ) { ... } class { someclass: } This transplants adding the edge from the resource to the stage from the compiler into when the resource is evaluated. This moves adding the stage edges to after when the defaults are copied into the resources, making them available. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* | | Cleanup trailing whitespaceJacob Helwig2011-04-141-2/+2
| | |
* | | (#7111) Clarify scoping deprecation warningJacob Helwig2011-04-141-1/+1
|/ / | | | | | | | | | | | | | | This modifies the deprecation warning to explicitly point out that the specified behavior is deprecated, when it is slated to be removed, along with what the user can do to prepare for its removal. Paired-with: Randall Hansen <randall@puppetlabs.com>
* | Merge branch 'ticket/next/6928' into nextNick Lewis2011-04-131-0/+2
|\ \
| * | Revert "(#6928) Removed --ignoreimport"Nick Lewis2011-04-131-0/+2
| | | | | | | | | | | | | | | | | | | | | This reverts commit 24a277c5e805ce16e0b86e17e6cb2fbe1945ae07. Despite not needing --ignoreimport as an option anymore, it's still used internally and has to stay.
* | | Merge branch 'ticket/next/6928' into nextNick Lewis2011-04-133-8/+6
|\| |
| * | (#6928) Removed --ignoreimportNick Lewis2011-04-131-2/+0
| | | | | | | | | | | | | | | | | | This was only used with --parseonly, which is gone. Paired-With: Jesse Wolfe
| * | (#6928) Remove --parseonlyNick Lewis2011-04-132-6/+6
| | | | | | | | | | | | | | | | | | This has been removed in favor of 'puppet parser validate <manifest>'. Paired-With: Jesse Wolfe
* | | (#6830) Fix sha1 to digest/sha1 require issue for Ruby 1.9Matt Robinson2011-04-131-1/+1
|/ / | | | | | | Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* | (#5027) Spell deprecation correctlyNick Lewis2011-04-121-1/+1
| | | | | | | | Paired-With: Jesse Wolfe
* | Fix for #5027 -- generate a deprication warning for dynamic lookupMarkus Roberts2011-04-121-1/+5
| | | | | | | | | | | | This fix implements the same logic as Nick & Paul's patch in a different way. There aren't any tests yet and I'm still working out if I agree with the handling of some edge cases, so this should be considered premliminary.
* | Towards 5027 -- add options hash to lookupvar as with setvarMarkus Roberts2011-04-124-10/+17
| | | | | | | | | | | | | | | | | | | | This patch adds an options hash to lookupvar analogous to the one taken by setvar and uses it to pass in source location for error reporting. It also fixes the mechanism used by setvar (file was not being passed correctly), adds line and file information to errors in templates, and extends/corrects tests. As presently written it does not gather userful line numbers from inline templates and there are no tests for the template line number generation.
* | Refactor for 5027 -- get rid of lookup_qualified_varMarkus Roberts2011-04-121-17/+12
| | | | | | | | | | | | | | Scope#lookup_qualified_var was a "magic bag" that took a qualified variable name apart and called back in to lookupvar with a new scope. This commit is a semantically neutral refactor that replaces it with a function to find the desired scope as a pure function (with error detection).
* | Step towards #5027 -- scopes should know if they are dynamicMarkus Roberts2011-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic for distinguishing dynamic / static scopes was borrowed from Nick & Paul's patch, the main differences here being 1) calling it "dynamic" (true/ false) rather than "parent_relationship" (:inherited/:dynamic) 2) aligning the default so that it only needs to get set in one place (the one that will eventually go away) and 3) setting it on createion rather than with a setter. Setting it in one place, on creation, also makes it easier to see that anytime we access a scope it will have the correct setting of Scope#dynamic and that this does not change. This commit also contains a minor refactor (removing Type#subscope) that is not strictly tied to the main purpose but lies in the direction we are needing to go and it simplified things to do it now.
* | Refactor on the road to #5027 -- remove unused Scope#strinterpMarkus Roberts2011-04-121-59/+0
| | | | | | | | | | | | | | One of the uses of lookupvar was in the method Scope#strinterp; this method is no longer used (string interpolation is now handled by the parser (for the syntax) and AST nodes (for the semantics)) so this use of lookupvar can be excised, along with a fair amount of surrounding code.
* | Refactor en route to #5027 -- remove usestring parameter from lookupvarMarkus Roberts2011-04-125-35/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usestring parameter to lookupvar was objectionable for several reasons; first, it performed a function orthogonal to the main purpose of the method, second its default was the least common value, and third it was causing other code to work for reasons that were not obvious (extlookup). This refactor breaks the value-transforming function out into a seperate method which allows the user to specify the value to be used in lieu of :undef and removes the parameter. The function, Scope#undef_as(default,exp) is written so that it can be used in user code (templates, functions, etc.) if needed. This refactor will introduce a user-visible behaviour change in the case where users were counting on lookupvar to return "" for undefined variables. The best solution is to have them use undef_as, replacing: lookupvar('myvar') with undef_as('',lookupvar('myvar')) (with the option to specify another default value if desired). If this is too objectionable, we could rename the existing lookupvar as raw_lookupvar and define def lookupvar(v) undef_as('',raw_lookupvar(v)) end to restore the present behaviour.
* | Fix for #5063 -- explicitly scope internal variable lookupsMarkus Roberts2011-04-122-8/+3
| | | | | | | | | | When we lookup a global variable / fact from code we should explicitly look in the global scope.
* | Refactor on the way to #5063 -- removing unused Scope#levelMarkus Roberts2011-04-121-3/+1
| | | | | | | | This attribute is apparently no longer set or accessed.
* | Refactor prior to #5063 -- remove dead "topscope?" codeMarkus Roberts2011-04-121-5/+0
| | | | | | | | | | The Scope#topscope? method was never called anywhere (including tests) and so far as I can tell was incorrect as the Scope#level is never being set.
* | Merge branch 'feature/2.6.next/5909' of https://github.com/bodepd/puppet ↵Jesse Wolfe2011-03-291-0/+47
|\ \ | | | | | | | | | into next
| * | (5909) Function to dyncamically generate resources.Dan Bode2011-03-161-0/+47
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function allows you to dynamically generate resources, passing them as a hash to the create_resources function. This was originally written to be used together with an ENC. Resources can be programitally generated as yaml and passed to a class. classes: webserver::instances: instances: instance1: foo: bar instance2: foo: blah Then puppet code can consume the hash parameters and convert then into resources class webserver::instances ( $instances = {} ) { create_resources('webserver::instance', $instances) } Now I can dynamically determine how webserver instances are deployed to nodes by updating the YAML files.
* | (#6830) Fix MD5 handling to work with Ruby 1.9Matt Robinson2011-03-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 1.9 you have to require 'digest/md5' instead of just 'md5'. The following irb sessions from each version of Ruby should explain the changes in how MD5 is used between Ruby versions and why this patch was made. ruby-1.9.2-p136 :001 > require 'md5' LoadError: no such file to load -- md5 ruby-1.9.2-p136 :002 > require 'digest/md5' => true ruby-1.9.2-p136 :003 > Digest::MD5.hexdigest('mystring') => "169319501261c644a58610f967e8f9d0" ruby-1.9.2-p136 :004 > Digest::MD5.new('mystring') => #<Digest::MD5: d41d8cd98f00b204e9800998ecf8427e> ruby-1.8.7-p330 :001 > require 'digest/md5' => [] ruby-1.8.7-p330 :002 > require 'md5' => ["MD5"] ruby-1.8.7-p330 :003 > Digest::MD5.hexdigest('mystring') => "169319501261c644a58610f967e8f9d0" ruby-1.8.7-p330 :004 > MD5.new('mystring') => #<MD5: 169319501261c644a58610f967e8f9d0> ruby-1.8.7-p330 :005 > MD5.new('mystring').to_s => "169319501261c644a58610f967e8f9d0" ruby-1.8.7-p330 :006 > Digest::MD5.new('mystring') ArgumentError: wrong number of arguments (1 for 0) Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
* | Merge branch 'ticket/next/5477' into nextJesse Wolfe2011-03-252-3/+3
|\ \
| * | (#5477) Allow watch_file to watch non-existent files, especially site.ppJesse Wolfe2011-03-252-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The watch_file mechanism would refuse to monitor paths to files that didn't exist. This patch makes it possible to watch a file that hasn't been created yet, so when it is created, you manifests will get reparsed. Paired-With: Max Martin <max@puppetlabs.com> Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
* | | Merge branch 'tickets/master/6850-resource_type_listing_and_converting' into ↵Luke Kanies2011-03-251-0/+28
|\ \ \ | |/ / |/| | | | | next
| * | Fixing #6851 - ResourceType#find/search loads typesLuke Kanies2011-03-251-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we could only find types from site.pp, but we now automatically load the specified type (for find) or all types. This also adds a TypeLoader#import_all capable of importing all manifests (ruby or puppet) on a given system. Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* | | (#4576) Raise an error when a node is classified into a non-existent classJesse Wolfe2011-03-241-10/+6
|/ / | | | | | | | | | | | | | | | | | | In 2.6.x, this was upgraded from "info" to "warning". This change for Statler escalates the warning to an exception which will abort the compile. This makes compiling fail consistently when you try to use an undefined class from any of: node classifiers, the class keyword, and the include function. Paired-with: Jacob Helwig <jacob@puppetlabs.com>
* | (#6555) Fix another ruby 1.9 incompatible case statementMatt Robinson2011-03-221-1/+1
| |
* | Merge branch '2.6.x' into nextMatt Robinson2011-03-181-4/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: (36 commits) Updated CHANGELOG for 2.6.7rc1 (#5073) Download plugins even if you're filtering on tags Fix #5610: Prevent unnecessary RAL lookups Revert "Merge branch 'ticket/2.6.x/5605' of git://github.com/stschulte/puppet into 2.6.next" (#6723) Fix withenv environment restoration bug (#6689) Remove extraneous include of Puppet::Util in InventoryActiveRecord Remove extra trailing whitespace from lib/puppet/resource.rb (#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigs (#6707) Fix typo in rest_authconfig.rb (#6689) Make inventory_active_record terminus search quickly (#5392) Give a better error when realizing a non-existant resource (#2645) Adding a less-stubby test to verify the "system" attribute's behavior Update CHANGELOG for 2.6.6 maint: Remove serialization of InventoryFact values maint: Rename InventoryHost to InventoryNode Fixed #2645 - Added support for creating system users maint: Remove spec run noise maint:Refactor of mount provider integration tests (#6338) Support searching on metadata in InventoryActiveRecord terminus (#6338) Implement search for InventoryActiveRecord facts terminus ... This merge includes essentially reverting #4904's change to the mount type since tests that came in from 2.6.x specified different behavior and what's correct is not clear to me. I've reopened #4904 and added it to our backlog, and talked to Nigel about the RFC that's currently out on the puppet-users mailing list for a bigger refactor of how the mount provider works. Manually Resolved Conflicts: spec/spec_helper.rb spec/unit/indirector/queue_spec.rb
| * (#5392) Give a better error when realizing a non-existant resourceMatt Robinson2011-03-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | You can reproduce the error with a simple manifest Bogus_type <| title == 'foo' |> We used to fail because find_resource_type returned nil and we never checked if it was nil before calling methods on it. Reviewed-by: Max Martin <max@puppetlabs.com>
* | Merge branch '2.6.next' into nextMatt Robinson2011-03-076-1749/+1846
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a particularly nasty merge, so rather than hold up merges into next any longer, I'm going to push this merge with a few outstanding problems. The tests that were failing in the following areas have been marked pending, and will be addressed separately, immediately following this push. TODO: Verify that brice's rdoc change is still valid: tests to show that line numbers from class, define and node get into the ast Fix mount parsed_spec spec/unit/provider/mount/parsed_spec.rb * 2.6.next: (85 commits) (#5148) Fix failing spec due to timezone (#5148) Add support for PSON to facts (#6338) Remove inventory indirection, and move to facts indirection (#6445) Fix inline docs: puppet agent does not accept --mkusers Update CHANGELOG and version for 2.6.6rc1 (#6541) Fix content with checksum truncation bug (#6418) Recursive files shouldn't be audited (#6541) maint: whitespace cleanup on the file integration spec (#6541) Fix content with checksum truncation bug (#5466) Write specs for output of puppet resource (#5466) Monkey patch Symbol so that you can sort them (#5466) Fixed puppet resource bug with trailing , Update CHANGELOG for 2.6.5 (#4922) Don't truncate remotely-sourced files on 404 (#6338) Remove unused version control tags Maint: Align tabs in a code block in the Augeas type. (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type Maint: Rewrite comments about symlinks to reflect best practice. (#6509) Inline docs: Fix broken lists in Launchd provider. (#6509) Inline docs: Fix broken code blocks in zpool type ... Manually Resolved Conflicts: lib/puppet/application/inspect.rb lib/puppet/defaults.rb lib/puppet/file_bucket/dipper.rb lib/puppet/network/http/handler.rb lib/puppet/node/facts.rb lib/puppet/parser/parser.rb lib/puppet/parser/parser_support.rb lib/puppet/util/command_line/puppet lib/puppet/util/command_line/puppetd lib/puppet/util/command_line/puppetmasterd lib/puppet/util/monkey_patches.rb lib/puppet/util/rdoc/parser.rb spec/unit/application/agent_spec.rb spec/unit/file_bucket/file_spec.rb spec/unit/indirector/file_bucket_file/file_spec.rb spec/unit/network/http/handler_spec.rb spec/unit/parser/parser_spec.rb spec/unit/provider/mount/parsed_spec.rb
| * Merge branch 'maint/2.6.next/revert-5935' into 2.6.nextNick Lewis2011-02-282-980/+962
| |\
| | * Revert "(#5935) Allow functions to accept negated values"Nick Lewis2011-02-212-980/+962
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e3c59df2b246fe5e764272f21b631a5d2f28687f. This commit is being reverted because the solution is incomplete, and a better solution is out of scope for this release. A more complete solution will be implemented in the future.
| * | (#6338) Remove unused version control tagsMatt Robinson2011-02-281-3/+0
| |/ | | | | | | | | | | | | Older version control systems like CVS and SVN used to use these $Id$ tags for version information. Paired-with: Nick Lewis
| * (#5935) Allow functions to accept negated valuesNick Lewis2011-02-172-962/+980
| | | | | | | | | | | | | | | | | | function(-1) was failing because the grammar wasn't allowing negated values in function calls. This fix makes the negation of any value which was previously legal as a function argument also now legal as a function argument. Paired-With: Max Martin Paired-With: Markus Roberts
| * (Fixes #6269) merge changes from masterzen that resolve the issue.Daniel Pittman2011-02-122-393/+401
| |\ | | | | | | | | | parser.rb manually rebuilt to resolve global grammer chances.
| | * Fix #6269 - Hashes only work with two levels of accessBrice Figureau2011-02-122-800/+793
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following manifest was failing: $hash = { 'a' => { 'b' => { 'c' => 'it works' } } } $out = $hash['a']['b']['c'] because of a typo in the grammar. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | (#5516) Rebuild parser.rb after merge.Daniel Pittman2011-02-121-1541/+1630
| | | | | | | | | | | | | | | The automatically generated parser.rb needed to be rebuilt to make the syntax changes functional; this commits only that rebuild.
| * | Merge branch 'masterzen/tickets/2.6.x/5516' into ↵Daniel Pittman2011-02-122-426/+416
| |\ \ | | | | | | | | | | | | bug/2.6.next/5516-hashes-can't-be-used-in-selectors
| | * | Fix #5516 - Hashes can't be used in selectorsBrice Figureau2011-02-122-426/+416
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following manifest was producing a parse error: $int = { 'eth0' => 'bla' } $foo = $int['eth0'] ? { 'bla' => 'foo', default => 'bleh' } because selectors didn't support hash access. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | Merge branch 'masterzen/tickets/2.6/5720' into ↵Daniel Pittman2011-02-123-5/+8
| |\ \ | | | | | | | | | | | | bug/2.6.next/5720-puppetdoc-fails-on-parameterized-class