summaryrefslogtreecommitdiff
path: root/spec/unit/provider/file/posix_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-01-06(PUP-716) Fix up tests after FileSystem API changeHenrik Lindberg1-2/+2
One fixed test still failing on expectations
2013-11-08(#19447) Puppet::FileSystem::File#stat / lstatEthan J. Brown1-2/+2
- 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
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune1-1/+1
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,'
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune1-1/+1
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2011-11-10(#10614) Detect when trying to managing ACLs on a non-ACL volumeJosh Cooper1-0/+6
Previously, when managing owner, group, and/or mode on a file whose volume does not support ACLs, Puppet would raise an error when trying to get/set the ACL. This commit allows a file provider to optionally perform validation of the resource. On Windows, the provider ensures that if owner, group, and/or mode are being managed, but the underlying volume does not support ACLs, then we fail early with an appropriate error message. This is a noop for the POSIX file provider as no validation is required. File.expand_path uses the current working directory to generate absolute paths. This was causing failures when running the specs from a mapped network drive, e.g. HGFS, since the volume does not support ACLs. This commit changes these tests to use make_absolute method instead, and changes that method to always use the local 'C:\' volume. Paired-with: Nick Lewis <nick@puppetlabs.com>
2011-10-03(#8411) Fix change group for POSIX file providerJosh Cooper1-6/+6
During the file type refactor, the POSIX file provider was accidentally changed to invoke the File.chgrp and File.lchgrp methods. These methods don't actually exist and this was causing acceptance test failures. This commit changes the POSIX file provider to invoke the File.chown and File.lchown methods when changing the group. Updated the spec tests, and also added integration tests, which simply change the owner and group to the current values. While not the best test, it will work in non-root contexts and will ensure this doesn't happen again.
2011-09-27Move group management into providersNick Lewis1-0/+93
Move provider-specific logic from the file group property to the posix file provider. For example, mapping group IDs to names and vice-versa is provider specific, but detecting if the property value is insync? is common across all file providers. Modify the windows file provider to allow getting and setting the group via its 'group' and 'group=' methods. Also, on Windows the file owner can be a group, and the file group can be a user, so the same method for mapping names and SIDs can be used for both owner and group. Added test cases where there weren't any.
2011-09-27Move owner management into providersNick Lewis1-0/+92
Previously, the logic for getting and setting the owner of a file, including validating owner names, detecting if the property is in sync, and detecting if we are running as root (and can manage file ownership) was spread across the owner property (type) and file providers. This commit changes the owner property (type) to only perform logic that is common across all file providers and to delegate to its provider for operations that are platform-specific. Examples of the former are detecting if the properties are in sync, detecting if we are running as root, and overriding the is_to_s and should_to_s methods (for displaying owners as strings). Examples of the latter are mapping owner names to user ids and back, and implementing the 'owner' and 'owner=' methods. This commit also changes the group property to always be insync? on Windows, as this functionality will be implemented in a later commit. It also re-enables file integration tests that previously had been failing on Windows due to the lack of file provider support.
2011-09-27Move mode management into the providersNick Lewis1-0/+41
Previously, the logic for getting and setting file mode was implemented in the type's retrieve and sync methods of the mode property itself. This commit adds a validate method to the type (previously validating was being done in munge), and adds 'mode' and 'mode=' methods to the POSIX and Windows file providers. The POSIX provider does what it did before, and the Windows provider contains the same broken mode-logic that it did before. Actually translating file permissions, e.g. 0755, to Windows will be done in a later commit. This commit also fixes tests on Windows where the file mode was being set by Puppet::Util::Windows::Security, but read back using File.stat, which doesn't round-trip. Now the test uses the security module for both setting and getting. Disabled symlink tests on Windows, which are not supported.