(#15644) add test case to check for packages that are yet to be installed.

Added the check for latest value in the test case,
Added a new test case that checks for correct behavior in case the
package is not installed.
(#8200) validate only if we can (especially path)

The global validate block is called even when `puppet resource zone` is
called without any further arguments, so we add a check
provider.get(:ensure) != :absent to make sure that we are indeed in
zone creation stage before trying to validate. This could have been
better done by `isrequired` method in parameter.rb however this is not
hooked up now, so we are uanble to use it..

The ip validation is refactored to make it clearer to read.
(Maint) Removed unnecessary stubbing

Previously, the spec test stubbed the zone resource. This commit creates
a real resource specifying the provider to use. It also adds the type of
exception and message that we're expecting to be raised.

Paired-with: Rahul Gopinath <rahul@puppetlabs.com>
Merge branch 'ticket/3.x/8200_validate_param' into 3.x

* ticket/3.x/8200_validate_param:
  (Maint) Removed unnecessary stubbing
  (#8200) validate only if we can (especially path)
(#7175) ensure ensurable uses symbols in zone

zone provider when asked to ensure the state to running/install or any
thing tries to find the value in state_index however, state_index values
stores keys as string. This is wrong. The root cause is that
ensurable returns values as string rather than symbols. This inturn is
caused by state_name checking for string value in state_alias which is a
symbol to symbol map, and not finding any, and returning itself.
(#15644) refactor the parse_line so that it supports the newer format

Previously the parse_line conflated the different output formats of the
older and newer `pkg list` commands. This commit splits the formats to
separate regexes so that it is easier to manage. Especially if the pkg
list format changes yet again.

This commit simplifies self.instances, latest and query methods by
removing redundant lines.

Adds more comments to the methods, and changes the method names to reflect the
method usage.

Tests:
- Update the package list output so that the format is correct
(it is ufoxi - 5 dashes)

- Earlier, when a pkg list line could not be parsed, the provider warned
the user about this fact and continued. This behavior is dangerous. We
change it to fail instead.

- Added more test cases.
(#15644) ensure that pkg installation is non-interactive

Earlier, pkg install did not have --accept parameter, which means that
licenses would not be automatically accepted. Since puppet is a
non-interactive process, this is not the correct behavior. This commit
adds the --accept parameter to accept licenses during pkg installation.

Earlier, pkg uninstall added -r always to the command for recursive
uninstall. However, this was removed in the later version of the pkg
command. This commit adds the logic to check for the version before
doing `pkg uninstall -r mypkg`
Merge branch 'ticket/3.x/7175-symbolize' into 3.x

* ticket/3.x/7175-symbolize:
  (#7175) ensure ensurable uses symbols in zone
  (Maint) Removed unnecessary stubbing
  (#8200) validate only if we can (especially path)
Merge branch 'ticket/3.x/15644_fix_parse_line' into 3.x

* ticket/3.x/15644_fix_parse_line:
  (#15644) ensure that pkg installation is non-interactive
  (#15644) refactor the parse_line so that it supports the newer format
  (#15644) add test case to check for packages that are yet to be installed.
Convert expect..should to expect..to in configurer spec
Use TestHelper in old unit tests

This adds calls so that the old unit tests use the pre and post steps from
Puppet::Test::TestHelper to clean up between tests.
Always set log functions on root environment

Set the logging parser functions (notice, err, etc) on the root environment.
This also requires setting the current environment to be nil in
Environment.clear by setting it directly on Thread.current.  Otherwise the
default environment from puppet.conf is used. In tests this was interfering
with the log functions being set on the root environment instead of the
current environment.
Merge branch '2.7.x' into 3.x

* 2.7.x:
  Always set log functions on root environment
  Use TestHelper in old unit tests
  Convert expect..should to expect..to in configurer spec

Conflicts:
	spec/unit/parser/functions/create_resources_spec.rb
	spec/unit/parser/functions/template_spec.rb
	test/language/parser.rb
	test/language/scope.rb
	test/language/snippets.rb
	test/lib/puppettest.rb
	test/lib/puppettest/parsertesting.rb