summaryrefslogtreecommitdiff
path: root/spec/unit/indirector/file_metadata
AgeCommit message (Collapse)AuthorFilesLines
2014-01-06(PUP-716) Fix up FileSystem API change, tests indirector, parser, nodeHenrik Lindberg1-2/+2
2013-11-08(#19447) Puppet::FileSystem::File.exist?Ethan J. Brown1-2/+2
- 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
2013-01-03(#18162) Honor fileserver SRV record for file metadata requestsErik Dalén1-0/+5
File content requests uses the x-puppet-fileserver SRV record, but file metadata requests used the x-puppet SRV record. Adds test for the functionality.
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune4-4/+4
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-12Merge branch '2.7.x' into 3.0rcPatrick Carlisle1-0/+11
* 2.7.x: (26 commits) Extract host validation in store report processor Use cross-platform absolute paths in file_serving tests (#15221) Create /etc/puppet/modules directory for puppet module tool (Maint:) Fix bad doc strings for two settings ("wether") Try again to avoid circular dependency in file indirections Remove useless tests for Envelope Clear deprecation warnings between tests Avoid circular requirement in FileMetadata indirection (Maint) Document common Windows issues Update CHANGELOG lib/puppet.rb conf/redhat/puppet.spec for 2.7.18 Maint: Note in docs that the file type's "replace" attribute defaults to true Reject directory traversal in store report processor Tighten permissions on classfile, resourcefile, lastrunfile, and lastrunreport. Use "inspect" when listing certificates Don't allow the creation of SSL objects with invalid certnames Validate CSR CN and provided certname before signing Add specs for selector terminuses of file_{content,metadata} Fix whitespace inside parentheses Use head method to determine if file is in file bucket Always use the local file_bucket on master ... Conflicts: CHANGELOG conf/redhat/puppet.spec lib/puppet.rb lib/puppet/application/master.rb lib/puppet/defaults.rb lib/puppet/file_serving/terminus_selector.rb lib/puppet/reports/store.rb lib/puppet/test/test_helper.rb spec/integration/file_serving/content_spec.rb spec/integration/file_serving/metadata_spec.rb spec/shared_behaviours/file_serving.rb spec/unit/file_serving/terminus_selector_spec.rb spec/unit/network/handler/ca_spec.rb test/ral/manager/attributes.rb
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune3-3/+3
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.
2012-06-26Add specs for selector terminuses of file_{content,metadata}Nick Lewis1-0/+11
2012-04-23Make positional arguments distinct in Request#initializePatrick Carlisle1-2/+2
Puppet::Indirector::Request#initialize had a weird implementation giving variable semantics to positional arguments. This makes it normal again.
2011-09-27Fix issues with Windows based file URIsJosh Cooper1-4/+6
Previously, specifying a Windows file URI of the form 'file:///C:/foo' as a file source failed to strip the leading slash when attempting to source the file. Also there was ambiguity after values were munged (a value of the form 'C:/foo' could either be a Windows file path or a URI whose scheme is 'C'). This commit changes the file source to be more deliberate in how it validates source properties, including only allowing absolute paths and 'puppet' and 'file' URIs, which are both absolute and hierarchical. Also it uses the Puppet::Util.path_to_uri method to handle file path to URI translation issues. Previously, if a request was created using a Windows file URI of the form 'file:///C:/foo', then the set_uri_key method wasn't stripping the leading slash, and setting the request key to '/C:/foo'. This caused problems when attempting to collect metadata for Windows files. This commit changes the request class to use the Puppet::Util.uri_to_path method to handle URI path to file path translation issues. Previously, if a file URI was created programmatically using ruby's built-in URI class, such as occurs when specifying file source URIs, then calling URI#to_s omits the authority component, e.g. 'file:/foo' instead of 'file:///foo'. This commit changes the URI regex to not require two slashes, but note that the order of operations is important as Windows file paths will match the URI regex and can be successfully parsed: URI.parse('c:/foo').scheme == 'c'
2011-08-18maint: remove inaccurate copyright and license statements.Daniel Pittman2-8/+0
For a while Luke, and other authors, injected a created tag, copyright statement, and "All rights reserved" into every new file they added to the Puppet project. This isn't really true, and we have a global license covering the code, so we have now stripped out all those old tags. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman3-4/+3
We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
2011-04-08maint: just require 'spec_helper', thanks rspec2Daniel Pittman3-3/+3
rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2010-12-06maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson3-3/+3
Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe
2010-07-09Code smell: Two space indentationMarkus Roberts3-40/+40
Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
2010-06-28[#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts3-0/+0
Part 2 re-did the change on the spec files, which it shouldn't have.
2010-06-28[#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts3-0/+0
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
2010-06-23[#3994] rename the specs to have _spec.rb at the endMarkus Roberts3-0/+0
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
2009-02-19Adding pluginsyncing support to the IndirectorLuke Kanies1-42/+0
This switches away from the use of terminii for each type of fileserving - it goes back to the traditional fileserving method, and is much cleaner and simpler as a result. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-08-26Adding automatic attribute collection to the new fileserving code.Luke Kanies2-4/+4
Basically, this just includes a consistent method for collecting info (either content or metadata) and then calls that method when returning instances via the indirector. It's such a large commit mostly because of small changes in the normal code and large changes in the testing to accomodate those small changes. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-08-26Refactoring how files in FileServing are named.Luke Kanies1-2/+2
Previously, they retained some concept of the URI used to find them, and this uri was the primary key for the FileServing instances. This key was unfortunately completely useless, as evidenced by the fact that it was never used except to test that it worked. I've modified the FileServing instances (through modifying the Base class) to use their local path as their key, and they no longer care about the URI at all. This commit is mostly about fixing the code that interacts with the instances to use this new API. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-08-26Finishing the rename of FileBase => Base.Luke Kanies1-1/+1
Git did something really strange, in that it apparently didn't add the new base.rb files even though I used 'git mv'. Also fixing some other failing tests I hadn't previously tracked down because of the magical tuple of autotest's suckiness and my laziness. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-07-18Fixed all of the fileserving termini so they use indirection requests.Luke Kanies1-2/+4
This looks like a much larger commit than it is -- it doesn't change any behaviour at all, it just adds some integration tests (which expose the problem) and then switches from an ad-hoc api to a request-based api. Signed-off-by: Luke Kanies <luke@madstop.com>
2008-04-08Intermediate commit.Luke Kanies1-23/+27
This commit adds a Request instance into the indirection, pushing it all the way to the terminus instances. It's a big commit because it requires modifying every terminus class. There are still some thorny design issues. In particular, who should be responsible for making the request object? I've tried having both the indirection class and the Indirector module creating it, and both have their issues. Also, the Catalog class previously allowed passing Node instances directly to the find method, which is now no longer possible because the Request class would treat the node as the instance being found. We need the request class to have two modes, one when it's passed an instance and one when it's passed a key.
2007-10-24File serving should work now, both recursive andLuke Kanies2-42/+8
single files, across modules, local file system, and the traditional file server. This work revolves around making sure that the termini produce functional file instances, meaning that they know how to find their content or metadata, which largely comes down to setting their paths correctly. I also created a new terminus base class for the local filesystem, since there was so much common code between content and metadata.
2007-10-22Renaming the :local termini for metadata and contentLuke Kanies1-7/+7
to :file.
2007-10-22Link handling is now in the file serving classes.Luke Kanies1-5/+14
This was done by putting all of the functionality in the Content and Metadata class (actually, in a new base class for them). There are still some issues, and there need to be integration tests between the :local (soon to be renamed :file) termini for these classes.
2007-10-22Adding searchability to the fileserving termini, using theLuke Kanies1-4/+34
new Fileset class. The tests aren't the cleanest, in that there is still a good bit of duplication in them, but it's what we got.
2007-10-20Renaming the 'mounts' terminus to 'file_server', and renamingLuke Kanies1-4/+4
tests accordingly.
2007-10-19File serving now works. I've tested a couple of ways toLuke Kanies2-38/+42
use it, and added integration tests at the most important hook points. This provides the final class structure for all of these classes, but a lot of the class names are pretty bad, so I'm planning on going through all of them (especially the file_server stuff) and renaming. The functionality is all here for finding files, though (finally). Once the classes are renamed, I'll be adding searching ability (which will enable the recursive file copies) and then adding the link management and enabling ignoring files.
2007-10-18I've now split the file-serving termini into two separate types (inLuke Kanies2-0/+83
addition to Rest): A local terminus that just uses direct file paths, and a mounts terminus that uses the file server to figure out what the path should be. It looks like it also makes sense to split the 'mounts' terminus further, so there is a 'modules' terminus used to look files up in the terminus. I've added some integration tests to verify that everything is hooked together correctly. Lastly, I added a directory for shared behaviours. There's a ton of duplication in this setup, because the Content and Metadata classes behave almost but not quite identically across the board.
2007-10-18Fixing all of the classes that I just renamed, and addingLuke Kanies1-3/+3
the TerminusSelector module to the File Metadata indirection.
2007-10-18Renaming the file serving indirection termini to matchLuke Kanies1-0/+0
the standards I set in the TerminusSelector.
2007-10-18Renaming the file_serving/{content,metadata} indirectionsLuke Kanies2-0/+23
so that they make more sense in the REST API, and creating stub tests for the indirection termini. Now it's on to create the rest of the tests for them.