summaryrefslogtreecommitdiff
path: root/spec
AgeCommit message (Collapse)AuthorFilesLines
2014-08-18(PUP-3030) Port P::U::Execution to use our TempfileChris Price1-24/+25
This commit ports Puppet::Util::Execution over to use our alternate implementation of Tempfile. This will allow us to have more explicit control over the life cycle of these files on the server.
2014-08-18(PUP-3030) Refactor 'store' report to use replace_fileChris Price1-16/+0
There was some logic in the 'store' report processor that was almost identical to the logic in 'puppet/util.rb''s 'replace_file' method. This commit refactors 'store' to re-use the existing logic.
2014-08-18Merge branch 'zaphod42-issue/master/pup-3054-incorrect-lookup-in-inherits'Henrik Lindberg8-88/+145
2014-08-18(maint) Improve two test by checking they have no effect on catalog.Henrik Lindberg1-2/+2
It is now possible by checking if the result of a "produce" had no effect on the catalog by comparing against an empty array.
2014-08-18(maint) Express language tests in puppet languageAndrew Parker3-67/+82
This changes the tests of the puppet language, which should become part of the language specification's example and test suite, to be entirely expressed in the puppet language. This removes any dependency on ruby! Well, any dependency on ruby for specifying the language tests.
2014-08-18(PUP-3054) Ensure that inherits are absoluteAndrew Parker2-1/+38
PUP-121 was supposed to make all references to classes and resource types absolute, but it looks like it missed a spot. The class referenced in an inherits clause was not being looked up in an absolute manner, which caused it to find the wrong parent class in certain cases. This changes the future parser so that inherited classes are always absolute names.
2014-08-18(maint) Extract language specification toolsAndrew Parker5-41/+46
The resource_expressions_spec contained a useful way of writing language specification tests. This extracts those out so that they can be reused in other places.
2014-08-18(maint) Cleanup commentAndrew Parker1-1/+1
The comment had trailing whitespace and a comma. It makes more sense without either.
2014-08-16(PUP-3032) Add setting to always cache `feature` load attemptsChris Price1-0/+12
This commit adds a new setting, :always_cache_features, which affects how we cache attempts to load Puppet 'features'. If false, then calls to `Puppet.features.<feature>?` will always attempt to load the feature (which can be an expensive operation) unless it has already been loaded successfully. This makes it possible for a single agent run to, e.g., install a package that provides the underlying capabilities for a feature, and then later load that feature during the same run (even if the feature had been tested earlier and had not been available). If this setting is set to true, then features will only be checked once, and if they are not available, the negative result is cached and returned for all subsequent attempts to load the feature. This behavior is almost always appropriate for the server, and can result in a significant performance improvement for features that are checked frequently.
2014-08-15(PUP-2349) Specify mode as a string containing an octal modeKylo Ginsberg1-3/+3
Previously, mode was specified in some places as a Fixnum, in others as a String. Consistently specify mode as a string containing octal.
2014-08-15Merge pull request #2933 from rdark/fix/master/pup1527Adrien Thebo1-0/+9
(PUP-1527) After upgrade from 3.3.2-1 to 3.4.2-1 naginator fails to crea...
2014-08-14(PUP 229) Fix /etc/shadow parsing so that max/min_age is reported correctlyRahul Gopinath1-1/+23
Before this patch, parsing /etc/shadow, when empty trailing fields were present, they were discarded, and inturn a nil check was used to ensure that the fields did not exist. However, this ran into trouble when a value was appended to the end, causing all the empty fields to be returned as empty strings instead, failing the nil checks. This patch ensures that all empty fields are returned as empty strings, and a check for empty string is used to check whether the field exists or not.
2014-08-14Merge pull request #2965 from peterhuene/pup/3050Michael Smith2-71/+4
(PUP-3050) Update cfacter option for recent cfacter gem changes.
2014-08-15(PUP-1044) Make FileBucket::File use a local file whenever possibleHenrik Lindberg1-2/+2
2014-08-14Merge pull request #2972 from ↵Andrew Parker3-10/+5
cprice404/maint/master/PUP-3031-move-cert-expiration-check (PUP-3031) Move certification expiration check up
2014-08-14(PUP-3031) Move certification expiration check upChris Price3-10/+5
The http handler code contains a check to see if the expiration date of the client certificate is within a certain window, so that we can log a warning message if it will expire soon. However, the mechanisms for handling this kind of check can really vary depending on what web server you're running in, so it doesn't make sense for this check to occur in a code path that is common to all of the different web servers. This commit simply moves the logic up into the code for the individual web servers so that they will have the ability to adjust the behavior according to their own needs.
2014-08-14(PUP-2631) Elide long URIs for 404 messageAndrew Parker1-6/+30
When the agent encounters a 404 response from the master and it has been told to fail on 404, it previously output the entire path plus query string that it requested. However, the most common case where this occurs is when requesting a catalog, which can have a very long query string if the request was done with a GET. This does not always occur because even longer query strings will result in the agent using a POST instead of a GET, which causes the long query string output problem to go away. In order to fix this the query string is now elided to 100 characters (97 characters of the original text plus 3 periods). In order to still be able to debug any problems that might result from the query, however, the query string is *not* elided if the log level is `debug`.
2014-08-14Merge pull request #2970 from kylog/joshcooper-ticket/master/PUP-2907Kylo Ginsberg4-40/+118
ticket/master/pup 2907
2014-08-14(PUP-2907) Ignore source permissions on windows for fact syncJosh Cooper1-3/+1
Previously, puppet on windows would always issue a warning: Copying owner/mode/group from the source file on Windows is deprecated; use source_permissions => ignore Regardless of what was in the user's catalog. The reason is because puppet applies an internal catalog to download external facts, and that catalog contains a file resource whose source_permissions parameter is set to `:use`. This is done because external facts are often times scripts, which must be executable for puppet to invoke them. See commit 21edcd67b for PUP-2705. This commit makes it so that source permissions for external facts are ignored on Windows, while preserving existing behavior on other platforms. Permissions can be ignored on Windows, because puppet always has full control of files it creates.
2014-08-13(PUP-3050) Update cfacter option for recent cfacter gem changes.Peter Huene2-71/+4
Now that cfacter implements the Ruby Facter interoperability layer, there is no need for Puppet to "switch out" the Facter module for the CFacter module. libfacter itself will now expose a compatible Facter module in C++. Therefore, we no longer need facts.rb or the corresponding spec. Instead, simply require cfacter and call CFacter.initialize. This will replace Ruby Facter with the libfacter implementation.
2014-08-12Merge pull request #2960 from ↵Kylo Ginsberg1-0/+2
kylog/issue/pup-2879/add-more-services-to-blacklist (PUP-2879) Add two nfsd-related upstart services to the blacklist
2014-08-12Merge pull request #2958 from zaphod42/issue/master/pup-2972-remove-plussignmentHenrik Lindberg4-217/+29
(PUP-2972) Remove += and -=
2014-08-12(PUP-2972) Improve error message for += and -=Andrew Parker1-2/+2
The previous error message was very abrupt and didn't provide any kind of guidance for the user. The new message for += and -= let's them know that it is *no longer* supported and has a link to where they can get more information.
2014-08-11(PUP-2879) Add two nfsd-related upstart services to the blacklistKylo Ginsberg1-0/+2
2014-08-11(PUP-2972) Remove += and -=Andrew Parker4-217/+29
Previously the future parser supported += and -=. += was very similar to the same operator that is in the current parser, but with a few differences to make it consistent with the rest of the language. The += operator no longer performed string concatenation and instead acted like $a = $a + $b. The -= operator was added to complete the set of operators available. However, many people have been confused by these operators (even as they exist in the current parser): * It looks like mutation, but the language does not have mutation * It looks like += from other languages, but doesn't behave like them * Shadowing a variable is something that needs to be explicit, otherwise it becomes confusing. This removes += and -= from the future parser. They are still parsed, but the validation step will issue errors if they are encountered.
2014-08-11(PUP-3001) Revert future parser change removing dynamic scoped defaultsHenrik Lindberg1-2/+2
This reverts the change in PUP-867 by (again) calling the same 3x logic for looking up defaults. The implementation of PUP-867 also added tests, and one of those are now changed to reflect the changed behavior.
2014-08-08(PUP-2879) Add cryptdisks-udev to the services blacklistKylo Ginsberg1-1/+5
Also this patch splits out the long line in upstart_spec.rb to be one line per service, so more diff-friendly.
2014-08-08(PUP-744) Expand scope of OpenSSL rescue blockJosh Cooper1-3/+15
The persistent http connection work introduced a regression, preventing the agent from displaying useful error messages when SSL verification fails, e.g. the server's SSL certificate doesn't match the hostname the agent tried to connect to. The connection_spec test didn't catch the issue, because those tests execute with the non-caching pool, which always uses non-persistent connections. The root cause is because the Connection class assumed http connections are started by ruby in the `Net::HTTP#request` method, so the OpenSSL rescue block wrapped that call. However, in order to use persistent http connection, the caller needs to explicitly start the connection prior to calling Net::HTTP#request, which happens in the outer `Connection#with_connection` method. This commit expands the scope of the rescue block. This way we receive meaningful error messages if the connection is started explicitly for persistent connections, or on-demand for non-persistent connections. It also executes the ssl verification tests using persistent connections. Also note that `with_connection` is private, so the fact that `Pool#with_connection` or `Net::HTTP#request` can start the connection is not visible to users of the Connection class.
2014-08-08(maint) Refactor HTTPS verification tests into a shared examplesJosh Cooper1-43/+48
This commit refactors the spec tests that ensure puppet displays meaningful error messages when SSL verification fails, e.g. when the server certificate doesn't match the hostname we connected to.
2014-08-07(PUP-2946) Ensure #compare_stream uses binary stringsAdrien Thebo1-0/+21
In Ruby commit 2142287c `FileUtils.compare_stream` was optimized to produce fewer objects while comparing streams by predeclaring a pair of strings and reusing them for each iteration of the comparison. However, this change exposes some inconsistency in how ruby handles IO#read vs StringIO#read. When IO#read is passed a length and string, it will copy the read data into the string, but will convert the encoding from the expected ASCII-8BIT into the encoding of the string regardless of if the file was opened as a binary file. However, when StringIO#read is passed a length and string it will convert the passed string to the expected ASCII-8BIT. Because of this it's impossible to use `FileUtils.compare_stream` to compare a binary file and StringIO instance. To resolve this issue, this commit adds a custom compare_stream method which sets the encoding of the strings to always be ASCII-8BIT on Ruby 1.9+.
2014-08-07(PUP-1527) After upgrade from 3.3.2-1 to 3.4.2-1 naginator fails toRichard Clark1-0/+9
create config from exported resources taken from hiera Some changes introduced in hiera around 3.4 resulted in type coersion from strings to FixNums when creating exported resources that were partially built from hiera data. This patch ensures that any non-array parameter passed through the Nagios::Base.to_s is actually a string before trying to run the .sub method on it, and so fixes the above error with exported resources whilst also introducing support for fixnum params for any of the nagios type parameters
2014-08-07(maint) Test that external fact syncing depends on external featureJosh Cooper1-18/+22
Previously, the test was trying to verify that the downloader objects were created with the correct arguments, and testing that the downloader was evaluated twice (since the same downloader was used for both pluginsync and facts). However, the downloader_factory_spec now tests that downloader objects are created correctly, e.g. based on Puppet[:plugindest], so it is not necessary to repeat that here. This commit modifies the test to ensure the Downloader#evaluate methods are called for both downloader objects, and adds a test to ensure we skip downloading facts if the external facts feature is false.
2014-08-07(maint) Move methods for creating downloaders to factoryJosh Cooper4-24/+100
Previously, the plugin_handler module was responsible for creating downloaders and evaluating them. Since all of this happens within a single method it is hard to test that the downloaders are created with the correct set of properties. For example, we `ignore` source permissions when downloading plugins, but we `use` source permissions when downloading external facts, since those often contain scripts, which must be executable. This commit moves the logic for creating the downloaders to a factory and updates the tests accordingly. As part of this change, the PluginHandler module is changed to a class and is no longer mixed into the Configurer.
2014-08-06Merge pull request #2934 from peterhuene/pup/2971Kylo Ginsberg1-0/+1
(PUP-2971) Fix yum package provider missing install_options for list.
2014-08-06Merge pull request #2863 from joshcooper/ticket/master/PUP-744-http-poolingKylo Ginsberg9-61/+618
(PUP-744) Support persistent HTTP connections
2014-08-06(PUP-3019) Make PMT check for string status codes when downloadingAlex Dreyer1-3/+2
Previously PMT was checking for integer status codes when downloading modules. This results in all module downloads failing. After this PMT will check for string status codes when downloading modules.
2014-08-05Merge branch 'revert/master/pup-2946-windows-specs'Adrien Thebo1-11/+0
We're getting spec failures on Windows running Ruby 2.0, we have to revert this and try again so the build doesn't stay red.
2014-08-05Revert "Merge branch 'pull-2938'"Adrien Thebo1-24/+0
This reverts commit 1a428b92c900e84d9faa5d0aaa1a32f3c0b1d42b, reversing changes made to cb26e23706b76e44544c14f4c921885f17dccbb3.
2014-08-05Revert "(maint) Use public API when testing binary file #save"Adrien Thebo1-5/+18
This reverts commit 133c0b8009a48eef77d68c0bd8d5f79c930dab50.
2014-08-05Merge pull request #2941 from adreyer/PUP-3009Anderson Mills3-10/+14
(PUP-3009) Add error handling to PMT module downloads
2014-08-05(PUP-744) Cleanup puppet/ssl require logicJosh Cooper1-1/+0
Previously, validator_spec.rb was requiring 'puppet/ssl/configuration', because puppet/ssl.rb did not require it. Commit 658e4fd34 fixed puppet/ssl.rb, so it is no longer necessary or desired for validator_spec.rb to require puppet/ssl/configuration. Also, the default and no_validators were not consistent in expressing their dependencies on openssl and puppet/ssl.
2014-08-05(maint) Use public API when testing binary file #saveAdrien Thebo1-18/+5
2014-08-05(maint) Use rspec :if to constrain describe blockAdrien Thebo1-19/+17
2014-08-05(PUP-3009) Add error handling to PMT module downloadsAlex Dreyer3-10/+14
Before this PMT would not check if the module download request succeeded before trying install the module. This causes informative errors from forge to be hidden by an error about the checksum of the download not matching. After this PMT will only move forward with module installation if a 200 is received from forge otherwise it will display the error returned by forge.
2014-08-05(PUP-2946) File2 with #compare_stream from 1.9.3Maksym Melnychok1-0/+26
FileUtils.compare_stream in Ruby 2 is broken when comparing binary file stream with StringIO stream of different encoding. This change reverts FileUtils.compare_stream to stdlib v1.9.3 implementation.
2014-08-04(PUP-2898) Specify terminal semicolon for resource bodiesJosh Partlow1-0/+9
There was a regression in the future parser in d25e462 which caused resources with multiple attributeless bodies constructed like this: file { '/foo':; '/bar':; } to fail because the future parser grammar was not allowing the terminal semicolon. The acceptance suite picked this up running with parser future. It slipped past specs because, even though we have a spec testing multiple attributeless resource bodies, it lacked a terminal semicolon. Henrik Lindberg figured out the minor egrammar fix here to correct the expression, and a test case is added to catch it in specs.
2014-08-04(PUP-2971) Fix yum package provider missing install_options for list.Peter Huene1-0/+1
When executing the list command to filter virtual packages (when allow_virtual is false or nil), the yum package provider was not passing down the install options to the list command. For users passing options like --enablerepo, this prevents the packages from being discovered and the list command fails. The fix is to properly pass down the install options when executing the list command.
2014-08-01Merge pull request #2851 from highb/fix/master/pup-2745_forge_dependency_fixAnderson Mills2-91/+230
PUP-2745 Forge malformed dependency fix
2014-08-01(PUP-2898) Fix errors on ruby 1.8.7Andrew Parker1-6/+4
Ruby 1.8.7 doesn't allow trailing commas in parameter lists. This problem was present in the resource_expressions_spec file and is removed by this commit. Ruby 1.8.7 doesn't have an empty? method for Symbol. This changes the evaluator_impl to compare against the EMPTY_STRING constant instead, which does work on 1.8 and 1.9.
2014-08-01(PUP-501) Check all of the features togetherAndrew Parker1-0/+3
This adds a combined example of most of the features being used together: title expressions, type expressions, splatted parameters, exported resource, and resource reference.