(#16137) Ensure HOME is set before attempting ~ expansion
(Maint) Remove trailing whitespace
(#16137) Tilde expansion should only occur for normal users

The previous fix for #15185 caused File.expand_path to be called on
the user default config and var directories even when running as root.
This caused puppet starting as a service to fail because the HOME
environment variable is not set when most services are started.

This change ensures that the File.expand_path will only happen on a path
with a '~' when we are running as a non-root user, in which case the
HOME env var should always be there. As a part of untangling this code,
this also teases apart the Windows path handling from the Unix path
handling and allows us to use the more "Windowsy" path for the user's
local directories.
Merge pull request #1080 from zaphod42/ticket/3.x/16137-unable-to-start-puppet-as-a-service

(#16137) Tilde expansion should only occur for normal users
(Maint) dont fail on path unless absolutely required.

Previously, ensure=>running was required to specify the path. However,
if the zone is already configured, we dont really need the path.
This patch gets rid of that requirement.
- adds spec tests for start.
(Maint) - simplify methods in ZoneMultiConfigProperty (adds wrap).

This patch extracts the arrification into a single method wrap,
and shortens the method definitions by removing redundant code.
(Maint) Type Zone : fix formatting, comments

Add comment explaining why ensure:retrieve is necessary, added the output
of zone info to explain the regex, Fix format space, refactored global
retrieve to make it simple and succinct, simplify autorequire(:zfs),
setstatus, updated the regex in getconfig so that it matches the output
better. Updated the test case for getconfig
(#15886) Refactor state machine

The zone type has an internal statemachine that ensures that the state
transition is linear from configured -> installed -> running.
Previously, the state machine was intertwined with the code of zone
type. This commit extracts the statemachine so that thestatemachine is
in its own class

In order to remove future confusion, we also rename newvalue to seqvalue
and ensure that the newvalue is called from within the seqvalue. The
seqvalue is so named to indicate that the order of declaration of the
seqvalues determine the order of progression of states in the state machine.
Since we call parent newvalue from inside the seqvalue, we can now avoid using
munge which was added for this reason.

- Added test cases for fsm
(Maint) simplify line2hash, ensure iptype exclusive property is correct

Updated line2hash so that the method is succinct and simple, and added test cases for it.
(#15886) remove ZoneConfig and ZoneMultiConfig

Remove the zone specific properties from types, and move their handling to the provider.
This is done so that we can avoid stepping on the toes of puppet core and override methods
that have default behaviors except when necessary. The zone type is also more cleaned up
so that it can serve as a base for other container implementations.

Type: the properties that earlier relied on ZoneMultiConfigProperty are now moved to
Puppet::Property::List. The methods should and insync? are added to override the behaviors in
the parent methods. The should method in parent joins the array values together before
comparison. However, we do not want this behavior, and instead want it to remain as an array.
Hence we override should. We also override insync?  which uses should in parent for the same
reason.

Provider: the def_prop and def_multiprop now handles the definition of properties. They
add the methods prop(), prop=(), and prop_conf() to each properties that the provider provides.

The prop_conf() method is needed for getting the text to send to zonecfg on configure.
(#15886) getstatus should rename ip-type to iptype

previously, getstatus parsed the output of zonecfg info which contained
key `ip-type`. However, we are looking for the key `iptype`. this caused
the zone provider to not detect when iptype was changed, and always assume
the default value 'shared'. This commit gets the ip-type and assigns it to
iptype.
(#15886) commit the complete commands at the end.

Previously, the provider was applying the setconfig commands as soon as
it was called. This caused problems when the commands that were being called
needed to be called in a transactional manner
(i.e eth,exclusive -> eth:ip,shared). This uses flush to pass the required
commands at once through a pipe to zonecfg rather than do it one at a time.