Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
hlindberg/pup-716_short-lived-objects-in-filesystem
(PUP-716) short lived objects in filesystem
|
|
|
|
Sometimes a request needs to perform authentication. We can support this
with basic auth readily enough.
This commit moves the basic auth support from the report processor and
makes it a capability of the network connection code. As part of this it
needed to move away from using the #get, #post, etc calls on the
connection object and instead construct the Net::HTTP request objects.
This might present a slight change in behavior, but not one that users
will normally notice. The most noticable change is that the #request
method can no longer be used for calling arbitrary methods on the
underlying connection, instead it can only be used to call to the
appropriate request method (get, head, delete, post, put)
In order to make this work more clearly, this also adds actual
parameters to the connection class's #get, #post, etc methods. The
defaults are taken from the Net::HTTP defaults, which is what would have
been used before.
|
|
Does the following:
* Add logic in Puppet::Reports::Http to properly handle HTTP basic auth using the form http://username:password@host/path
* Add a unit test to make sure HTTP basic auth is done if it is given in the url
|
|
- Previously tests were writing to the shared
%ALLUSERSPROFILE%\PuppetLabs\puppet directory, and would blow
up if this directory did not exist
- Because this directory was shared from one run to the next, failing
tests could be masked by data generated / used by a locally installed
Puppet
- The stubbing of FileSystem::File.exist? to return true was causing
some tests to treat files like c:\dev\null\foo to attempt to be
loaded, which would cause these tests to fail in isolation, but not
when run within the suite
- Had to change some doc specs under Ruby 1.9 / OSX to verify a value
instead of asserting a method was called, to prevent a stack overflow
- In some unit tests, the process of reading / writing settings caused
issues with test loading, so Puppet.settings.use has been stubbed
|
|
This provides the ability to create a verifier for SSL connections
opened with puppet's Puppet::Network::HTTP::Connection. The verifier is
provided the Net::HTTP connection and it just needs to configure it for
the correct verification mode.
The new functionality can be used when puppet's standard SSL
verification rules are not suited to the needs of the caller. The
impetus for this was a requirement that a connection be able to be made,
the certificates checked, but the subject and alt name checks skipped.
Rather than put that directly into puppet, this allows a new validator
to be written that performs those checks.
|
|
- All previous File.unlink calls go through the new FileSystem::File
abstraction so that the implementation can later be swapped for a
Windows specific one to support symlinks
|
|
- 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
|
|
This patch adds support for HTTP redirection in the Puppet HTTP
client.
The http client includes a redirection limit, and recreate the
redirected connection with the same certificates and store as the
original (as long as the redirect new location is ssl protected).
This patch allows redirection following for all HTTP methods, which
in the Puppet ecosystem shouldn't be an issue.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Use a loop - temp commit
|
|
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,'
|
|
There were some useful HTTP methods (http_get, http_post, ...,
http_request) in the Puppet::Indirector::REST class. Most noteworthy
is the http_request method, which provides some useful error
handling so that users get less confusing error messages when something
goes wrong with their certificates / SSL setup.
These methods would be useful in several other places (among them: the
HTTP reports processor and several places in the puppetdb termini), but
prior to this commit it was very difficult (or impossible) to use them
without doing a very confusing dance with unnecessary ruby mixins and
inheritance from classes in the Indirectory hierarchy.
This commit factors these methods out into the new
Puppet::Network::HTTP::Connection class, and tweaks
Puppet::Network::HttpPool to return instances of this new class.
It also refactors the HTTP report processor to use
Puppet::Network::HTTP::Connection.
|
|
A recent change (commit ce44885) to support https connections for report
processors accidentally enabled SSL for all http report processors. This patch
fixes protocol detection and adds tests to make sure both cases work.
|
|
* 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
|
|
Extract the validation step and refactor tests around this. Tests now don't
touch the filesystem which avoids a corner case on windows that caused test
failures.
|
|
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.
|
|
|
|
|
|
If puppet is configured to use tagmail as a report, it should not send
an email if no message match any tag in tagmail.conf
The former behaviour was that puppet opened an smtp connection, did not
send any mail and then closed the connection again leading to errors on
the smtp server. The added tests now prove that the send method is never
even called when no message match any positive tag.
|
|
* 2.7.x:
(#9167) Do not send email when nothing changes
[#13686] Fix directoryservices ShadowHashData code
Fixup tests to work on CentOS 5
fix bug in Util#symbolizehash!
(#13567) Fix create_resources name parameter bug
(#13636) Update Module Face copyright date
(#13737) Swap build_tree and format_tree method names
(#9167) Do not send email when nothing changes
Add Module Tool
Make core changes needed for the puppet module tool
(#13367) Patch SemVer to permit ranges including pre-release components.
Monkey patch FileUtils.mv in Ruby 1.8.5
(#1076) Show warning if an empty group is specified
Maint: Remove unused mock objects in user spec
Maint: Use real objects in user spec
Maint: Add a real provider class to user spec
Maint: Remove unused variable in user spec
Conflicts:
lib/puppet/util/monkey_patches.rb
spec/unit/type/resources_spec.rb
spec/unit/type/user_spec.rb
|
|
Without this patch the tagmail report sends an email even when there are
no changes or resources out of sync. This has the undesired effect of
sending emails after every Puppet run.
When there are no changes or out of sync resources, tagmail logs a
notice stating the fact and skips processing logs and sending emails.
This patch includes new spec tests for the changes in behavior.
|
|
* 2.7.x:
(#10722) Add spec to verify that an error is logged on bad http
(#10722) Refactor http_spec to use expectations
Updating CHANGELOG for 2.7.12rc2
(#7592) Remove redundant call to String#to_s
(#11988) Work around Augeas reload bug when changing save modes
(#11988) Don't overwrite symlinks in augeas provider
(#8312) Fix zypper provider so ensure => 'latest' now works
(#12844) Fix a unit test relating to lockfiles
(#12914) Allow puppet to be interrupted while waiting for child
(#12933) Better error message when agent is administratively disabled
(#7592) Remove redundant call to String#to_s
(#12844) Agent lockfiles: backwards compatibility with 2.7.10/2.7.11
(#10722) Display errors on HTTP report submission failures
Revert "Merge remote-tracking branch 'masterzen/tickets/2.7.x/3757' into 2.7.x"
Revert "(#12844) Backwards compatibility for 'puppet agent --enable'"
(#11988) Work around Augeas reload bug when changing save modes
(#11988) Don't overwrite symlinks in augeas provider
(#12881) Fix cron type default name error on windows
(#12844) Backwards compatibility for 'puppet agent --enable'
(#8312) Fix zypper provider so ensure => 'latest' now works
Conflicts:
lib/puppet/provider/augeas/augeas.rb
lib/puppet/reports/http.rb
lib/puppet/util/pidlock.rb
spec/unit/application/agent_spec.rb
spec/unit/provider/augeas/augeas_spec.rb
spec/unit/reports/http_spec.rb
|
|
|
|
|
|
|
|
|
|
|
|
When writing reports, there is a window in between opening and writing to the
report file when the report file exists as an empty file. This makes writing
report processors a little annoying as they have to deal with this case. This
writes the report into a temporary file then renames it to the report file.
Signed-off-by: Patrick Carlisle <patrick@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.
|
|
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>
|
|
* 2.6.x: (36 commits)
Updated CHANGELOG for 2.6.7rc1
(#5073) Download plugins even if you're filtering on tags
Fix #5610: Prevent unnecessary RAL lookups
Revert "Merge branch 'ticket/2.6.x/5605' of git://github.com/stschulte/puppet into 2.6.next"
(#6723) Fix withenv environment restoration bug
(#6689) Remove extraneous include of Puppet::Util in InventoryActiveRecord
Remove extra trailing whitespace from lib/puppet/resource.rb
(#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigs
(#6707) Fix typo in rest_authconfig.rb
(#6689) Make inventory_active_record terminus search quickly
(#5392) Give a better error when realizing a non-existant resource
(#2645) Adding a less-stubby test to verify the "system" attribute's behavior
Update CHANGELOG for 2.6.6
maint: Remove serialization of InventoryFact values
maint: Rename InventoryHost to InventoryNode
Fixed #2645 - Added support for creating system users
maint: Remove spec run noise
maint:Refactor of mount provider integration tests
(#6338) Support searching on metadata in InventoryActiveRecord terminus
(#6338) Implement search for InventoryActiveRecord facts terminus
...
This merge includes essentially reverting #4904's change to the mount
type since tests that came in from 2.6.x specified different
behavior and what's correct is not clear to me. I've reopened #4904 and
added it to our backlog, and talked to Nigel about the RFC that's
currently out on the puppet-users mailing list for a bigger refactor of
how the mount provider works.
Manually Resolved Conflicts:
spec/spec_helper.rb
spec/unit/indirector/queue_spec.rb
|
|
|
|
This is replaced with the new my_fixture{,s} methods; old fixture data is
ported into the spec tests at the same time, but left where it was against
unit tests that require it.
Reviewed-By: Nick Lewis <nick@puppetlabs.com>
|
|
This report processor was unnecessarily using Puppet to create a
single directory. This was causing complex failures in any spec
dealing with reports.
Paired-With: Paul Berry
|
|
Current report formats are:
0: 0.25 reports and earlier
1: 0.26.1 - 0.26.4 reports
2: 0.26.5 and beyond
Paired-With: Jesse Wolfe
|
|
The code made assumptions about report structure that weren't valid for
2.6.x. The change has been verified to work with 0.25.x and 2.6.x
report formats.
Paired with: Rein Henrichs
|
|
changed the regex so that tagmail allows . in tagname.
|
|
The less stuff being done in the spec_helper the better for reasoning
about what's happening in the tests. puppettest.rb does a lot of things
that aren't necessary for the specs, so this patch gets those things out
of the spec_helper.
Reviewed by: Jesse Wolfe
|
|
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
|
|
* do not monkey patch Net::HTTP in a way that breaks other specs
* Use fakes to sense behavior of Net::HTTP
|
|
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
|
|
Example puppet.conf:
[puppetmasterd]
reports = store, http
reporturl = http://localhost:3000/reports
* Group reporturl and reportdir in new reports section of
Puppet::Settings
* Add specs for both
|
|
There are still a few unported tests, but it's at least
better now.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
|