(#18440) Don't make class methods private

Previously, the launchd service provider `enabled?` instance method was
calling the `launchd_overrides` private class method, which is not
allowed. This issue wasn't noticed, because the spec test was overly
stubbing the provider.

This commit makes the class methods public to avoid these sorts of
problems in the future.
(#11675) Remove duplicate flag on useradd

The check in the useradd provider caused puppet to add the expiry flag
twice when adding a user.

The addproperties method does already add the expiry flag to the
argument list. The default flag (dash and first letter of the property)
does also match what useradd expects, so everything just works "out of
the box".

The old method does also caused puppet to pass "-e EXPIRY" as ONE
argument instead of two. Kind of surprising that useradd actually does
not complain about that.
maint: Add specs for password min age/max age
maint: Improve test coverage for nameservice provider

The nameservice provider lacks a spec file so I tried to cover the most
important methods.

The changes to the nameservice provider itself do not imply any functional
changes or changes in behaviour and are just there to make writing specs
easier.
(#11675) Add value munging for nameservice provider

The nameservice provider defines a helper method `options` to specify
the flag for a property that will be used when creating the appropiate
useradd/usermod commandline. This commit now adds the options `munge` and
`umunge` to define methods that will automtically transformed the
property value when building the useradd/usermod command or when
retrieving the current value.

This munging is realized at a provider level so a unified value can be
used at a resource type level to represent different values at a
provider level.

One future use case could be the expiry property. We can define a value
of :absent at a resource type level to represent "account should not
expire" and represent it as '00-00-0000' in the pw provider and as ' '
in the useradd provider.
(#11675) Implement expiry in user provider

The useradd and pw provider claim to support expiry of user accounts.
And while they seem to be able to *set* the expiry, they don't seem to
implement any way to *get* the current value.

While this is still true for the pw provider (I am not familiar with
AIX) it should now work correctly with the useradd provider.

The expiry property uses munging at a provider level to convert
correctly to and from :absent (useraccount should not expire).
(#11675) Refactor useradd provider

The useradd provider is a subclass of the nameservice provider and all
the property retrieval and property installation is handled in the
nameservice class.

This works for most properties but does not work for properties that can
be installed with usermod but cannot be retrieved with Etc.getpwnam. The
useradd provider defines special getter methods for these properties
(password_max_age, password_min_age, password, expiry). Because all of
these more or less look exactly the same we can remove duplicate code.
Merge branch 'stschulte-ticket/master/11675_implement_expiry_retrieve'

* stschulte-ticket/master/11675_implement_expiry_retrieve:
  (#11675) Refactor useradd provider
  (#11675) Implement expiry in user provider
  (#11675) Add value munging for nameservice provider
  maint: Improve test coverage for nameservice provider
  maint: Add specs for password min age/max age
  (#11675) Remove duplicate flag on useradd
Revert "Merge branch 'stschulte-ticket/master/11675_implement_expiry_retrieve'"

This reverts commit ef7e01a0ae238969b29c97c263a1d37be3f05d5d, reversing
changes made to fe573ff61ffd0f04150a8aff20b126285d26b18e.

I'm reverting this commit because the spec tests are not passing on Ruby
1.8.7.  The following error is being raised in CI http://goo.gl/ruC4e

Failures:

  1) Puppet::Type::User::ProviderUseradd#addcmd should return an array with full command
     Failure/Error: provider.addcmd.must == ['/usr/sbin/useradd', '-G', 'somegroup', '-e', '2012-08-18', '-o', '-m', '-r', 'myuser']
       expected: ["/usr/sbin/useradd", "-G", "somegroup", "-e", "2012-08-18", "-o", "-m", "-r", "myuser"]
            got: ["/usr/sbin/useradd", "-e", "2012-08-18", "-G", "somegroup", "-o", "-m", "-r", "myuser"] (using ==)
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/expectations/fail_with.rb:33:in `fail_with'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:47:in `fail_with_message'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:69:in `__delegate_operator'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:59:in `eval_match'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:28:in `=='
     # /mnt/workspace/Puppet Specs (master)/gemset/@noFeatures/ruby/ruby-1.8.7/rvm/#rvm/spec/unit/provider/user/useradd_spec.rb:234
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:80:in `instance_eval'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:80:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:173:in `with_around_hooks'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:77:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:355:in `run_examples'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:351:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:351:in `run_examples'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:337:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/reporter.rb:34:in `report'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:25:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:69:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `autorun'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/bin/rspec:19

  2) Puppet::Type::User::ProviderUseradd#addcmd should pass -e " " on solaris if the expiry has to be removed
     Failure/Error: provider.addcmd.must == ['/usr/sbin/useradd', '-G', 'somegroup', '-e', ' ', '-o', '-m', '-r', 'myuser']
       expected: ["/usr/sbin/useradd", "-G", "somegroup", "-e", " ", "-o", "-m", "-r", "myuser"]
            got: ["/usr/sbin/useradd", "-e", " ", "-G", "somegroup", "-o", "-m", "-r", "myuser"] (using ==)
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/expectations/fail_with.rb:33:in `fail_with'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:47:in `fail_with_message'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:69:in `__delegate_operator'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:59:in `eval_match'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:28:in `=='
     # /mnt/workspace/Puppet Specs (master)/gemset/@noFeatures/ruby/ruby-1.8.7/rvm/#rvm/spec/unit/provider/user/useradd_spec.rb:247
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:80:in `instance_eval'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:80:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:173:in `with_around_hooks'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:77:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:355:in `run_examples'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:351:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:351:in `run_examples'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:337:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/reporter.rb:34:in `report'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:25:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:69:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `autorun'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/bin/rspec:19

  3) Puppet::Type::User::ProviderUseradd#addcmd should pass -e "" on other systems if the expiry has to be removed
     Failure/Error: provider.addcmd.must == ['/usr/sbin/useradd', '-G', 'somegroup', '-e', '', '-o', '-m', '-r', 'myuser']
       expected: ["/usr/sbin/useradd", "-G", "somegroup", "-e", "", "-o", "-m", "-r", "myuser"]
            got: ["/usr/sbin/useradd", "-e", "", "-G", "somegroup", "-o", "-m", "-r", "myuser"] (using ==)
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/expectations/fail_with.rb:33:in `fail_with'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:47:in `fail_with_message'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:69:in `__delegate_operator'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:59:in `eval_match'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-expectations-2.9.1/lib/rspec/matchers/operator_matcher.rb:28:in `=='
     # /mnt/workspace/Puppet Specs (master)/gemset/@noFeatures/ruby/ruby-1.8.7/rvm/#rvm/spec/unit/provider/user/useradd_spec.rb:255
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:80:in `instance_eval'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:80:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:173:in `with_around_hooks'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example.rb:77:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:355:in `run_examples'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:351:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:351:in `run_examples'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:337:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/example_group.rb:338:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `map'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:28:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/reporter.rb:34:in `report'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:25:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:69:in `run'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `autorun'
     # /home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures/bin/rspec:19
Revert "Revert "Merge branch 'stschulte-ticket/master/11675_implement_expiry_retrieve'""

This reverts commit 3f96ecdc6dec2bb724cb60a36970f6199757e42a.

The original commit series around issue 11675 have been reverted because
they caused test failures and the policy is to revert such commits.

Restore the commit series to be able to fix the failing tests.
(#11675) Fix test failures in ruby 1.8.7

The spec tests for the Puppet::Type.addcmd method failed on ruby 1.8.7.

The addcmd method builds a commandline to execute `useradd` with
appropiate command line arguments. To build the commandline
`add_properties` gets called which in turn calls
`Puppet::Type.validproperties`. The order in which properties are returned
can be considered undefinied so the whole `useradd` commandline can include
arguments in random order. While the randomness does not make a difference for
the useradd executable it causes spec failures on some systems.

Sort the properties when building the useradd commandline. This way the
result is consistent across all ruby versions and easier to test.
Maint: Remove dead ca_md setting

The `ca_md` setting was added in commit bb4b5a54 in Aug 2005, but was
never used in that commit or any subsequent commit.

The setting itself is also confusing, because we create digital
signatures on both the agent (when signing the CSR) and the CA (when
signing the x509 cert).

It's also confusing because both encryption and hash algorithms need to
be specified when creating a digital signature, e.g.
sha256WithRSAEncryption. But the existence of the `ca_md` property might
encourage patches to allow the hash algorithm to be configured, but not
the encryption algorithm.

Long term, we'd like to eliminate hard coding of cryptographic
parameters, as it makes it difficult to upgrade while maintaining
compatibility across different versions of master and agents.
Merge pull request #1390 from joshcooper/maint/master/remove-ca_md-setting

Maint: Remove dead ca_md setting
Merge branch 'stschulte-ticket/master/fixup_expiry'

* stschulte-ticket/master/fixup_expiry:
  (#11675) Fix test failures in ruby 1.8.7
  Revert "Revert "Merge branch 'stschulte-ticket/master/11675_implement_expiry_retrieve'""
Merge pull request #1384 from joshcooper/ticket/master/18440-macosx-service

(#18440) Don't make class methods private
Revert "Merge branch 'stschulte-ticket/master/fixup_expiry'"

This reverts commit ba6de834e4ef68926386fb6ccdcb657cf9ebe5a4, reversing
changes made to 0f1de9a3926842fd3a4167e5fecf81f5fefe80b7.

Reverted due to [build failure](http://goo.gl/9DQYF)
Fix empty hash console rendering bug

Previously, if a face action returned an empty hash Puppet would print
out an error something like the following:

    err: undefined method `+' for nil:NilClass
    err: Try 'puppet help stack build' for usage

The cause of the error was a method in network/formats.rb that did not
account for the possibilty of an empty hash. This commit resolves the
issue by adding logic to account for the empty hash scenario, rendering
an empty hash as an empty string.
Merge branch 'reidmv-fix/master/formats_render_empty_hash'

* reidmv-fix/master/formats_render_empty_hash:
  Fix empty hash console rendering bug

closes #1380
(#17713) make upstart_version an instance variable

This fixes the bug in some later versions of ruby which causes warnings
to be thrown when this class variable gets set from an instance of the
class.
Merge branch 'adregner-fix/master/service_upstart_class_variable_access'

* adregner-fix/master/service_upstart_class_variable_access:
  (#17713) make upstart_version an instance variable