Make SELinux internal helper functions private.

There are a handful of internal helper functions in the SELinux utility code,
dealing with finding the filesystem that a file resides on.  We may as well
make them private in the code.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
(#8714) Don't follow symlinks in SELinux FS detection

When detecting the filesystem that a target file lives on, we used to follow
symbolic links.  This is actually a problem - the SELinux change applies to
the link, not the target of the link.

This rewrites the code to handle this more cleanly, following the logical tree
up to locate the record in the set of mountpoints.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
AST Scope variable names must be strings.

The Parser AST scope had an embedded assumption that variable names were
always strings, but didn't actually enforce that.  A consequence of this is
that a couple of tests violated that agreement.

This adds an internal error report when someone tries the wrong thing, and
cleans up the handful of tests that failed.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Fix for windows paths in hiera-puppet specs
(#15735) Deprecate puppet kick, and agent --listen.

This deprecates the puppet kick command and the agent's --listen option.
Deprecation messages are issues using Puppet.warning.
Tests check that Puppet.warning is called and that message includes
"deprecated".
Clean up acceptance tests merged from hiera-puppet

This fixes a conflict caused by hiera.yaml being left behind by an acceptance
test that was merged in from hiera-puppet, and renames the test to fit into
the directory structure used by puppet.
(#15756) Call functions correctly in tests

These tests relied on being able to call functions in the incorrect
fashion of not passing an array as the argument. They now call the
function under test correctly.
(#15756) Do not allow functions called without Array

Proper calling of functions from templates, and anywhere else in ruby
code that calls puppet functions, requires that the function's arguments
are passed as an Array. Previously this was never enforce and some
functions would end up working when not called with an Array and other
functions would fail.

This adds a type check to ensure that functions must always be called
consistently.
(#15756) Test behavior of function loading not mocks

The tests used to test that functions were created by
asserting the mechanism by which this happened. This made them brittle
in the face of changing implementation. This changes the tests to make
assertions about the produced module and should be much more robust
against changing implementation and more expressive of the behavior of
defining functions.
Merge pull request #1103 from daniel-pittman/maint/3.x/ast-scope-only-uses-string-names

AST Scope variable names must be strings.
Merge pull request #1099 from daniel-pittman/bug/2.7.x/8714-better-symlink-handling-in-selinux-utils

Bug/2.7.x/8714 better symlink handling in selinux utils
Skip symbolic link demanding test on Windows

One of the SELinux tests I wrote creates a symbolic link, to ensure
correct behaviour.  Windows Ruby doesn't support symlinks, and so failed; this
test can simply be skipped on that platform.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge pull request #1105 from zaphod42/ticket/3.x/15756-disallow-incorrect-function-calls

(#15756) Do not allow functions called without Array
Update copyright years in LICENSE

This brings the copyright years up to date, reflecting the set of years we
actually worked on the software.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge remote-tracking branch 'origin/2.7.x' into 3.x

Conflicts:
	LICENSE

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge pull request #1129 from hlindberg/15735-puppet-kick

Deprecate puppet kick, and agent --listen. Issue 15735.
(#12630) Run puppet agent as a service

Originally we were planning on installing puppet agent as a scheduled
task, but there are issues with this, such as the task scheduler service
itself may be disabled, may be configured to run as different user that
doesn't have sufficient privileges, etc.

This commit adds a wrapper script to run puppet agent as a service using
the win32-daemon gem. The Service Control Manager invokes the daemon.bat
script, which runs `rubyw.exe daemon.rb`.

The daemon ruby process sits in a loop executing `puppet agent --onetime` every
`runinterval` seconds, the value of which is obtained from puppet itself, and
can be configured in puppet.conf.

Windows services cannot write to stdout/err. Instead they are supposed to
write to the event log. But since we don't support that yet, the daemon
logs to a file in var/log/windows.log. By default the daemon logs at the
`notice` level.

In order to pass arguments to the service, you can either use the Service
Control Manager GUI or do the following from the command line:

  sc start puppet --debug --test --server foo.com

If --debug is passed as an argument, then the daemon will log at the
`debug` level.

This commit also updates the msi to install the daemon as a service. The
service's name is 'puppet' and its display name is 'Puppet Agent'. During
an install, msiexec will automatically stop the (old) service, install the
new files, and start the new service. The service is installed as an
automatic service, meaning it will start when Windows starts. It is
difficult to make this configurable from the command line, but can easily
be done using Orca/InstEd MSI editors.

Conflicts:

	wix/puppet.wxs
(#13027) Guard against invalid runinterval values

Previously, if the daemon was unable to start puppet, e.g. because the
wrong version of puppet was bundled into the installer, then the
runinterval value was getting set to 0, which caused the daemon to get
into an infinite loop launching puppet/ruby processes.

This commit guards against this, so that if runinterval is 0, we
instead default it to 1800 seconds, and display an error message in
the log.
Moving windows service into the ext directory.
(#15756) Call include function correctly

The hiera puppet backend called the include function without passing the
argument as an array. This changes it to call the function correctly.