Age | Commit message (Collapse) | Author | Files | Lines |
|
This adds the two new properties environment_timeout, and config_version
to the returned settings properties.
The timeout is either an integer measured in seconds from min 0, or
the string 'unlimited'.
|
|
Now that there is a possibility of environments not existing (when
directory environments are enabled) the API needs to report a 404 Not
Found error when the client requests an environment that doesn't exist.
|
|
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
|
|
Modulepath was already being expanded; this ensures manifest is expanded
as well and fixes some specs so that they will work on Windows too.
|
|
In talking with consumers of the environment information it turns out
that listing the modules isn't the desired feature. Instead they really
want the settings of the environment (modulepath, manifest). Other
settings may be added later.
This has the added benefit that listing the environments is now a much
cheaper operations since it doesn't need to load the module data.
|
|
Instead of creating environments directly, we need to go through the
configured environment loaders, otherwise environments can't come from
other places.
|
|
The v2.0 api implementation had a type that was not caught by any tests.
This fixes that issue (a typo) and adds a test that would have shown the
problem.
|
|
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.
|
|
This plumbs in the first step and getting the list of environments
returned. At the moment it is hard coded to only ever return the
prodution environment.
|
|
This commit does several things, all in order to make authorizing API V2
requests a bit easier:
* Renames /v2 to /v2.0, which was chosen because it doesn't conflict
with a legal environment name in the V1 API.
* Adds route chaining so that a handler can deal with a request
prefixed with /v2.0 and then continue on to another route
* Changes how calls to authorization are handled so that full paths
are checked rather than indirection/key pairs.
* Introduces an authorization step in the /v2.0 request chain. This is
currently limited to only handle GET requests (seen as find in
auth.conf).
|
|
They aren't really part of the handler, and many more areas of HTTP
processing are referring to them.
|
|
Add a routing framework for the HTTP module that routes requests to
either the V1 or V2 API as appropriate (first it sees if the V2 API
would like to handle a request, and if not it's passed off to the V1
API).
To support the routing framework, several new classes in the HTTP module
are introduced: Request, Route, Response, and MemoryResponse (for
testing).
The V2 API is implemented in lib/puppet/network/http/api/v2.rb.
Change the method to handle the request from process to call, which
allows using lamdbas and procs as route handlers.
Change the require path in the HTTP module to break a cycle, which
necessitates changing requires in a few other files to just require the
entire Puppet::Network::HTTP module (rather than just the V1 API class).
Delete Puppet::Network::HTTP:RackHttpHandler because it was useless.
Change the initialize method of Puppet::Network::HTTP::WEBrickRest to
omit the unused handler argument.
|
|
The end goal is to have v1 and v2 API endpoints in their own processors,
with the routes registered on a shared handler that performs client
authentication and dispatch.
This commit rips out the v1 endpoints to their own processor, but does
not define anything about the handler including registration.
v1-related behavorial tests have been moved from the handler spec to the
v1 spec.
|
|
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,'
|
|
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.
|
|
This reflects pull request #691, but is being done by hand because the changes
in this code reveal the weak stubbing performed in other agent tests.
|
|
A variety of unexciting conflicts were manually resolved, and the delta
checked for sanity, since it was tiny.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
Puppet::Indirector::Request#initialize had a weird implementation giving
variable semantics to positional arguments. This makes it normal again.
|
|
This is a fix for Bugs #13553, #13418, #13511. The bucket_path parameter
allowed control over where the filebucket will try to read and write to.
The only place available to stop this parameter is in the resolution
from a URI to an indirectory terminus. The bucket_path is used
internally for local filebuckets and so cannot be removed completely
without a larger change to the design.
|
|
This is a fix for Bugs #13553, #13418, #13511. The bucket_path parameter
allowed control over where the filebucket will try to read and write to.
The only place available to stop this parameter is in the resolution
from a URI to an indirectory terminus. The bucket_path is used
internally for local filebuckets and so cannot be removed completely
without a larger change to the design.
Conflicts:
lib/puppet/network/http/api/v1.rb
spec/unit/network/http/api/v1_spec.rb
Conflicts resolved by modifying the patch to fit the use of
Puppet::Indirector::Request in the code.
|
|
This got broken when the status indirection was added around
d1f1858ea52d3089fd2088994e80d6f49d7e0347.
The problem is that the regex matching is greedy so any indirection
ending in e (and pluralized in 'es') will lose its trailing 'e'.
Since all this was done for the status indirection, my fix is to
treat differently this indirection only, instead of trying to fix
the general case (and breaking it).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
The environment returned by uri2indirection used to be a
Puppet::Node::Environment. When this changed to simply being the
string of the environment name, this broke assumptions made in other
areas of the code.
Paired-with: Nick Lewis <nick@puppetlabs.com>
|
|
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.
|
|
POST with a singular indirection is turned into a find in the indirector.
When making a large find request from a REST terminus, POST is used, and for
small requests, GET is used for backward compatibility.
Paired-With: Jesse Wolfe
|
|
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>
|
|
Running the specs under Ruby 1.9 didn't work using the lambda to recurse
down directories to find the spec_helper. Standardizing the way to find
spec_helper like the rest of specs seemed like the way to go.
Here's the command line perl I used to make the change:
perl -p -i -e "s/Dir.chdir.*lambda.*spec_helper.*$/require
File.expand_path(File.dirname(__FILE__) + '\/..\/..\/spec_helper')/"
`find spec -name "*_spec.rb"`
Then I fixed the number of dots for files that weren't two levels from
the spec dir and whose tests failed.
Reviewed-by: Nick Lewis <nick@puppetlabs.com>
|
|
This was a particularly nasty merge, so rather than hold up merges into
next any longer, I'm going to push this merge with a few outstanding
problems. The tests that were failing in the following areas have been
marked pending, and will be addressed separately, immediately following
this push.
TODO:
Verify that brice's rdoc change is still valid: tests to show that line
numbers from class, define and node get into the ast
Fix mount parsed_spec spec/unit/provider/mount/parsed_spec.rb
* 2.6.next: (85 commits)
(#5148) Fix failing spec due to timezone
(#5148) Add support for PSON to facts
(#6338) Remove inventory indirection, and move to facts indirection
(#6445) Fix inline docs: puppet agent does not accept --mkusers
Update CHANGELOG and version for 2.6.6rc1
(#6541) Fix content with checksum truncation bug
(#6418) Recursive files shouldn't be audited
(#6541) maint: whitespace cleanup on the file integration spec
(#6541) Fix content with checksum truncation bug
(#5466) Write specs for output of puppet resource
(#5466) Monkey patch Symbol so that you can sort them
(#5466) Fixed puppet resource bug with trailing ,
Update CHANGELOG for 2.6.5
(#4922) Don't truncate remotely-sourced files on 404
(#6338) Remove unused version control tags
Maint: Align tabs in a code block in the Augeas type.
(#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type
Maint: Rewrite comments about symlinks to reflect best practice.
(#6509) Inline docs: Fix broken lists in Launchd provider.
(#6509) Inline docs: Fix broken code blocks in zpool type
...
Manually Resolved Conflicts:
lib/puppet/application/inspect.rb
lib/puppet/defaults.rb
lib/puppet/file_bucket/dipper.rb
lib/puppet/network/http/handler.rb
lib/puppet/node/facts.rb
lib/puppet/parser/parser.rb
lib/puppet/parser/parser_support.rb
lib/puppet/util/command_line/puppet
lib/puppet/util/command_line/puppetd
lib/puppet/util/command_line/puppetmasterd
lib/puppet/util/monkey_patches.rb
lib/puppet/util/rdoc/parser.rb
spec/unit/application/agent_spec.rb
spec/unit/file_bucket/file_spec.rb
spec/unit/indirector/file_bucket_file/file_spec.rb
spec/unit/network/http/handler_spec.rb
spec/unit/parser/parser_spec.rb
spec/unit/provider/mount/parsed_spec.rb
|
|
Added test case to ensure indirection name is not changed from "facts"
when making an HTTP GET request.
Reviewed-by:Paul Berry <paul@puppetlabs.com>
|
|
Added support for adding "_search" to the end of any indirection to
'pluralize' it, and added tests to check this functionality and to test
hidden side effect of plurality method unpluralizing indirections.
Paired-With:Paul Berry <paul@puppetlabs.com>
|
|
This REST interface returns a list of nodes that match a fact query.
Fact queries can use (in)equality testing as a string comparison, and >,
<, >=, <= numerical comparisons. Multiple tests can be done as AND
comparisons, not OR.
The fact queries need to be prefixed by facts, and the comparisons other
than equality are specified with a .comparison_type after the fact name.
This will be better explained in the REST documentation on the website.
Searches that don't match anything now return empty array instead of a
404 error.
Conflicts:
spec/spec_helper.rb
|
|
* 2.6.x: (21 commits)
(#5900) Include ResourceStatus#failed in serialized reports
(#5882) Added error-handling for bucketing files in puppet inspect
(#5882) Added error-handling to puppet inspect when auditing
(#5171) Made "puppet inspect" upload audited files to a file bucket
Prep for #5171: Added a missing require to inspect application.
Locked Puppet license to GPLv2
(#5838) Support paths as part of file bucket requests.
(#5838) Improve the quality of file bucket specs.
(#5838) Make file bucket dipper efficient when saving a file that already exists
(#5838) Implemented the "head" method for FileBucketFile::File terminus.
(#5838) Reworked file dipper spec to perform less stubbing.
(#5838) Added support for HEAD requests to the indirector.
(#5838) Refactored error handling logic into find_in_cache.
(#5838) Refactored Puppet::Network::Rights#fail_on_deny
maint: Remove unused Rakefile in spec directory
(#5171) Made filebucket able to perform diffs
(#5710) Removed unnecessary calls to insync?
Prep for fixing #5710: Refactor stub provider in resource harness spec
Maint: test partial resource failure
maint: Inspect reports should have audited = true on events
...
Manually Resolved Conflicts:
lib/puppet/file_bucket/dipper.rb
lib/puppet/indirector.rb
lib/puppet/network/rest_authconfig.rb
spec/unit/file_bucket/dipper_spec.rb
spec/unit/file_bucket/file_spec.rb
spec/unit/indirector_spec.rb
|
|
Added the ability for the indirector to handle REST HEAD requests.
These are done using a new indirector method, head(), which should
return true if find() would return a result and false if find() would
return nil.
Access control for the head method is the union of that for the find
and save methods. That is, if either find or save is allowed, then
head is allowed. This is necessary so that users will not have to
change their authconfig to take advantage of the new feature.
Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
|
|
This is a maintenance refactor to reduce the dependencies between the
rest API and the implementation of the Indirector. The HTTP Handler code
was creating temporary Request objects that were not actually being
passed to the Indirector.
|
|
This REST interface returns a list of nodes that match a fact query.
Fact queries can use (in)equality testing as a string comparison, and >,
<, >=, <= numerical comparisons. Multiple tests can be done as AND
comparisons, not OR.
The fact queries need to be prefixed by facts, and the comparisons other
than equality are specified with a .comparison_type after the fact name.
This will be better explained in the REST documentation on the website.
Searches that don't match anything now return empty array instead of a
404 error.
|
|
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
|
|
Part 2 re-did the change on the spec files, which it shouldn't have.
|
|
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
|
|
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
|
|
This module is now used by the client and
server side, rather than having a Handler module
that's 90% server functionality but also used by
the client.
While we don't automatically get api choice from this,
it at least provides a pattern for how we'll handle API
development over time.
Signed-off-by: Luke Kanies <luke@madstop.com>
|