Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Original code implemented by Jared Jennings <jared.jennings.ctr@us.af.mil>
|
|
This duplication actually bit me when writing the test for PUP-1885.
|
|
Commit 6353ebbbc0d3804e30e9961559b01c9a69a74a93 introduced non-yaml
encoding for arrays of HTTP parameters. Unfortunately this also exposed
those values to the type conversion that is done to parameters in the
HTTP layer, which caused an ignore for a file matching "0" to be turned
into the number 0. The file serving code didn't handle getting
non-string ignore patterns and would then raise an error.
This changes the file server to stringify all of the parameters that it
recieves for ignores, which solves both the number problem as well as a
related one for booleans.
An alternative solution to this would have been to change the HTTP
handler so that it didn't try to convert arrays of values. I didn't go
for that because it would have caused the parameter handling to be
inconsistent.
|
|
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.
|
|
- When the source of a file resource is referred to through a symlink
it's possible the volume for the real file does not support ACLs.
Unfortunately it's not possible to simply readlink the path to
determine the real path / volume, so the best thing to do is
attempt to read the DACL of the file, catch the exception when it's
invalid and fallback to default owner / group / mode on Windows.
- Furthermore, under VirtualBox, the standard ERROR_INVALID_DACL is
not the error that propagates, but rather ERROR_INVALID_FUNCTION, so
there is special handling for that scenario.
- Note that this particular issue also affects paths like the Puppet
module path puppet:///modules that may be symlinked in environments
like Vagrant.
|
|
This adds a new matcher to the JSONMatchers to validate json against a
given json-schema. All of the json schema validation now goes through
this one matcher, which also handles skipping the checks on windows.
|
|
During changes a few calls had been inadvertently changed from stubs
(any number of calls allowed, including 0) to mocks (at least one call
required). In the case of the file_set this caused a problem for when
there was no expectaiton of the methods being called. In the daemontools
case, this exposed a mistake that was originally in the tests where the
stub was not even needed.
|
|
|
|
writable? is spelled just like that
A BucketFile is not a Pathname
Removed reference to FileSystem::File
|
|
|
|
|
|
|
|
One test is still failing.
|
|
|
|
This also fixes the spec_helper which had a reference to
FileSystem::File
|
|
This changes the API in a new implementation in a file called file_.rb
The intent is that it should replace the implemntation in File,
or perhaps directly in a Puppet::FileSystem class.
|
|
Not all systems run as UTF-8 (our solaris tests run as US-ASCII). In
those cases \xc2\xa0 (NO-BREAK SPACE) is not a valid character. This
causes the test to fail because of encoding problems. By using \x01 (a
control character) we can check the same scenario, but using a character
sequence that is valid in all of our setups.
|
|
The previous tests didn't check that the correct line number was being
reported. This updates the checks so that we can verify the line number.
|
|
This patch fixes wrong parser behavior in case when fileserver.conf
contains some broken lines. It helps to debug configuration problems
and makes puppet's user life a little bit easier.
Also added 2 unit tests for validating these buggy cases.
|
|
Confine the tests to when the provider supports symlinks.
Note how the shared examples are invoked if the windows host supports
symlinks. Putting the check inside the "metadata collector symlinks"
shared example causes the "on Windows" outer example groups before each
block to be executed on non-windows platforms.
|
|
- Replace calls to the specific :file provider with the global
Puppet.features call
|
|
- Windows symlink support has been added to exist?, symlink, symlink?,
readlink, stat, and lstat. This overrides any usage of Ruby File or
FileTest classes which are completely borked on Windows.
- :manages_symlinks feature of the file provider is enabled with a
check against Puppet.features.manages_symlinks? which checks for the
existence of the CreateSymbolicLink call in kernel32.dll
- FFI wrappers for Win32 API calls CreateSymbolicLink, CreateFile,
GetFileAttributes, DeviceIoControl and CloseHandle added to
windows/file
NOTE: The DeviceIoControl method of resolving symlinks was used
instead of GetFinalPathNameByHandle, which is known to misbehave
with UNC paths
- Any tests against :manages_symlinks feature are automatically turned
on for Windows, increasing test count by approximately 42 new tests
- Removed a few symlink tests that were confined to any OS other than
Windows since they must now be adjusted to run on Windows versions
that we know support symlinks
- Updated symlink documentation based on ileUtils.symlink behavior
|
|
- All previous File and FileTest calls to exist? or exists? go through
the new FileSystem::File abstraction so that the implementation can
later be swapped for a Windows specific one to support symlinks
|
|
- All calls to File class stat / lstat go through the new
FileSystem::File abstraction so that the implementation can later
be swapped for a Windows specific one to support symlinks
|
|
- All calls to File readlink go through the new
FileSystem::File abstraction so that the implementation can later
be swapped for a Windows specific one to support symlinks
|
|
- All calls to File / FileTest class methods symlink and symlink? go
through instance methods on the new FileSystem::File abstraction so
that the implementation can later be swapped for a Windows specific
one to support symlinks
|
|
- The ensure => :link feature of the file type is now restricted by
the :manages_symlinks feature
- Only the existing POSIX provider allows symlink support
- Updated relevant tests to check a provider for
.feature?(:manages_symlinks) over Puppet.features.microsoft_windows?
- metadata_spec.rb was refactored as RSpec nested tests can override
their ability to run with true :if conditions. Shared examples
intended to be run on Windows only were also being executed under
OSX because provider feature :manages_symlinks check was true,
despite the enclosing test scope being restricted to Windows
- file_spec.rb unit tests had 5 new manages_symlinks guards enabled on
tests, preventing 10 existing tests from running on Windows that
likely should never have been run in that environment (these tests
will be re-enabled with Windows symlink support)
|
|
(#9546) Add external fact pluginsync
|
|
Now that we have Puppet::FileSystem::File we can start using it in more
places and start getting rid of some of the monkey patches that puppet
has been doing.
|
|
|
|
This renames validate_as_json methods to be specific to the schema they are
validating (since that's embedded in each definition) and inlines the
implementations that didn't need to be abstracted.
|
|
This patch documents the file_metadata endpoint (a find operation)
and the file_metadatas endpoint (a search operation). It includes a
json schema for the returned file_metadata object, and spec tests
for validating some variants of file metadata against that schema.
|
|
Before this change, UNC paths as the source for files under Windows were
not supported and caused errors. This limited the usefulness of the
file type under Windows. This patch adjusts the logic used to handle
UNC paths so they can be successfully used.
|
|
Running specs with rspec 2.13 caused a lot of warnings. Many of them actually
exposed preexisting bugs, the most common being a syntax error when expecting
an Exception. These are worth fixing even if we don't bump to rspec 2.13.
|
|
Conflicts:
spec/unit/file_serving/metadata_spec.rb
|
|
Puppet no longer allows the base YAML library to deserialize arbitrary
objects. By using the safe_yaml package, we deserialize only primitive data
structures. The remainder of the deserialization process is now unified
between YAML and PSON. This code will explicitly create only the expected
objects from the primitive data types.
As a side effect of this change the code for REST indirections now allows
specialized deserialization routines per method. The save method now returns
nil by default, and is only overridden in a couple of cases where Puppet was
using the return value to preserve previous behavior.
|
|
* stable:
Revert "Merge branch 'nicklewis-rcS-is-a-jerk' into stable"
(#20308) Try again to fix fileset tests on Windows
(#20308) Fix fileset spec for Windows
|
|
|
|
|
|
* pcarlisle/ticket/20308-file-serving-recursion:
(#20308) Clean up the fileset specs
(#20308) Refactor fileset recursion for clarity
(#20308) Fix dropping paths from fileset results
(#20308) Make more of Fileset private
(#20308) Add failing test for incomplete file list
|
|
Paired-with: Andrew Parker <andy@puppetlabs.com>
|
|
The previous expression of the algorithm for traversing the file structure and
producing the available files was hard to understand and therefore error prone
(see the bug that is being fixed here). This refactors it to be better
separated and should be easier to see any problems in it.
Another part of the cleanup was to make checks against the filesystem more
explicit: either the path is valid or not, whether the path is a directory.
Paired-with: Andrew Parker <andy@puppetlabs.com>
|
|
Several of the public methods on fileset only seemed to be there for
testing. There is no need for this as the behavior of the file listing
already checks the conditions controlled by those internal methods.
Paired-with: Andrew Parker <andy@puppetlabs.com>
|
|
Under certain circumstances the fileset will drop subdirectories from its
results. This adds a test showing this failure.
Paired-with: Andrew Parker <andy@puppetlabs.com>
|
|
LoadedFile is now WatchedFile (since it has nothing to do with loading
files, only with telling when they change), and some of its internal
variables have been renamed for clarity. Also added a FileWatcher class
whose entire purpose is to track a set of LoadedFiles in aggregate. This
is now used by TypeCollection in place of its own hash.
Puppet::FileServing::Configuration::Parser and
Puppet::Util::NetworkDevice::Config were inheriting LoadedFile, simply
for its changed? method, even though neither of them really has file
properties. Now they wrap a WatchedFile instance instead.
|
|
|
|
Without this patch Ruby 1.9 is still complaining loudly about trying to
parse the spec files. The previous attempt to clean up this problem in
edc3ddf works for Ruby 1.8 but not 1.9.
I'd prefer to remove the shebang lines entirely, but doing so will cause
encoding errors in Ruby 1.9. This patch strives for a happy middle
ground of convincing Ruby it is actually working with Ruby while not
confusing it to think it should exec() to rspec.
This patch is the result of the following command run against the source
tree:
find spec -type f -print0 | \
xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
|
|
It was possible to refer to a file in a module without including the
'/module/' path component. This has been deprecated for at least one major
release.
Paired-with: Jeff McCune <jeff@puppetlabs.com>
|
|
Many tests set stubs or expectations on configuration values. This is
unnecessary, as settings are reset before each test. Because creating a stub
stubs out the entire value method on settings, stubbing any individual setting
interferes with retrieving any other setting. This makes for weird errors and
fragile tests. This commit changes most cases to just set each setting
directly.
Expectations on settings were often used to verify that a setting is used.
This is not a good way of testing this, since it checks that the value is
accessed but not that it is actually used correctly. Most expecations on
settings are better expressed by changing the setting and then verifying a
returned value.
|