(#20787) Do not generate NetBIOS name service requests

Previously, we were constructing an ADSI connection uri using the local
computer name, e.g. 'WinNT://hostname/Administrator,user'. However, Windows
performs a NetBIOS name service request (NBNS), one request for each ADSI
connection, which is very slow when enumerating users and groups.

Simply using '.' to denote the local computer eliminates all NBNS
requests. This reduces the time to run `puppet resource user` from 198
seconds to 3.1 seconds for 39 users, and from 98 seconds to 2.8 seconds for
16 groups.

Note we still have to use the fully qualified uri when adding/removing
users from a group, though it does not result in NBNS requests.
(#20920) Include file and line number on invalid resource relationship

Change the error type to ResourceError to make it include the file name
and line number.
Merge pull request #1663 from joshcooper/ticket/stable/20787-adsi-performance

(#20787) Do not generate NetBIOS name service requests
(#20302) Windows ruby 1.8 workarounds are not necessary in 1.9

Previously, the sprintf spec failed, because ruby outputted the
exponent with a leading zero, despite a precision of 2. The zaml spec
failed, because ruby didn't recognize the Europe/London timezone.

Ruby 1.9 fixes these issues, so the workaround in sprintf_spec is no
longer necessary, and the zaml_spec issue is no longer pending.
(#20302) Append .exe to spec "executables" on Windows

When running the tests on Windows and Ruby 1.8.7, File.executable?
returns true on regardless of the file extension. On Ruby 1.9, it only
returns true if the extension is .exe or similar.

This commit ensures the "executable" ends with .exe.
(#20302) Handle nested include filters

Nested rspec include filters don't work the way I expect. Given:

  describe "A", :if => rdoc1? do
    before :all do
      require 'rdoc/tokenstream'
    end

    describe "B", :if => windows? do
    end
  end

If rdoc1? is false, but windows? is true, the before :all/:each blocks
will still be executed, and the tests in B will be executed.

As a result, the spec tests fail on Windows and ruby 1.9, because our rdoc
parser is not compatible with newer versions of rdoc. For example,
rdoc/tokenstream.rb was moved to token_stream.rb, etc.

This commit adds the rdoc1? predicate to the example group B, so that
it is not executed when rdoc1? is false.
(#20302) File.expand_file('~') fails differently in Ruby19

In ruby 1.8, calling File.expand_path('~') when HOME is undefined
would raise ArgumentError on both Unix and Windows.

The same test in ruby 1.9 does not raise on Windows, because ruby
also looks at HOMEDRIVE and USERPROFILE. Only if all three are
undefined does ruby raise ArgumentError as expected.

This commit ensures all 3 environment variables are undefined in util_spec. It
also only tests the platform specific RunMode functionality on the appropriate
platforms, and adds tests that were missing on the Windows side.
(maint) Minor cleanup to mailalias

A recent commit removed a workaround for a ruby 1.8.1 GC bug, but missed the
extra variable assignment in this file.
(Maint) Simplify search for init scripts
Merge pull request #1672 from dalen/simplify_search

(Maint) Simplify search for init scripts
Set HOME environment for eix/portage provider

Lack of this variable causes "No $HOME found in environment." message in
stderr of eix command, which is misleading in a situation when a package
is not found or some other error occurred.
Merge pull request #1673 from vzctl/fix-eix-error

Set HOME environment for eix/portage provider
Docs: Improve documentation of "duration" settings

A user pointed out that "as a duration" was not a helpful way to describe the
formats used by duration settings; although the formats are explained at the top
of the config reference, scrolling shouldn't be necessary, and most readers
wouldn't think to check the top of the file.

This commit puts a small list of the formats in each duration setting, as well
as marking the activerecord storeconfigs settings as deprecated.
Revert "Merge branch 'cprice-puppet-bug/3.0rc/15187-log-fatal-errors-to-console'"

This reverts commit 8d99bcbe6ebe6ca15868334bb52349911b58598c, reversing
changes made to 7d6515f076715c1feab0addc99312c42fb8b578c.

This change had two unintended side effects:

1) 20900 tagmail from 'puppet agent --onetime' run as a cron job begins
sending additional emails of verbose logs.

2) 20919 cron job of 'puppet agent --onetime --no-daemonize' produces
additional verbose logs to both console and syslog.

Issue #1 occured because the 15187 patch caused agent log level to
switch to info by default.

Issue #2 was due to the above log level issue, and the fact that by
default a console logger was also opened for all agents, which does not
get closed if --no-daemonize is specified.

Reverting fixes both of these unintended logging issues by returning to
the logging behavior seen in 3.1.1.
Docs: Fix a persistent formatting glitch in the file type's ensure parameter docs
Maint: Don't execute facter during spec tests

Previously, the test was trying to test that the 'facts' application
could be invoked and return exit code 0 with meaningful output. However,
it causes the 'facter' terminus to be invoked, which actually runs
facter.

Since we don't care what facts are returned, this commit adds an
expection to make sure the indirection#save method is called and returns
successfully.

This was discovered on win2003 due to local facts being present, which
when evaluated, wrote errors into the log.
Merge branch 'ticket/stable/20900-revert-agent-console-logging' into stable

* ticket/stable/20900-revert-agent-console-logging:
  Revert "Merge branch 'cprice-puppet-bug/3.0rc/15187-log-fatal-errors-to-console'"
Merge branch 'stable'

* stable:
  Revert "Merge branch 'cprice-puppet-bug/3.0rc/15187-log-fatal-errors-to-console'"
  (#20787) Do not generate NetBIOS name service requests
Maint: Fix typo in deprecation warning

The deprecation warning said to use a method that doesn't exist.
Merge pull request #1674 from nfagerlund/maint/duration_settings

Docs: Improve documentation of "duration" settings