(#7285) Add spec for Augeas initialisation and file loading

Simple initialisaton tests with combinations of lens include paths, explicit
file/lens loading against a few example files.
(#13379) Add path of pluginsync'd lenses to Augeas load_path automatically

The path $libdir/augeas/lenses is added to the Augeas load_path initialisation
option automatically to support lenses being pluginsynced.  Lenses should be
added into the <module>/lib/augeas/lenses directory inside a module.

The load_path parameter has been expanded to support an array of paths as well
as a colon-separated list.
(#9160) Change logging facility to debug for not supported provider features
(#13009) Compare scheduled task commands using backslashes

Previously, if the command for a scheduled task was specified using
forward slashes, puppet would always think the resource was out-of-sync.
This issue is that Windows does not preserve forward slashes, so the
*current* value always contains backslashes.

This commit munges forward slashes in the command to backslashes. It also
uses `File.expand_path`, because otherwise commands like the following in
the puppet language would be considered different:

    command => 'c:\\windows\\system32\\cmd.exe'
    command => 'c:\windows\system32\cmd.exe'
 (#13008) Allow scheduled task arguments to be specified

Previously, the `arguments` property of a `scheduled_task` resource
could not be specified as it would lead to a TypeError when we passed
the `should` array value to the task scheduler method that expected a
string.

Previously, scheduled tasks arguments could be specified as either a
string or an array. But if an array was specified it could only contain
a single element.

This commit requires that the arguments be specified as a
space-delimited string, e.g.  'arg1 arg2'.  It is not a breaking change,
because the ability to specify arguments never worked.
(#14749) Clear reference to invalid task after saving

Previously, running `puppet resource scheduled_task <name> ...` to
create a scheduled task would raise an exception. This would occur
because the provider's flush method calls `task.save`, which releases
the reference to the COM interface and sets it to nil. Then later the
`resource` application attempts to retrieve the state of the resource it
just flushed. This causes the win32-taskscheduler gem to raise an
exception because the underlying interface is nil.

This is not an issue when applying a manifest, because puppet doesn't
retrieve the state of the resource after it's been flushed. However,
when writing acceptance tests for the scheduled_task type using `puppet
resource scheduled_task` this bug occurred.

The `Win32::TaskScheduler#save` method should have probably been called
`close` since you can't perform additional operations on it, once it's
been closed. However, this is the gem, not puppet code, and the method
does say:

    Note that calling TaskScheduler#save also resets the
    TaskScheduler object so that there is no currently active task.

So whatever.

This commit simply changes the provider's flush method to clear the
`Win32::TaskScheduler` object after saving it, so that subsequent calls
to the `task` getter method will create a new `Win32::TaskScheduler`
instance.

This commit also adds acceptance tests that exercise things that were
previously broken in #13749, #13008, and #13009. The tests rely on the
ability to create scheduled_tasks using the `puppet resource
scheduled_task` style invocation, which this commit fixes.

The acceptance tests are more verbose than one would like because the
options to the `schtasks.exe` are different for before Vista, and
Vista and later.
(#14964) Don't fail if we can't unlink the Tempfile on Windows

Previously, if the exec resource created a process, e.g. start.exe, that
executed another process asynchronously, then the grandchild would inherit
the tempfile handle, preventing puppet from being able to unlink it. This
is not an issue on POSIX systems.

This commit changes the `wait_for_output` method to ignore Errno::EACCES
exceptions caused when closing and unlinking the stdout tempfile. The
behavior on POSIX systems is unchanged.
Merge pull request #596 from domcleal/tickets/2.7.x/13379-aug-pluginsync

(#13379) Add path of pluginsync'd lenses to Augeas load_path automatically
(#13489) Synchronously start and stop services

Previously, we were using the `win32-service` gem to start and stop
services.  It uses Win32 APIs to programmatically send start and stop
requests.  The actual service starts/stops asynchronously with respect
to the request.  As a result, when refreshing a service, puppet would
issue a stop request, immediately followed by a start request, and that
would race as the service would often still be running when the start
request occurred, leading to 'An instance of the service is already
running'.

This commit changes the windows service provider to use `net.exe` to
start and stop services.  This command will block until the service
start/stops, and returns 0 on success, making it easy to adapt to the
provider command pattern.  The one downside is that the exit codes don't
have the same resolution that we can get via the `sc.exe` or by calling
the Service Control Manager programmatically.  But that is not too
critical because we do capture the output of the `net.exe` command, e.g.
'The service name is invalid.' and include it in the exception message.
(#13489) Use let to memoize instance variables

Converted instance variables, e.g. @resource, to let helper methods to
reduce verbosity.
(#15027, #15028, #15029) Fix upstart version parsing

A leading space in the --version argument would confuse upstart, and the
version returned would not always be a semantic version, which caused the
upstart provider to fail. This commit updates the initctl call to remove the
leading space from the --version argument, and also replaces the implicit
SemVer comparisons with wrapper functions that call out to
Puppet::Util::Package.versioncmp to do version comparisons. It also fixes a
subtly broken regex to grab the full version string.
Add exclude list to upstart provider

The wait-for-state service seems to be a helper that is used by upstart, but
doesn't have a useful status or consistent way to call. Trying to use that
upstart service generally results in an error. This commit adds an exclude list
similar to the redhat provider so that services like 'wait-for-state' can be
excluded from the service instances.
Handle network-interface-security in upstart

Similar to network-interface, network-interface-security is an upstart job that
requires special handling to get status information. While network-interface
takes and interface argument, network-interface-security takes a job argument.
This commit adds that special case, and also updates the search method with a
corresponding special case so the jobs can be recognized as upstart jobs.
Add basic service resource test to upstart acceptance

Because `puppet resource service $servicename` doesn't fail when `puppet
resource service` does, this commit adds an acceptance test to make a `puppet
resource service` call and search for a running ssh service (which should be
true, if the acceptance test is running).
Add spec test for network-interface-security

This adds a simple test case for the special case of network-interface-security
to the upstart spec.
Upstart code cleanup, init provider improvement

This commit adds an is_init? function to the init provider, to prevent the init
provider from handling upstart jobs redundantly (which happens with services
such as network-interface and network-interface-security). It also adds tests
for the exlusion of instances in the upstart provider and exclusion of upstart
services from the init instances. It also cleans up some upstart provider code
(self.instances, self.search), eliminating redundant code and refactoring some
methods (upstart_status, status, normal_status).
This also removes the custom status command from upstart, which almost
certainly wasn't doing what it was expected. The upstart status command is
effective at gauging the status of upstart services.
Add comment to upstart provider explaining exclusion of 'wait-for-state'
Merge pull request #862 from haus/ticket/2.7/15027_15028_15029_upstart_version_not_semver

Ticket/2.7/15027 15028 15029 upstart version not semver
(maint) Add symlink stub to gentoo service provider spec

The gentoo service provider spec test stubbing didn't stub symlinks. A recent
change in the init provider started discarding symlinks from upstart jobs and
because this element wasn't stubbed, the test went to the (ubuntu) filesystem
and found a symlink to an upstart job, which was not the intent of the test.
This commit adds a blanket stub that there are no symlinks in the filesystem
for the specific test.
Merge pull request #865 from haus/maint/2.7.x/fix_gentoo_test_failure

Maint/2.7.x/fix gentoo test failure