| Age | Commit message (Collapse) | Author | Files | Lines |
|
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,'
|
|
When a catalog run is currently in progress, or the `puppet agent
--configprint agent_catalog_run_lockfile` is stale, the error message
looks like this:
Run of Puppet configuration client already in progress; skipping
This is a problem because if the system is deadlocked from a stale file,
it's not clear what file needs to be removed. This patch improves the
error message to be:
Run of Puppet configuration client already in progress; skipping \
(/var/lib/puppet/state/agent_catalog_run.lock exists)
A new method has been added to make it easy to print out the file being
referenced by the `running?` method.
|
|
Without this patch it is very confusing what the intended purpose of the
agent_pidfile setting is. This confusion may lead to people thinking
this file is intended to be used my monitoring systems or service
management frameworks to determine the PID of a running puppet agent
process. This thinking is incorrect, the `pidfile` setting is intended
for this purpose.
The `agent_pidfile` setting is intended to provide mutual exclusion of
configuration catalog runs. This patch reduces confusion by more
closely matching the name and description to the intent.
In addition, the prose in the descriptions and comments have been
augmented to make it clear "running agent" refers to an agent performing
a configuration catalog run and not simply the running agent process.
|
|
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.
|
|
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 commit does the following:
1. Refactors our main lockfile class to accept a data object
as an argument to the #lock method. This data can
then be retrieved at any time while the lock is held;
the implementation is to write the hash as JSON to
the lockfile. This will allow external tools to
read it without calling into puppet code.
2. Refactor pidlock to use the above--but only serializing
a String (the pid) to the file.
3. Refactor disabler to use the above, with a Hash containing
a key/value pair identifying the "disabled" message.
4. Fix and clean up spec tests.
|
|
This commit simply renames AnonymousFilelock to
JsonFilelock. The behavior hasn't changed at all
yet, so this is a bit of a suspect commit but
I wanted to make sure that the git history
was as clear as possible as to what happened
here.
|
|
The Puppet::Agent::Locker and Puppet::Agent::Disabler
had a weird dependency on the existence of some
lockfile methods in Agent, but Agent didn't use
those methods anywhere else. This commit moves
all of the lockfile related stuff into the modules
in an attempt to improve encapsulation and clarify
the API of the modules.
|
|
There are now two different lockfiles for agents; one
for indicating that an agent is administratively
disabled, and one that indicates that an agent run
is already in progress.
In previous revisions, the paths for these lockfiles
was being built from a single puppet setting via
naming convention. This commit does the following:
1. Creates two settings (:agent_running_lockfile and
:agent_disabled_lockfile) instead of the previously
existing one (:puppetdlock).
2. Removes the Configurer class from the chain of
command when the Agent class is determining the
lockfile path.
|
|
This commit re-introduces the lockfile behavior changes that
were originally merged in to 2.7.x via this pull request:
https://github.com/puppetlabs/puppet/pull/216
It was reverted because of mcollective compatibility issues.
For more info see:
http://projects.puppetlabs.com/issues/12844
It is now being reintroduced for Telly, but with some minor
modifications. See #3757, #12933 and #12934 for details on those.
|
|
* 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
|
|
This reverts commit 86a806f595f8b7bb280c8c445eef51dfd71bf39d, reversing
changes made to ac81771a9cc70b5fb58f86439ebb0585ce92d4e8.
See tickets #3757, #12844, #4836, #11057. These changes were deemed to
be breaking public APIs, and thus are being reverted from 2.7.x. They'll
be reintroduced in 3.x.
(The changes in question were relating to how puppet agent creates /
manages its lockfiles.)
Conflicts:
lib/puppet/util/pidlock.rb
spec/unit/agent_spec.rb
spec/unit/util/pidlock_spec.rb
|
|
This reverts commit fcac8f7163c99884fc6b75e3851c4a5e16a3ff07, which
was a backwards-compatibility workaround intended to handle some new
behavior related to puppet agent lockfiles that was introduced in
2.7.10. The fix is being reverted because we've decided to remove
the new lockfile behavior from the 2.7.x series entirely, and push
it out to 3.x.
|
|
In version 2.7.10 we changed the name of the lock file that is
used by 'puppet agent --enable/--disable'. A side effect is
that if the lockfile was created under an older version of
puppet, the "--enable" command in the newer versions won't
delete the old lockfile and thus you can't run your agents.
Make --enable attempt to detect and resolve this situation.
|
|
None of the configurer client was directly using the returned
report, but only its exit_status.
Since now the configurer might run in a child process, we can't return
the report, only a status code.
This commit changes the configurer and call site so that only the report
exit code is returned.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
This way it is possible to let other users know why a puppet agent
has been disabled.
Usage:
puppet agent --disable "because working on backup"
When later on, the puppet agent run would abort with:
"Run of Puppet configuration client is administratively
disabled because working on backup; skipping"
It's also possible to not set a message, in which case a default
message is provided.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
This change also contains a refactor split of Pidlock into its
anonymous counterpart.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.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>
|
|
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
|
|
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
|
|
Rename Puppet::Agent::Runner to Puppet::Run, for consistency
|
|
This will eventually be used by puppetrun, but
for now is just called by the old-school Runner handler.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
Once I went to add runinterval support to the Agent class,
I realized it's really two classes: One that handles starting,
stopping, running, et al (still called Agent), and one that
handles downloading the catalog, running it, etc. (now
called Configurer).
This commit includes some additional code, but 95% of it is just moving code around.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
Also cleaning up the lock usage by yielding to a block
when a lock is attained.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
I moved all of the extra Fact modifications into the Facts
class, and then moved the calls of those new methods
into the Facter terminus.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
This doesn't change functionality, it just simplifies
the agent class.
I've also started the work to get the catalog handling
done using REST/the Indirector.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
This reverts commit f57a5e88229578747dde2c90af3a696ad0172e72.
|
|
so I'm just applying it here so it continues to show
up in the history in case I ever want to look at it again.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
This will handling downloading facts and plugins.
Signed-off-by: Luke Kanies <luke@madstop.com>
|