summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
Commit message (Collapse)AuthorAgeFilesLines
...
* | | (#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
| | * | Fix #5720 - puppetdoc misses some class commentsBrice Figureau2011-02-112-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It appears that the fix for #5252 wasn't complete, and class, nodes and definition were still using the current lexer line number instead of the line number of the class/define/node token. This combined with some missing comments stack pushing/pop on parenthesis prevented puppetdoc to correctly get the documentation of some class (including parametrized ones). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| | * | Fix #6280 - puppetdoc crashing on string interpolationBrice Figureau2011-02-111-1/+1
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following manifest was crashing puppetdoc: class test { include "test::$operatingsystem" } Because the quoted string is "rendered" as a concat AST, which in turn ended being an array when entering RDoc. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | (#6270) Fix formatting in split function's doc stringnfagerlund2011-02-091-7/+7
| | | | | | | | | | | | | | | | | | * Repaired a 2-indent/4-indent issue that kept a code block from being recognized * Wrapped literal strings in backticks to format as code and protect from Markdown * Added note about backslashes for escaping metacharacters.
| * | (#6270) Fix formatting in regsubst function's doc stringnfagerlund2011-02-091-14/+7
| |/ | | | | | | | | | | * Fixed ULs being interpreted as code blocks * Changed an example for variety. * Turned set of paragraphs inside a LI into a nested list.
* | Revert #5691 "Merge remote branch 'brice/feature/process-instrumentation' ↵Jesse Wolfe2011-03-011-5/+1
| | | | | | | | | | | | | | | | into next" This reverts commit 448a439f5abc3d51accececb678e9c5f547f7615, reversing changes made to 06939c51a3f675137b53fac8a521132a4c9cfcbe. As per discussion in http://projects.puppetlabs.com/issues/5691#note-5
* | Merge remote branch 'brice/feature/process-instrumentation' into nextJesse Wolfe2011-02-251-1/+5
|\ \
| * | Some high-level process name probesBrice Figureau2010-12-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here is an attempt to cover with process name probes some of the longest parts of a puppet agent or master. Currently: * node compilation * individual resource evaluation * some configurer parts * individual network requests Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | | Merge branch '2.6.x' into nextMatt Robinson2011-02-023-12/+52
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: (46 commits) Augmentation of tests for prior commit Fix to fix for #5755 -- backref serialization issues in zaml Fixed #5564 - Added some more fqdn_rand documentation Fixed #4968 - Updated list of options turned on by --test in documentation (#5061) - allow special hostclass/define variables to be evaluated as defaults. (#6107) Fix an error when auditing a file with empty content Remove already initialized constant warning from file_spec.rb tests (#5566) Treat source only File checksums as syntax errors when used with content Rename variable used in File type validation to be more clear Remove invalid "timestamp" and "time", and add missing "ctime" File checksum types. Remove order dependency when specifying source and checksum on File type Bug #5755 -- ZAML generates extra newline in some hash backreferences. bug #5681 -- code fix to handle AIX mount output Bug #5681 -- parse AIX mount command output. Spec for #5681 to allow parsing of AIX mount output in mount provider Fixed #6091 - Changed POSIX path matching to allow multiple leading slashes Bug #6091 -- test leading double-slash in filenames are allowed. Fixed #6071 - Fixed typo and improved exec path error message Fixed #6061 - Allowed -1 as password min/max age Bug #6061 -- verify that negative {min,max}_password_age are accepted. ... Manually Resolved Conflicts: lib/puppet/util/zaml.rb spec/unit/util/zaml_spec.rb
| * | Merge branch 'tickets/2.6.x/5564' into 2.6.nextPaul Berry2011-02-011-3/+6
| |\ \ | | | | | | | | | | | | | | | | * tickets/2.6.x/5564: Fixed #5564 - Added some more fqdn_rand documentation
| | * | Fixed #5564 - Added some more fqdn_rand documentationJames Turnbull2011-02-011-3/+6
| | | | | | | | | | | | | | | | Reviewed-by: Paul Berry <paul@puppetlabs.com>
| * | | Merge branch 'ticket/2.6.next/5045' into 2.6.nextMatt Robinson2011-02-011-3/+18
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ticket/2.6.next/5045: (#5045) Cleaning up some tests and code (#5045) External node classifiers should be able to specify params for classes (#5045) Adds support to resource/type to also accept a param hash
| | * | | (#5045) Cleaning up some tests and codeMatt Robinson2011-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renamed some variables to be clearer, made tests use less stubbing, added some additional tests and got rid of some unecessary logic. Paired-with: Dan Bode
| | * | | (#5045) External node classifiers should be able to specify params for classesDan Bode2011-01-241-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It facilitates the support for param classes from the ENC. It adds support for classes to be passed as a hash to the evaluate_classes method. If a hash of classes is specified, it also evaluates duplicates. I also had to convert the hash to an array for tags to be applied correctly. Reviewed-by: Matt Robinson
| * | | | (#5944) Remove documentation of define() when used on nodes, as it is not a ↵nfagerlund2011-01-251-21/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | supported use of this function. Final patch in this series reviewed by Dan Bode.
| * | | | (#5944) Further edits of inline defined() documentation.nfagerlund2011-01-251-25/+30
| | | | | | | | | | | | | | | | | | | | Fixing use of define/declare; editing for clarity.
| * | | | (#5944) Improve documentation of defined() functionnfagerlund2011-01-251-6/+41
| |/ / / | | | | | | | | | | | | The differences in the way defined() handles different types of entities weren't well-explained. Documentation was also added for the behavior of defined(Node["somenode.domain.com"]).
* | | | Merge branch '2.6.x' into nextNick Lewis2011-01-061-0/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Rakefile lib/puppet/resource/type_collection.rb lib/puppet/simple_graph.rb lib/puppet/transaction.rb lib/puppet/transaction/report.rb lib/puppet/util/metric.rb spec/integration/indirector/report/rest_spec.rb spec/spec_specs/runnable_spec.rb spec/unit/configurer_spec.rb spec/unit/indirector_spec.rb spec/unit/transaction/change_spec.rb