summaryrefslogtreecommitdiff
path: root/spec/integration
AgeCommit message (Collapse)AuthorFilesLines
2014-04-28(PUP-1699) Retain an instance of a Catalog's environmentJosh Partlow1-5/+0
A catalog used to have the symbolic name if it's environment set, but did not retain a reference to the actual environment instance. This could would likely allow the catalog to reference it's original environment for a legacy, memoized environment, but does not work with newer cacheing models for directory environments. The problem was showing up specifically in the spec/integration/parser/ruby_manifest_spec which would compile a catalog and then interrogate the catalog to see if it contained the expected resources. Resources have unfortunate behavior causing them to lookup environment in order to load types in support of the Resource#parse_title. But the current_environment retrieved by the resource in the spec was likely different than the one overridden during compilation, and if it had never performed an initial import, might fail attempting to lookup classes which were not on its path. To short circuit some of this madness, the compiler is explicitly setting a new Catalog#environment_instance, and Catalog#to_catalog is ensuring that it copies when duplicating. Catalog#resource then overrides current_environment to this instance.
2014-04-28(PUP-1840) Use configured digest_algorithm as default checksum_type for file ↵Jared Jennings1-9/+9
resources Without this patch, file resources will always try to checksum themselves using MD5. On FIPS 140-2 compliant hosts, this will fail. This patch adds sha256 as a permissible value for the File resource's checksum parameter, and makes the checksum parameter default to using the digest_algorithm, as set in the puppet.conf.
2014-04-27(maint) Convert to using have_resource matcherAndrew Parker2-24/+19
Using the have_resource matcher makes the tests a little shorter and more expressive. It also uses the common way of matching so that we can get better error reporting. It turns out that one of the tests was matching against the incorrect class name, so that is now fixed. This also extracts a be_resource matcher so that you can match against an individual resource independent of a catalog.
2014-04-27(maint) Convert to compile_to_catalogAndrew Parker1-135/+68
The tests used various ways to contruct the catalog. However, putting together a catalog isn't always as simple as just calling compile. compile_to_catalog puts all of the steps together in a way that is easy to use in the tests.
2014-04-23(PUP-2302) Fix issue with Resource Defaults for qualified namesHenrik Lindberg1-0/+15
When defaults were set using future evaluator and the resource has a qualified name, the registration of the default was not recognized because scope requires every segment of a qualified name to be upper cased. This adds upper casing of every segment. An integration test checks that the capitalization works.
2014-04-09Merge remote-tracking branch 'upstream/stable'Andrew Parker5-6/+9
* upstream/stable: (PUP-2158) Unlist configured environment (PUP-2158) Test dynamic environments with an empty environmentpath (PUP-2158) Fix integration apply application spec (PUP-2129) Fix issues with false interpolation start (no-such-method) (PUP-2158) Report 404 for missing environment (PUP-2158) Default a missing manifest to no_manifest (PUP-2158) Hide dir envs behind a feature flag Conflicts: lib/puppet/node/environment.rb spec/unit/environments_spec.rb
2014-04-08(PUP-2158) Fix integration apply application specJosh Partlow1-0/+2
With the environmentpath defaulting to an empty string, we were attempting to create a '/production' environment directory in the spec and failing because of permission issues. Setting environmentpath to a temp directory before hand now, which was it what was being done in the test_helper.rb previously.
2014-04-07(PUP-2158) Default a missing manifest to no_manifestAndrew Parker4-5/+5
The tests were often creating environments that didn't need to have manifests. Since we didn't have a way of specifying that when they were written, we used '' to fill in the blank. This actually caused a large number of tests to try to find code to load in the PWD, which caused tests to break if a developer had parse errors in manifests being used for testing in the root directory of their puppet project. This changes the manifest to be optional and removes '' from those tests. The tests no longer fail if a bad manifest is in the PWD :D
2014-04-07(PUP-2158) Hide dir envs behind a feature flagAndrew Parker1-1/+2
In too many cases, having the directory environments enabled by default caused many user's dynamic environments to be detected as directory environments. This caused broken environments, sometimes in very subtle ways. This changes it so that directory environments are not enabled by default, but can be turned on. It does this by defaulting the environmentpath to the empty string, and using the empty string to denote disabled directory environments. When directory environments are enabled, legacy environments are disabled, and vice versa.
2014-04-07(PUP-1964) Handle nil class parameter valueHenrik Lindberg1-1/+12
The problem was that nil was not transformed to undef for the result of a parameter default expression and nil was interpreted as value missing by the 3x class/define logic. This adds a transformation in the PopsBridge by introducing a new kind of bridging expression. Likewise, a transformation was needed back again to nil as the value was set in TypeCalculator when performing an inference and symbol :undef can not be used where a String is expected. It was also observed in PUP-1964 that the error that surfaced lacked location information. This was caused by the transformation of unparenthesized call, where the transformed call expression did not get location information set. Tests added for the two different problems. The factory method for recording position now also checks if the end_locateable is void of location information (which can happen in some transformations).
2014-03-31(PUP-2100) Use AddAccessDeniedAceEx for inheritanceRob Reynolds1-0/+17
With Access Control Entries (ACEs) on Windows, we currently use AddAccessDeniedAce which does not include inheritance and propagation, but AddAccessDeniedAceEx does. We are already using AddAccessAllowedAceEx when setting access allowed ACEs and we should use the same behavior for denied ACEs. This commit provides that ability. Without this commit we will not be able to properly manage access denied ACEs with inheritance to child objects.
2014-03-26Merge pull request #2331 from ticket/master/PUP-1587-catch-empty-cron-entriesCharlie Sharpsteen1-0/+24
(PUP-1587) crontab: make sure that invalid crontabs aren't written out (PUP-1586) remove obsolete unit test (PUP-1586) allow managing existing cronjobs without caring for command Signed-off-by: Charlie Sharpsteen <Charlie Sharpsteen chuck@puppetlabs.com>
2014-03-24Merge branch 'stable'Ryan McKern1-23/+20
2014-03-21(maint) Check for files by full nameAndrew Parker1-23/+20
Periodically this test would fail with a message about some path being a directory. It turns out that what was happening was that that generated name for the temp directory would end in "one" or "two". This caused the test to detect the directory entry in the response from the search request to be one of the files and so it would try to read the contents, which wasn't possible because it was the directory. This changes it to check for the files by the full path and use "include_in_any_order" to pull together two tests into one.
2014-03-18(PUP-1973) Fix getting scope vars to template for inherited scopeHenrik Lindberg1-0/+41
The change in PUP-1220 (turning off access to dynamic scope) accidentally also turned off access to inherited scope. This is a big problem because it blocks the most used pattern of getting parameters into classes in modules (and then accessing them in templates).
2014-03-18(PUP-1973) Fix getting scope vars to template for inherited scopeHenrik Lindberg1-0/+41
The change in PUP-1220 (turning off access to dynamic scope) accidentally also turned off access to inherited scope. This is a big problem because it blocks the most used pattern of getting parameters into classes in modules (and then accessing them in templates).
2014-03-13Merge pull request #2342 from ↵Charlie Sharpsteen1-0/+11
ffrank/ticket/master/PUP-1585-cron-duplication-with-target (PUP-1585) and (PUP-1624) cron: handle the user and target properties better
2014-03-10(PUP-1905) Split modulepath when supplied as an override from CLIDominic Cleal1-0/+9
When a --modulepath option is supplied from the CLI to override the node environment's modulepath, it can be made up of multiple directories with a path separator. The path is now split so multiple paths are correctly searched.
2014-03-05Merge pull request #2117 from ↵Andrew Parker1-0/+34
ffrank/ticket/master/22800-dynamic-lookup-in-templates (PUP-1220) apply proper scoping rules to scope#to_hash
2014-03-04Merge pull request #2407 from ↵Josh Partlow1-4/+49
jpartlow/issue/master/pup-1765-puppet-apply-ignores-cmdline-modulepath (PUP-1765) Directory env respects cmdline modulepath and manifest
2014-03-04(PUP-1765) Directory env respects cmdline modulepath and manifestJosh Partlow1-4/+49
The addition of directory environments in PUP-1118 caused a regression in the behavior of --modulepath and --manifest set from the commandline. Three cases are seen: 1) given a '$confdir/environments/production' directory, `puppet apply -e 'include "modclass"' --modulepath /some/other/modpath` fails to find the modclass from /some/other/modpath. The same problem is seen if a specific directory environment such as '--environment direnv' is set (assuming that direnv exists). 2) given a '$confdir/environments/production' directory, `puppet module install foo --modulepath /some/other/modpath` installs to '$confdir/environments/production'. If a specific directory environments such as '--environment direnv' is set, then it incorrectly installs to "$confdir/environments/direnv'. 3) given a '$confdir/environments/production' directory, `puppet master --manifest /some/other.pp` does not execute '/some/other.pp' when an agent calls in without specifying an environment. To fix these cases we are now explicitly overriding the configured environment with the stored :cli modulepath and/or manifest setting, both at application run time and when handling a v1 http api call.
2014-03-03(PUP-1585) cron: fix resource duplication in crontab providerFelix Frank1-0/+11
The regression fix for #19876 caused yet another regression in cron resources that manage the target property, but not the user property. The earlier fix made sure that a cron resource would not try and manage a matching record from another user's crontab. It did so by comparing the record's target to the resource's user property. When the user is unmanaged, but the target is specified instead, this would cause puppet to ignore the record on disk and add it once more. This is fixed by comparing the record's target to either the user property or the target property. If there is a should-value for the user, it is used, otherwise the provider falls back to the target should-value.
2014-02-28Merge branch ↵Andrew Parker1-29/+46
'adrienthebo-issue/master/pup-542-deep_freeze_arrays_numerics_booleans' * adrienthebo-issue/master/pup-542-deep_freeze_arrays_numerics_booleans: (PUP-542) Test the gamut of mutation (maint) Detect reparse when :code changes (maint) Allow arrays, bools, and numerics to be frozen
2014-02-28(PUP-542) Test the gamut of mutationAndrew Parker1-29/+46
There are a lot of ways that the facts hash could be mutated. This checks that none of those ways can happen.
2014-02-28(PUP-1144) Improve handling of underscore in variable namesHenrik Lindberg1-0/+24
The last segment of a qualified variable name is allowed to start with an underscore. Previously this was only allowed for a single segment.
2014-02-26(PUP-542) Make tests pass on 1.8.7 ('hash' vs 'Hash' in message)Henrik Lindberg1-1/+1
2014-02-26(PUP-542) Add structured facts to immutable $factsHenrik Lindberg1-0/+84
When opting in with trusted_node_data or immutable_node_data the facts are also available via $facts, an immutable hash of data.
2014-02-21(PUP-1587) crontab: make sure that invalid crontabs aren't written outFelix Frank1-0/+24
It is permissible to manage cron entries and not manage the command property. However, if the entry doesn't exist on the target system yet, puppet should not try to create it. In other words, a cron resource without a should value for the command property can only be synced to a valid state if the corresponding resource on the target system has a valid command value already. cron { "foo": minute => 1 } is alright with an existing crontab of # Puppet Name: foo * * * * * /some/command but not with a crontab not yet containing the entry named 'foo'. This change prevents the sync operation in the error scenario.
2014-02-19(PUP-1676) Puppet::Settings retrieves directory environment settingsJosh Partlow1-0/+50
During a Puppet[:setting] call, legacy environment settings would be loaded from a puppet.conf stanza. But settings from directory environments would never be seen. Areas in the codebase could obtain per environment settings by looking them up directly from an environment. However a call to puppet config or to an application with --configprint, would return the default modulepath if redirected to a directory environment using the --environment setting. A ValuesFromCurrentEnvironment class has been added to Settings to lookup environment settings not found in puppet.conf if there is a match with the :current_environment from the Context. Because of the need to access a global modulepath for environment and directory loader construction, a setting, :basemodulepath, has been added, so that we can initialize without fear of recursing infinitely looking up :modulepath. The possibility for recursion has been there since at least 3.0.0: [legacy] modulepath=/foo:$modulepath would overflow the stack. It could now be: [legacy] modulepath=/foo:$basemodulepath
2014-02-12PUP-1681 Stat doesn't expose correct mode on WinEthan J. Brown4-5/+10
- An issue was discovered where the values returned from Puppet::FileSystem.stat and Puppet::Util::Windows::Security.get_mode were not aligning as they should. The call to get_mode returns a mode value that should more correctly express a simulated POSIX mode on Windows - The stat instance returned from Ruby has been further monkey-patched on Windows to add an appropriate mode value using the existing lower-level code that reads a files security descriptor. - Some tests that were performing special handling of mode values were updated now that mode should be more consistent across platforms. - In some cases, an existing call to File.chmod was changed to call set_mode under Windows. In the future, our FileSystem abstraction should be modified to create an OS-agnostic single point of entry for setting mode on files.
2014-02-13(PUP-1220) make the dynamic scoping fix for #22800 flexibleFelix Frank1-33/+31
As suggested by Henrik Lindberg, make the parser only behave correctly when parser=future is configured. If working manifests rely on the regression, the next point release won't break them. Instead, users can test for this using the configuration setting. The next major release should adopt the fix as standard behavior and the legacy support should be removed. Since the variable lookups in templates relies on the accessing of local attributes, there is no way to issue deprecation warnings to users.
2014-02-13(PUP-1220) apply proper scoping rules to scope#to_hashFelix Frank1-0/+36
The fix for #1427 added an instance method to the scope class for exporting all variables from the local scope. This method apparently re-implemented the dynamic scoping rules. When those were removed, the #to_hash method was left as was. As a result, dynamic scoping still worked from within templates, when using the @variable syntax in the erb code. Fix this by using the new #enclosing_scope method so that proper scoping rules are used instead.
2014-02-12Merge pull request #2347 from dalen/file_validate_cmdCharlie Sharpsteen1-0/+18
(PUP-1670) Add validate_cmd parameter to file type
2014-02-12(PUP-1670) Add validate_cmd parameter to file typeErik Dalén1-0/+18
If this parameter is set, then this file will only be written if the command specified returns 0. Also adds a validate_replacement parameter to allow specifying some other string to use for specifying temporary file name instead of the default of '%'.
2014-02-11(PUP-1327) integration spec for the nagios typeFelix Frank1-0/+78
This is a very rough draft for a spec test wrt. the "mode" parameter. Testing group and owner is difficult since unprivileged rspec users cannot use chown or chgrp. This is open for discussion and should be revised before merging.
2014-02-11Merge branch 'pr/2024'Andrew Parker1-0/+21
* pr/2024: (PUP-649) Loosen checks for crontab provider (PUP-649) Use class instance variable (#3220) uniquify implicit record names (#3220) save overhead in cron type unit test and add cleanup (#3220) make the unit test "generating cron resources" match the new behaviour (#3220) fix a cron testing quirk with potential benefits for normale operation (#3220) make sure that generated cron resources belong to the correct user (#3220) crontab: allow purging unmanaged resources Closes GH-2024
2014-02-11(#3220) crontab: allow purging unmanaged resourcesFelix Frank1-0/+21
The problem was that unmanaged cronjobs would be parsed, but not implicitly named. Workaround: Pick an implicit name. It's derived from the command. The provider will never put this implicit name into a crontab file when writing it back to disk. The names are not unique if several unmanaged jobs execute the same command. That's a wrinkle and not mission critical, but it can be surprising for users, because the "duplicates" will not be purged during the first run.
2014-02-06(PUP-1574) Environment setting does not override apply/parser manifestJosh Partlow1-3/+24
Both `puppet apply` and `puppet parser validate` were relying on the legacy environment behavior to implicit draw in the setting of Puppet[:manifest]. But the new directory environments do not pay attention to Puppet[:manifest] and thus a call such as `puppet apply foo.pp --environment dir_env` would not apply foo.pp if dir_env was in the $environmentpath. This change explicitly creates a new environment based off the currently configured environment and overrides with the manifest this to be applied or validated.
2014-02-06(maint) Change name from from_pson to from_data_hashErik Dalén1-1/+1
This is because these methods are also used for deserialization from other formats than PSON. The method for serializing a object is called to_data_hash, so makes sense to call this from_data_hash.
2014-02-03(Maint) Clean up testsAndrew Parker1-26/+26
2014-02-03(PUP-865) Only use the pops merge for the future evaluatorAndrew Parker1-0/+8
The future evaluator is only really in play when both the parser is future and the evaluator is future. The old check left out the evaluator portion of that check and so ended up using the wrong CodeMerger when using the current evaluator with the future parser.
2014-02-03(PUP-865) Allow BlockExpression to evaluate everythingAndrew Parker1-18/+13
Previously BlockExpression would skip evaluating any AST nodes that implement an instantiate method. The assumption was that instiate only existed on Hostclass, Node, and Definition AST nodes and those same classes also did not implement an evaluate method. With the introduction of the PopsBridge::Program class, this entire house of assumption cards came falling down, since it impelements both instantiate and evaluate. The only thing that truly prevented BlockExpression from calling evaluate was that the default evaluate implementation on Parser::AST raised a Puppet::DevError to try to catch the case of evaluate not being implemented for an AST class. Since Parser::AST is entirely internal and missing an evaluate should show up very quickly in tests, we can just as easily make evaluate a noop by default, which then simplifies BlockExpression. This change fixes the problem where the body of pp files were loaded, but not evaluated when using the future evaluator and a directory of manifest files. The problem was triggered by the BlockExpression logic interacting with the PopsBridge::Program object and the structure created by the Puppet::Pops::Parser::CodeMerger.
2014-01-29(PUP-1118) Stop using Environment.newAndrew Parker4-23/+19
Instead of creating environments directly, we need to go through the configured environment loaders, otherwise environments can't come from other places.
2014-01-28(maint) Fix another broken rspec restrictionKylo Ginsberg1-1/+2
2014-01-22Merge remote-tracking branch 'upstream/stable'Iristyle1-0/+31
* upstream/stable: (maint) Fix rdoc generator for Ruby 2.1.0 (maint) Fix a comment. (maint) Fix can't modify frozen Symbol error on Ruby 2.1.0 (PUP-1389) Embed the extra NULL within the string (PUP-1389) Simplify logic for appending extra NULL (PUP-1389) ReplaceFile to FFI / move wide_string (PUP-1389) Ensure wide strings have double null terminators PUP-1322 Do not fail hard on unparseable files (maint) Correct documentation of each function (maint) Fix acceptance test for scheduled_task deletion Conflicts: lib/puppet/parser/functions/each.rb
2014-01-17Revert "Merge branch 'ticket/master/18342-windows-file-setting-owner-group'"Iristyle1-87/+0
This reverts commit cf4501c7a97c106994c2ef81756c2081f56feeef, reversing changes made to fcf482aa85708fe20f38cd96d6d92fc58ee78cf6.
2014-01-15(maint) really fix the execution locale testDan Lidral-Porter1-2/+2
2014-01-15Merge branch 'ticket/master/18342-windows-file-setting-owner-group'Rob Reynolds1-0/+87
2014-01-15(PUP-1404) Don't swallow execpipe tests on windowsDan Lidral-Porter1-12/+10
2014-01-15Don't run LANG/LC_ALL tests on windowsDan Lidral-Porter1-10/+12