summaryrefslogtreecommitdiff
path: root/spec/unit/provider/group/groupadd_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2013-02-08(#7911) Fixed Libuser.getconf, updated unit specs, removed conflicting ↵John Julien1-5/+5
expiry fix This commit change the Puppet::Util::Libuser module to look for libuser.conf in its new /etc/puppet/provider/libuser.conf location. It also updates Puppet::Features::Libuser to only return true if the config file as well as the binaries are found. Updated the useradd and groupadd specs to expect :execute when called from create to now have 2 parametes. A command and an options hash. During my work on this feature I added an exipry getter since the builtin getter didn't retrieve the correct values. Before this patch was merged another commit came along that also set the proper getter. So I removed mine as it caused a conflict.
2013-02-08(#7911) Removed custom exception class for duplicate UID/GID. Using ↵John Julien1-2/+2
Puppet::Error now
2013-02-08(#7911) Stabalized providers when using libuser commands so it would behave ↵John Julien1-2/+14
identical to the existing providers Performed exhaustive analysis of the differences between useradd/groupadd and luseradd/lgroupadd and coded around these differences to ensure that the useradd/groupadd providers behave identically with and without the forcelocal parameter being set. The only difference being a local account is always created and managed when forcelocal is set to true. The commands are very similar for the most part so there was not a huge need to diverge from the original code. In all but one of the cases that did arise the solution was to make a subsequent usermod or groupmod call after the luseradd/lgroupadd command. Since the usermod/groupmod commands will always act on local accounts first, this achieves the desired effect. The one case where a subsequent call would not suffice was the use of the allowdupe parameter. By default libuser will allow duplicate uid/gid where useradd/groupadd require an explicit -o. The work around was to manually do a local check for a duplicate if using the libuser library and not intending to allow duplicates. If a duplicate is found Puppet raises a DuplicateUID or DuplicateGID exception.
2013-02-08(#7911) Added support for managing local users. Also created ↵John Julien1-1/+1
Puppet::Util::Libuser for better reuse of common code.
2013-02-08(#7911) Allow managing local groups when duplicate names exist in a remote ↵John Julien1-0/+18
NSS database e.g. LDAP. Some applications require local accounts and the useradd/groupadd commands currently used by the provider will not create a local account if they already exist remotely. The libuser commands luseradd/lgroupadd will allow a local name to duplicate a remote name. So these commands are used to force the local account creation. The libuser commands parse /etc/libuser.conf to determine which modules to use for creating users. Files must be the module used to get the desired local account managment. Because of this, it is necessary for Puppet to ship a libuser.conf file, which will only be used during a Puppet run, to ensure local account managment. The libuser.conf file used by the luseradd/lgroupadd commands can be overrideen by setting the environment variable LIBUSER_CONF. Which is what Puppet does to make sure its version of the configuration file is used
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune1-1/+1
Without this patch Ruby 1.9 is still complaining loudly about trying to parse the spec files. The previous attempt to clean up this problem in edc3ddf works for Ruby 1.8 but not 1.9. I'd prefer to remove the shebang lines entirely, but doing so will cause encoding errors in Ruby 1.9. This patch strives for a happy middle ground of convincing Ruby it is actually working with Ruby while not confusing it to think it should exec() to rspec. This patch is the result of the following command run against the source tree: find spec -type f -print0 | \ xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
2012-09-04Merge remote-tracking branch 'origin/2.7.x' into 3.xDaniel Pittman1-30/+36
2012-09-01(#15959) Fix groupadd/useradd spec when run on non-linux systemsStefan Schulte1-2/+2
The groupadd and useradd spec will only work if groupadd / useradd are the default provider for the group / user type. Explicitly set the provider in the spec tests so they can e.g. also run on MacOSX.
2012-08-18(#15959) Do not support system group on Solaris and HP-UXStefan Schulte1-4/+14
According to http://nixdoc.net/man-pages/hp-ux/man1/groupadd.1m.html http://docs.oracle.com/cd/E19963-01/html/821-1462/groupadd-1m.html neither Solaris nor HP-UX support the -r switch to create system groups so the groupadd provider should not claim to support system_groups on these platforms.
2012-08-18maint: Reduce stubbing in groupadd specStefan Schulte1-25/+16
It seams to be more reliable to work with real objects instead
2012-08-18maint: Rearrange tests in groupadd unittestsStefan Schulte1-24/+29
Tests are now ordered by method, so if modifications have to be done done in the provider code, it will be easier to track the according spec tests that have to be changed.
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune1-1/+1
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2011-04-13Merge branch '2.6.x' into nextMax Martin1-1/+11
* 2.6.x: Updated CHANGELOG for 2.6.8rc1 (#2331) Remove darwinports pkg provider, replace with rewritten macports provider Fixed #7082 - Added system support for groups (#7018) Give more context on the service type's assumptions. Wording tweaks. (#7018) explain internals better in service provider documentation maint: Fix sqlite3 require to really be optional maint: Fix sporadic sqlite error (#6818) Stop from getting Rails 3 named_scope deprecation warning (#6856) Copy dangling symlinks with 'links => manage' File resource. Conflicts (Resolved manually): lib/puppet/type/group.rb spec/unit/indirector/facts/inventory_active_record_spec.rb
2011-04-14Fixed #7082 - Added system support for groupsJames Turnbull1-1/+11
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman1-2/+1
We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
2011-04-08maint: just require 'spec_helper', thanks rspec2Daniel Pittman1-1/+1
rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2010-12-06maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson1-1/+1
Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe
2010-07-09Code smell: Two space indentationMarkus Roberts1-19/+19
Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
2010-06-28[#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts1-0/+31
Part 2 re-did the change on the spec files, which it shouldn't have.
2010-06-28[#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts1-31/+0
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
2010-06-23[#3994] rename the specs to have _spec.rb at the endMarkus Roberts1-0/+31
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700