diff options
31 files changed, 597 insertions, 282 deletions
@@ -1,5 +1,48 @@ +2.6.2rc1 +======== +1b6094d Fixed documentation typo +bdf12fe Fix for #4896 -- stray newline left over from removed diagnostic +e7424c6 (#4772) Update SuSE .spec file +0aaa742 Fixes #4792 (Duplicate definition since 2.6.1 upgrade) +ea49d13 Improvement to #4025: made spec tests work on all platforms +0b4ce08 Adds #3046 - support for password min/max age +e9f9d26 [#4783] (#4783) Fix RRDGraph report generation +34f87cf Add user account expiry to the useradd type and provider +a7fb9b1 Fixed #4025 (failure in launchd if certain plists are binary). +2573872 Fix for #4649 -- avoid unsupported features on non-posix systems +eb9279c Fix for 4273 -- revert b7e2580ab49ecdb67fc9b522829c005fc3750fbe +53a2bea Fix for #4804 -- escaped backslashes in interpolated strings +d12e477 Fixes #4863 (Missing "require 'webrick'" causes nondeterministic spec failures) +574812e (#4860) Add regression tests that would have caught bad params method +68947e7 (#4860) Fix wrong method name.. params seems to be renamed to parameters +021359b Fix for #4644: install.rb works properly on Windows +d057b90 Fix #4726 Update puppet rrdtool metric code to support modern rrd ruby bindings +66cf3a9 Fix #4226 - Prepend 'Puppet CA: ' to fqdn for default root ca_name +d54352a Port Puppet::SSLCertificates::CA test to rspec +effc6b8 Fixes #4852 - error messages involving Whits now mention Classes instead +3f99bd7 Fix #4267 - Create a backup before dropping permissions +6468f4e (#4763) Don't call a method that was removed in Rails 3 activerecord +79d5fde Fixed #4763 - Hardcoded ActiveRecord version +4798df3 Fixes #4822 -- Puppet doc -o option broken +99c1019 [#4798] Puppet doc manifests documentation mode broken +8cd1540 [#4692] undefined variables cause :undef to be passed to functions +06bf566 [#4787] Missing require causing failure +bba04e0 Fix for #4746 -- Newline goes at the _end_ of the line +9e17c25 Fix #4743: Allow the audit meta-parameter to accept both 'all', and :all +f950061 [#4716] ResourceTypeAPI exposes implementation details that are likely to change +8ff4b9a Fixed #4819 - corrected cron documentation +2b50f30 [#4771] Import of manifests with the same name only happens once +7b8cb74 Fix for #4708 - tagmail should allow . in tagname +6f229ee Minimal fix for #4631 -- set implicit classes as in 0.25.x +021d534 Fixed #3707 - rpm, like dpkg-query exits 1 if the package is not installed. Returning nil in this provider had the effect that on every run, puppet would end up calling yum erase . Returning the correct data structure resolves this. +216f663 Fixed Puppet Doc TOC generation +c3cb57c Fixed versioncmp function typo +898a170 Fixed Reductive references in LICENSE file +996f14e Documentation updates for Markdown conversion + 2.6.1 ===== +cad1e0f Updated CHANGELOG for 2.6.1 14f871d [#4756] addendum for #4756 9bdfe69 Fix for Bug #4756 - Providers no longer respect missing features Restored deleted lines from type.rb and reinstated unit tests 14b3340 Fix for #4736 -- preserve case of defined resources @@ -3550,10 +3593,6 @@ ada960b Constants in provider/interface/redhat.rb are getting redifined as they 5e8d71d Fix the ral:providers:host:parsed tests so they run successfully 9530df1 Updated to version 0.23.2 0d312a1 Updated to version 0.23.2 - -0.23.2 -====== -49c9a62 Adding release tag REL_0_23_2 b84015a The last set of bug-fixes before the next release. This commit just fixes a couple of problems that resulted when I changed the Provider#initialize method to not duplicate its argument, which was necessary for ParsedFile. aaf5959 Adding test support for the other mongrel configuration header db0ffc7 Copying the "commands" and "confine" statements to the actual dscl providers, since they need to be there to determine where the providers are suitable. Otherwise base classes could unnecessarily affect how subclasses work. @@ -3583,10 +3622,6 @@ a8bf96a Adding a file that should have been in a commit from yesterda 530d290 Applying a modification of the patch from Marcin Owsiany, allowing Mongrel to be a CA 64fba48 Updated to version 0.23.1 d3988cc Updated to version 0.23.1 - -0.23.1 -====== -0f7f752 Adding release tag REL_0_23_1 2229dc1 Fixing #726 -- mounts can now correctly handle mounted but absent filesystems. 47b7058 Adding some code in an attempt to fix #728, but it is all commented out since I could not get it fixed in time for beaker 2e14ea4 Attempting to clean up the mount documentation as in #727. @@ -3677,10 +3712,6 @@ dc2a0bf Use single config file ada4355 Updated to version 0.23.0 d8f4c53 Updated to version 0.23.0 049faf8 Updated to version 0.23.0 - -0.23.0 -====== -f588d47 Adding release tag REL_0_23_0 8844fca Changing the paths to match laeg, instead of culain. d79a788 Modified the fileserver to cache file information, so that each file isn't being read on every connection. Also, added londo's patch from #678 to avoid reading entire files into memory. 944e1f4 More updates to puppet-test @@ -3854,10 +3885,6 @@ fb4f04d updating changelog with version number 0f02a54 Updated to version 0.22.4 e049999 Updated to version 0.22.4 4f2b903 Updated to version 0.22.4 - -0.22.4 -====== -22ce899 Adding release tag REL_0_22_4 3e895b5 Changing the remount stuff back to not repeating the mount options. 6438270 Adding a "supports_parameter?" method to test whether a given provider supports the features required by a given parameter. This is used during attribute instance creation, but its creation was necessicated by test code. c9de332 Fixing the fileserver naming tests after the change to allow "-" in fileserver module names. @@ -3921,10 +3948,6 @@ ca5d068 Updating the docs for the sourceselect parameter a999752 Updated to version 0.22.3 24ad5ab Updated to version 0.22.3 9ce7c79 Updated to version 0.22.3 - -0.22.3 -====== -a3a7ea7 Adding release tag REL_0_22_3 e154589 Fixing puppetdoc with the recent changes to the networking code 801d0f7 Fixing a bug I apparently introduced in the testing that would have made user management not work with netinfo. In the process, I am enabling validation on the nameservice subclasses. 2544f75 Fixing the documentation to match reality, as reported in #548. @@ -3948,10 +3971,6 @@ c5e1a44 Fixing the "readcert" method after getting the signed cert; the method 36feb29 Fixing a small bug in testing whether instance methods are already defined. 45904ca Updated to version 0.22.2 0452878 Updated to version 0.22.2 - -0.22.2 -====== -a917a3e Adding release tag REL_0_22_2 474b86c Hopefully the last batch of commits before I release 0.22.2. Mostly just get tests to pass. 90d8b2d Remove no-lockdir patch. Clean changelog a68a7c2 Change puppet's homedir to /var/lib/puppet @@ -4106,10 +4125,6 @@ f80bd5e Fixing exec so it actually works when path is specified as an array d117aa8 Updated to version 0.22.1 1e90209 Updated to version 0.22.1 463d3a8 Updated to version 0.22.1 - -0.22.1 -====== -530c255 Adding release tag REL_0_22_1 1d059b0 Fixing #470, I think. I basically just threw away the validation and let suidmanager do it all when running commands. 69a07b1 The resolve functionality in "test" is almost working... 42d15fe Adding note about removing mounts netinfo provider @@ -4201,10 +4216,6 @@ f7d8350 Updating docs for 0.22.0 4ee6c97 Updated to version 0.22.0 98ed0ae Updated to version 0.22.0 38cfa67 Updated to version 0.22.0 - -0.22.0 -====== -728d745 Adding release tag REL_0_22_0 3446dd6 Last round of fixes before the next release 954a285 Fixing puppet test task for older ruby versions 7afa69c Fixing rake test so it works with the new puppet loader @@ -4383,10 +4394,6 @@ c3c5851 Fixing configuration storage -- there was a check being done that cause 60af8e2 Updated to version 0.20.1 e313a26 Updated to version 0.20.1 68d9e78 Updated to version 0.20.1 - -0.20.1 -====== -2feb9e8 Adding release tag REL_0_20_1 7d46167 Updating changelog for 0.20.1 7fa96cb Another small fix, just for solaris db5d9d4 Another testing fix @@ -4438,10 +4445,6 @@ e741b7b Fixing some Class.to_s handling 71924ad Updated to version 0.20.0 a488dd9 Updated to version 0.20.0 4688d93 Updated to version 0.20.0 - -0.20.0 -====== -7694bd9 Adding release tag f9f939e Updating changelog for 0.20 e3b4f23 Another round of bugfixing, including finding out that the tagmail report was leaving zombie processes lying around 07f616b A round of bug-fixing on OS X @@ -4563,16 +4566,6 @@ f2ac4dc Updating changelog for 0.19.3, and merging the version changes over. 8f9dcb5 Updated to version 0.19.2 595d5ba Updated to version 0.19.2 6902f2d Updated to version 0.19.2 - -0.19.3 -====== -bec795d Adding release tag REL_0_19_3 -0513ffa Fixing problem with the hostname being removed when running locally. The node_name setting was not checking that the client was set, and it is never set when running locally. -7726afc Adding branch to fix the problem with hostnames getting nilled - -0.19.2 -====== -ddb4c47 Adding release tag REL_0_19_2 164c18f As requested by Christian Warden, triggering an object now results in an event, which can result in further triggers. 98004b2 Adding some error handling for when a non-existent report is asked for, and adding a bit more testing. a1e27bc Adding trace information to autoload.rb @@ -4617,10 +4610,6 @@ fd4ef3c Better documentation around certificate revocation and mgmt c8a6df0 Updated to version 0.19.1 ee8b8c7 Updated to version 0.19.1 6f85511 Updated to version 0.19.1 - -0.19.1 -====== -7e229a8 Adding release tag REL_0_19_2 0e58f65 Updating changelog for 0.19.1 4a3c8d1 Adding testing for the default? method, and fixing it to support arrays and returning false when no defaults are specified 48992d7 Using the "trace" configuration parameter to determine whether a stack trace should be printed, rather than just using "debug". I added the param a little while ago and was using it internally in Puppet::DevError, but I just now went through the whole configuration and switched to using it. @@ -4662,10 +4651,6 @@ c651b19 Disable the sample fileserver module by default, otherwise users get sp 65bb635 Updated to version 0.19.0 61e42e7 Updated to version 0.19.0 12b219e Updated to version 0.19.0 - -0.19.0 -====== -fbebcc5 Adding release tag REL_0_19_0 e309b76 Modifying the provider base class so that it defines a method for every used command (e.g., you call "commands :rpm => 'rpm'", and it defines an "rpm" method. I then pushed this throughout the package providers, which are the heaviest users of commands. c5ce953 Adding aptitude support, including a new util::package module that provides a method for package version sorting, and a couple of smaller bug fixes. This fixes #237. 2113eed Adding hasrestart parameter to services @@ -4783,10 +4768,6 @@ b2f1aa0 doc updates b8bf113 Updated to version 0.18.4 94cc68b Updated to version 0.18.4 ce95ee3 Updated to version 0.18.4 - -0.18.4 -====== -74a3b4d Adding release tag REL_0_18_4 f13c451 updating changelog for 0.18.4 cdeccab Another batch of bug fixes, this time focused on OS X patches. Looks like I did not test on os x last time. b42eaee First round of bugfixes in preparation for 0.18.4 @@ -4817,10 +4798,6 @@ e74b8af fixing html markup b23b797 Updated to version 0.18.3 fe8ce26 Updated to version 0.18.3 a984a90 Updated to version 0.18.3 - -0.18.3 -====== -04a99e7 Adding release tag REL_0_18_3 8063ab1 Fixing filebucket server so that paths are not added multiple times 1ab4594 Adding tests for previous config bugfixes, and updating changelog a6cc3e4 Fixing reports so that multiple host report directories can be created. There was a config conflict before. @@ -4850,10 +4827,6 @@ eff8d6e Accepting the patch from #190. bd9fd8d Updated to version 0.18.2 71036e7 Updated to version 0.18.2 aa87963 Updated to version 0.18.2 - -0.18.2 -====== -3e5907d Adding release tag REL_0_18_2 afe84ec small fixes towards 0.18.2 e17f4ed adding host information to reports and tagmail report 1503b42 renaming tagmail config file @@ -4884,10 +4857,6 @@ ea91896 changing the #!ruby lines to #!env ruby d275489 Updated to version 0.18.1 35ef37b Updated to version 0.18.1 427831c Updated to version 0.18.1 - -0.18.1 -====== -1cc2712 Adding release tag REL_0_18_1 7adafc6 For each type, adding a "new<type>" method to Puppet::Type, so instead of typing Puppet::Type.type(:file).create(...) you can now type Puppet::Type.newfile(...). e8c57ae Cleaning up plugin handling a bit -- they can now be colon-separated paths, and I added a separate "plugindest" setting for determining where plugins are synchronized to. The major feature I added, though, is that Puppet::Type now knows how to load plugins, and treats :pluginpath as a search path for plugins. d98ab11 Fixing zone tests @@ -4937,11 +4906,6 @@ e841d8f Adding test and fix for empty execs being ignored 0ab461b Updated to version 0.18.0 daac8cf Updated to version 0.18.0 8779dbe Updated to version 0.18.0 - -0.18.0 -====== -4a5df83 Adding release tag REL_0_18_0 -a6f9bf4 Adding release tag REL_0_18_0 ae3dba9 updating changelog for 0.18.0 ead6b17 updating documentation for sshkey 20b0a6d fixing transaction tests to just warn when the user is not in more than one group, rather than failing. @@ -5003,10 +4967,6 @@ b08816b Fixing #162. Node names must now be comma-separated. 3ab4a89 Small fix to include puppetrun in /usr/bin 62a0ff0 adding puppetrun to the red hat spec file fda013a Updated to version 0.17.2 - -0.17.2 -====== -b742236 Adding release tag REL_0_17_2 3c15a28 updating changelog for 0.17.2 a08ca93 Fixing #138, all of it, I think. Environment settings are now allowed, although all bets are off in terms of parsing existing environment settings in crontabs. 69cf2fe Adding a small fix to cron tabs; they will at least parse tabs that have env settings in them, although you still cannot, at this point, set them. @@ -5016,10 +4976,6 @@ d55adda First version of puppetrun. It seems to mostly work, but I need to tes b3ea53c Adding a lot of structure to puppet.rb to make it easier to manage multiple objects in a single process, including making it easy to add threads. Added some testing for all of that. 93771b7 fixing user[:groups] management when the user is absent 738698c Updated to version 0.17.1 - -0.17.1 -====== -f028420 Adding release tag REL_0_17_1 ed9adf5 updating changelog for 0.17.1 and 0.17.0 9b5de11 Allowing empty files 5382118 Fixing #146. I think I mostly just fixed the error message; I do not think there was another bug there. @@ -5027,10 +4983,6 @@ ed9adf5 updating changelog for 0.17.1 and 0.17.0 dc3a6d5 Making sure file recursion works for all valid inputs 373afa3 updating version on spec file 4296b02 Updated to version 0.17.0 - -0.17.0 -====== -559f4b0 Adding release tag REL_0_17_0 3be0f95 Wrapping the host storage into a transaction. It might have a slight performance improvement, but, ah, unlikely. 9d6166e adding a test to make sure that defaults get taken up by components a0bcf5a Adding code to try for the rails gem if the library cannot be found normally, and adding some protections in case there are problems @@ -5062,27 +5014,15 @@ e06c661 Small bug fixes 18de804 fixing log messages a7fadbe fixing log messages 43fdd89 Updated to version 0.16.5 - -0.16.5 -====== -054cc77 Adding release tag REL_0_16_5 64a58e4 updating changelog for 0.16.5 44f1579 Fixing a stupid bug i managed to introduce in 0.16.2 (probably) involving importing files with classes in them. This is a better solution than what I had before the bug, anyway. Also, some documentation fixes. a9df49d Fixing some naming problems with crons, and adding appropriate tests e8c912d Allowing dashes in class names, although grammar rules restrict it from working anywhere except node names or in tag(). They are valid in host names, and many companies have them in the host names; in fact, this fix is for a company with this exact problem -- they cannot use puppet with their nodes because all their hosts have dashes in the host names. 37d2850 Switching to just using "preserve" for file copying in file#handlebackups 8b0481c Updated to version 0.16.4 - -0.16.4 -====== -66b8bfd Adding release tag REL_0_16_4 4b84ca9 updating changelog for 0.16.4 b67a19b Fixing #132, which involved creating a separate CA client and using it to retrieve the certificates. There was more work to do because of the weird client/daemon/server heirarchy. a435d07 Updated to version 0.16.3 - -0.16.3 -====== -ab17248 Adding release tag REL_0_16_3 3f08155 updating changelog 2faa447 Bug fixes from OS X for 0.16.3 5e246ab Hopefully final bug fixes in preparation for 0.16.3 @@ -5098,17 +5038,9 @@ a1574a5 Fixing TransObject#to_type so that it does not modify the object being bcfc469 Adding in all of the patches necessary to make a prototype rails interface to puppet nodes work. The biggest change is that there is now a separate NetworkClient class for every Client subclass, because otherwise you get namespace collisions. Most everything other change is a relatively minor patch. 9539dbb Adding in all of the patches necessary to make a prototype rails interface to puppet nodes work. The biggest change is that there is now a separate NetworkClient class for every Client subclass, because otherwise you get namespace collisions. Most everything other change is a relatively minor patch. 9b627cd Trying to track down the bugs reported this morning, so I added some more test cases. I did find a bug in the filebuckets, fixed it, and added a test case. - -0.16.2 -====== -13c91ea Adding release tag REL_0_16_2 003e897 updating changelog for 0.16.1 and 0.16.2 a78bf1e adding "clean" mode to puppetca bda8e52 This should have been in 0.16.1. Moving the "setclass" statements around so that classes are set before a given class's code is evaluated, so it can be tested within the code, within node defs, components, or classes. - -0.16.1 -====== -77bf69c Adding release tag REL_0_16_1 bff9463 Adding sum type to the retrieved sum if it is not already there. This provides backwards compatibility for existing cache files. feff317 removing unnecessary debugging baa412c Adding "defined" functino to puppet, so you can now test whether a given class or definition is defined. @@ -5116,10 +5048,6 @@ baa412c Adding "defined" functino to puppet, so you can now test whether a give ccc4d95 Modifying non-existent-package test to make sure syncing fails, and modified ports package type to check the error output instead of the return code, because the portinstall command returns 0 even on failure. e64bd22 Fix ownership on server files (trac #122) Change ownership on /var/puppet 9fe0b37 removing patch from red hat spec file - -0.16.0 -====== -2492328 Adding release tag REL_0_16_0 a0b4553 Final commit before 0.16.0 63cdc6c making corrections to pass tests on freebsd d9fd002 Go some work started on developing authorization, but I have made little progress. I might wait on this for the next point release. @@ -5157,10 +5085,6 @@ ae4b12e Revamp the yumrepo type to deal with repositories defined anywhere in y 8df6e84 another small mount fix; this time, for stupid os x 88dd992 committing version changes d10a638 Committing an important fix to mounts; since i am sure no one has downloaded 0.15.3, i am just going to rerelease 0.15.3 with this fix in it - -0.15.3 -====== -abf09dc Adding release tag REL_0_15_3 83d5236 updating changelog for 0.15.3; I need these exec fixes for my client e5be7d3 Adding autoloading for types and service types, also. fcce820 Okay, last one, hopefully. Modifying checks to support arrays. @@ -5170,10 +5094,6 @@ fcce820 Okay, last one, hopefully. Modifying checks to support arrays. 1e4abae moving cwd existence check into "sync" instead of "validate" 7dae24f Fixing a small bug in type.rb that ignored false values (instead of nil values), another small bug in value setting that resulted in the file and line appearing twice in errors, and added validation to all of the checks in :exec (along with testing for all of it). b0edb35 removing patch from spec file - -0.15.2 -====== -feab8d9 Adding release tag REL_0_15_2 122cf58 updating changelog in preparation for 0.15.2 013cfd2 Adding darwinport type. 9697354 differentiating openbsd from freebsd, adding freebsd, and autoloading package types instead of manually loading them @@ -5217,10 +5137,6 @@ a9fdf9d Disbale running puppetmaster as puppet until we've sorted out which fil 791e4da Committing support for group membership management. Currently only works on Linuxes and other OSes that use "useradd" that support -G. 932fd03 commiting package test fix that i thought i committed ages ago 28602a6 Simplified as yum install can be used for both install and update - -0.15.1 -====== -437ee64 Adding release tag REL_0_15_1 95b762b updating changelog for 0.15.1 fc98ab0 Fixing #100. I just added a bit of a hack to configuration parsing -- if a group is specified in a section that matches the name of the process, then it is assumed to be the group that the process should run as. The problem is that we are reusing the term "group" here for both the run-group and the file-group. Oh well. 5dcf303 Using differents commands with yum depending on whether the package is currently installed or not. @@ -5236,10 +5152,6 @@ fc68910 removing dos EOL chars c74fd81 Committing the EPM support. I am in the process of moving this to a common library that all of my projects can use. 271a8d2 Adding EPM package building. 805b32b Updated to version 0.15.0 - -0.15.0 -====== -1409cd6 Adding release tag REL_0_15_0 92e3c1e Updating changelog for 0.15.0. ec7d46e fixing small bug in the test code when there are no packages to test f851be7 Adding upgrade ability to sun packages. Currently it removes the old package and installs the new one. @@ -5269,19 +5181,11 @@ b6d829b Fixing #95. I had to redesign how events were triggered; the transacti 7756f9a Fixing #97. I was wrong about the object type I had, so I was calling "type" with no arguments, which was causing the bug. 2faff5d lowering the log output for nonexistent files eb68633 Updated to version 0.14.1 - -0.14.1 -====== -ad0fa4b Adding release tag REL_0_14_1 cee0882 updating changelog for 0.14.1 2351cd7 making case statements not create a new scope 54fcdbd fixing some more logging issues 0549d03 Making some logging changes, and fixing a small bug in group management on missing files 72d747b Updated to version 0.14.0 - -0.14.0 -====== -783735c Adding release tag REL_0_14_0 b76004a Fixing yum listing bug, and caching the "latest" value so it is not asked for so many times; this fixes #90. 3c07deb Committing the last changes, for now, to handling links. You still cannot copy remote links, but you can either ignore or follow them. I do not think we will be able to copy remote links until I have merged symlinks and files to be the same object type again. e9e88b0 Adding "links" parameter to files, and adding support for following or ignoring links to all of the states it can matter to. I still need to modify "source" so that it behaves correctly when managing links. @@ -5298,10 +5202,6 @@ f2ea9b7 Supporting variables as the test value in both case statements and sele aae9b2a Definitions now always create their own context, which means that they cannot override elements in the containing scopes. 451ba6d upgrading to warning the message about using a cached copy faffd69 Updated to version 0.13.6 - -0.13.6 -====== -25614df Adding release tag REL_0_13_6 caa7f48 updating changelog for 0.13.6 343dd08 Fixing tests so they do not chmod /dev/null to 640 (stupid tests). 1a93c82 Fixing #68. After tons and tons and tons of work, everything successfully configures itself, and the --genmanifest argument should actually work. User and group creation will not necessarily work everywhere (in particular, Puppet uses dependencies to create the group first, but Fedora complains on user creation if the group already exists), but file and directory creation should. The only downside is that there is a decent amount of extra information printed on daemon startup, as the daemon checks its config; this could maybe be seen as a bonus, though, I guess. @@ -5330,20 +5230,12 @@ b119a72 Fixing output when user/group are not found 043fc33 adding commas to each line d06cd3f removing the initial syslog dest setting f6ca82b Updated to version 0.13.5 - -0.13.5 -====== -7ec2f82 Adding release tag REL_0_13_5 85e4d31 adding changelog for 0.13.5 2dffbee Adding redhat service type, to support enabling and disabling a service 7e5cc76 Fixing package types so you can specify the package type manually in a manifest 7806618 removing extra error statement 6e26a73 adding passwd converter 3aff15e Updated to version 0.13.4 - -0.13.4 -====== -d0b3f6c Adding release tag REL_0_13_4 1f05ad0 updating changelog for 0.13.4 cfb0e36 updates 89856ec Adding a bit more logging @@ -5360,10 +5252,6 @@ beef01c Properly figure out when updates are available. Previously, packages wo 5f4335f Adding logoutput parameter to :exec 89702d8 Fixing symbolic naming bug where symbolic names were being ignored in some cases 7d15fe1 Updated to version 0.13.2 - -0.13.2 -====== -d0bbab5 Adding release tag REL_0_13_2 037b7ac Changed the parsedtype definition of exists(), and fixed a few smaller bugs. Last code commit before 0.13.2 6fe01ce Tracked down a few other bugs; everything now passes on debian in preparation for 0.13.2 8602932 Changing "answerfile" to "adminfile", adding "responsefile", and autorequiring both. @@ -5378,10 +5266,6 @@ f098485 Correcting some path problems with symlink, and changing "target" state 3f15cb8 Fixing :target reference in pfile.rb 9508bd0 Correcting some path problems with symlink, and changing "target" state to "ensure" 64eafa8 Updated to version 0.13.1 - -0.13.1 -====== -ac8f3ae Adding release tag REL_0_13_1 a456c4d updating alias docs to pass ReST checks 1a05ed2 updating changelog and docs for :alias 89d37f6 Fixing some problems with cron tab management, and creating Puppet::Util.{u,g}id methods. @@ -5392,10 +5276,6 @@ b13b5ed Set the Release tag in the spec file to 1 when the version is changed 8c02ffd Adapt specfile to the fact that puppetmaster now automatically runs as user puppet. Add default config files that send logs to /var/log/puppet. d629a80 Fix version in last changelog entry (makes rpmlint happy) 44071d0 Updated to version 0.13.0 - -0.13.0 -====== -4751fce Adding release tag REL_0_13_0 2cb5cb3 Updating changelog for 0.13.0 387db24 Adding answerfile support to sun pkgs. 2ce061a adding some documentation @@ -5432,10 +5312,6 @@ d5af359 Rewrote client init script since puppetd is now a proper demon. 96b761b Fixing waitforcert so that the client can actually add the certs once it receives them c7f9942 Adding release tag REL_0_12_0 cf82cfa Updated to version 0.12.0 - -0.12.0 -====== -2c35151 Adding 0.12.0 release tag 282cfcf Updated to version 0.12.0 1186069 Small mods to the packaging stuff 87904d3 RPM release is almost entirely there, it just needs to be integrated into release management @@ -5445,26 +5321,14 @@ ae2575b Adding the event-loop stuff to the repository and switching to using it 258114d Modifying docs, and adding scheduling hooks 0cb51f3 Fixing a small checksumming bug, reorganizing the client stuff a bit, and adding freshness checking for the configuration, so the config is recompiled every time nor is it downloaded unless it has been recompiled f49b103 Updated to version 0.11.2 - -0.11.2 -====== -36f6e05 Adding release tag REL_0_11_2 c372a7d modding changelog for 0.11.2 6bab167 Made lots of small changes, mostly to help usability but also fixed a couple of key bugs ed39be9 Fixing most types to allow no statements 3d458ef Updated to version 0.11.1 - -0.11.1 -====== -4bbb952 Adding release tag REL_0_11_1 c3df525 modifying changelog for 0.11.1 060b8bd Adding openbsd packaging support ada3aee Fixing problems where objects were passing @parameters[:param] objects, instead of specifically retrieving the value f36c7d1 Updated to version 0.11.0 - -0.11.0 -====== -1d2095b Adding release tag REL_0_11_0 3700b37 Adding an "ensure" state where appropriate, and significantly reworking the builtin docs. 92a780a Added "ensure" state to some classes, and added infrastructure for it to work elsewhere. 83906a2 Adding sshkey class plus tests, and adding "aggregatable" methods to type.rb @@ -5485,10 +5349,6 @@ f420135 Converting transport format to YAML instead of Marshal, and caching the c5782df Adding "content" state to files, and string interpolation handles escaped whitespace characters. b0ea70d Adding 0.10.2 stuff 6b6c49b Updated to version 0.10.2 - -0.10.2 -====== -f7211e3 Adding release tag REL_0_10_2 1cf05ff Services now work at least somewhat on solaris 10, and service testing is pretty different. 4c4f530 Fixing dependencies to not depend on file order. Added Puppet::Type.{finalize,mkdepends,builddepends} 21410a2 Fixing documentation generation, and fixing aliasing so that objects can safely be aliased to themselves @@ -5497,10 +5357,6 @@ f7211e3 Adding release tag REL_0_10_2 97fb6c9 Adding generic autorequire mechanism, and thus removing it from exec 11b5463 Adding a requires? method to types, fixed the bug where exec fail when Puppet is downloading the script to execute, and modified "exec" to autorequire any managed scripts 932b783 Updated to version 0.10.1 - -0.10.1 -====== -dc012b1 adding 0.10.1 release tag 854f16b modifying changelog for 0.10.1 89d0050 Adding Sun support and fixing the last remaining bugs related to the daemon changes i just made 45ac512 Supporting puppetmasterd running as a non-root user, and doing some basic message cleanup @@ -5509,10 +5365,6 @@ dc012b1 adding 0.10.1 release tag e5ac196 Adding some consistencies to the executable tests. All exe tests now pass on OpenBSD, although the only real problem was that ruby was in /usr/local/bin. dccafc7 Updating Puppet to work with the new Facter b7974b5 Updated to version 0.10.0 - -0.10.0 -====== -8458a0d Adding 0.10.0 release tag 48031dd Describing 0.10.0 changes 48ba030 Modifying hosttest f00a7db All tests pass now, although the lack of service support on os x means that i have now disabled services on it @@ -5532,10 +5384,6 @@ e611f2c adding some better readme stuff b532a30 adding things to the change log, and modifying the order of the steps 584652c Disabling most documentation generation except for the API docs, and wrapping the StatusServer in the xmlrpc check 0e0fdac Updated to version 0.9.3 - -0.9.3 -===== -d4a9f3e Adding release tag e2e2fb3 some updates to the typegen stuff, even though i may still not use it 5302921 Fixing two reported bugs in cron jobs. Cron jobs correctly change when fields other than the command are updated, and they do not continually refresh when the command has trailing spaces 592c24d adding some comments diff --git a/conf/suse/puppet.spec b/conf/suse/puppet.spec index bd4b35885..777f6a4b6 100644 --- a/conf/suse/puppet.spec +++ b/conf/suse/puppet.spec @@ -4,23 +4,20 @@ Summary: A network tool for managing many disparate systems Name: puppet -Version: 2.6.0 +Version: 2.6.1 Release: 1%{?dist} License: GPL Group: Productivity/Networking/System URL: http://puppetlabs.com/projects/puppet/ Source0: http://puppetlabs.com/downloads/puppet/%{name}-%{version}.tar.gz -Source1: client.init -Source2: server.init -Patch0: ruby-env.patch PreReq: %{insserv_prereq} %{fillup_prereq} Requires: ruby >= 1.8.2 Requires: facter >= 1.5 Requires: cron BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: ruby >= 1.8.7 +BuildRequires: ruby >= 1.8.2 %description Puppet lets you centrally manage every important aspect of your system using a @@ -39,11 +36,10 @@ The server can also function as a certificate authority and file server. %prep %setup -q -%patch0 -p0 %build -for f in bin/* ; do - sed -i -e '1c#!/usr/bin/ruby' $f +for f in bin/* sbin/*; do + sed -i -e '1s,^#!.*ruby$,#!/usr/bin/ruby,' $f done %install @@ -63,16 +59,16 @@ done find %{buildroot}%{ruby_sitelibdir} -type f -perm +ugo+x -exec chmod a-x '{}' \; %{__cp} -a %{pbuild}/conf/redhat/client.sysconfig %{buildroot}%{_confdir}/client.sysconfig %{__install} -Dp -m0644 %{buildroot}%{_confdir}/client.sysconfig %{buildroot}/var/adm/fillup-templates/sysconfig.puppet -%{__install} -Dp -m0755 %SOURCE1 %{buildroot}%{_initrddir}/puppet %{__cp} -a %{pbuild}/conf/redhat/server.sysconfig %{buildroot}%{_confdir}/server.sysconfig %{__install} -Dp -m0644 %{buildroot}%{_confdir}/server.sysconfig %{buildroot}/var/adm/fillup-templates/sysconfig.puppetmaster -%{__install} -Dp -m0755 %SOURCE2 %{buildroot}%{_initrddir}/puppetmaster %{__cp} -a %{pbuild}/conf/redhat/fileserver.conf %{buildroot}%{_confdir}/fileserver.conf %{__install} -Dp -m0644 %{buildroot}%{_confdir}/fileserver.conf %{buildroot}%{_sysconfdir}/puppet/fileserver.conf %{__cp} -a %{pbuild}/conf/redhat/puppet.conf %{buildroot}%{_confdir}/puppet.conf %{__install} -Dp -m0644 %{buildroot}%{_confdir}/puppet.conf %{buildroot}%{_sysconfdir}/puppet/puppet.conf %{__cp} -a %{pbuild}/conf/redhat/logrotate %{buildroot}%{_confdir}/logrotate %{__install} -Dp -m0644 %{buildroot}%{_confdir}/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/puppet +%{__install} -Dp -m0755 %{confdir}/client.init %{buildroot}%{_initrddir}/puppet +%{__install} -Dp -m0755 %{confdir}/server.init %{buildroot}%{_initrddir}/puppetmaster %{__ln_s} %{_initrddir}/puppet %{buildroot}%{_sbindir}/rcpuppet %{__ln_s} %{_initrddir}/puppetmaster %{buildroot}%{_sbindir}/rcpuppetmaster @@ -140,6 +136,13 @@ find %{buildroot}%{ruby_sitelibdir} -type f -perm +ugo+x -exec chmod a-x '{}' \; %{__rm} -rf %{buildroot} %changelog +* Tue Sep 14 2010 Ben Kevan <ben.kevan@gmail.com> - 2.6.1 +- New version to 2.6.1 +- Add client.init and server.init from source since it's now included in the packages +- Change BuildRequires Ruby version to match Requires Ruby version +- Removed ruby-env patch, replaced with sed in prep +- Update urls to puppetlabs.com + * Wed Jul 21 2010 Ben Kevan <ben.kevan@gmail.com> - 2.6.0 - New version and ruby version bump - Add puppetdoc to %_bindir (unknown why original suse package, excluded or forgot to add) diff --git a/conf/suse/ruby-env.patch b/conf/suse/ruby-env.patch deleted file mode 100644 index 0a7a8a748..000000000 --- a/conf/suse/ruby-env.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- sbin/puppetd 2010-07-18 14:17:38.000000000 -0700 -+++ sbin/puppetd 2010-07-21 17:31:57.057138615 -0700 -@@ -1,4 +1,4 @@ --#!/usr/bin/env ruby -+#!/usr/bin/ruby - - require 'puppet/application/agent' - Puppet::Application[:agent].run - ---- sbin/puppetmasterd 2010-07-18 14:17:38.000000000 -0700 -+++ sbin/puppetmasterd 2010-07-21 17:32:10.178513969 -0700 -@@ -1,4 +1,4 @@ --#!/usr/bin/env ruby -+#!/usr/bin/ruby - - require 'puppet/application/master' - Puppet::Application[:master].run diff --git a/lib/puppet.rb b/lib/puppet.rb index 18c1e8cbd..0a90cf50c 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -24,7 +24,7 @@ require 'puppet/util/run_mode' # it's also a place to find top-level commands like 'debug' module Puppet - PUPPETVERSION = '2.6.1' + PUPPETVERSION = '2.6.2' def Puppet.version PUPPETVERSION diff --git a/lib/puppet/external/event-loop/event-loop.rb b/lib/puppet/external/event-loop/event-loop.rb index dc51a55ae..3b40f6e71 100644 --- a/lib/puppet/external/event-loop/event-loop.rb +++ b/lib/puppet/external/event-loop/event-loop.rb @@ -75,8 +75,10 @@ class EventLoop @notify_src, @notify_snk = IO.pipe # prevent file descriptor leaks - @notify_src.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) - @notify_snk.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + if @notify_src.respond_to?(:fcntl) and defined?(Fcntl) and defined?(Fcntl::F_SETFD) and defined?(Fcntl::FD_CLOEXEC) + @notify_src.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + @notify_snk.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + end @notify_src.will_block = false @notify_snk.will_block = false @@ -234,19 +236,21 @@ class IO end def will_block? - require "fcntl" - fcntl(Fcntl::F_GETFL, 0) & Fcntl::O_NONBLOCK == 0 + if respond_to?(:fcntl) and defined?(Fcntl) and defined?(Fcntl::F_GETFL) and defined?(Fcntl::O_NONBLOCK) + fcntl(Fcntl::F_GETFL, 0) & Fcntl::O_NONBLOCK == 0 + end end def will_block= (wants_blocking) - require "fcntl" - flags = fcntl(Fcntl::F_GETFL, 0) - if wants_blocking - flags &= ~Fcntl::O_NONBLOCK - else - flags |= Fcntl::O_NONBLOCK + if respond_to?(:fcntl) and defined?(Fcntl) and defined?(Fcntl::F_GETFL) and defined?(Fcntl::O_NONBLOCK) + flags = fcntl(Fcntl::F_GETFL, 0) + if wants_blocking + flags &= ~Fcntl::O_NONBLOCK + else + flags |= Fcntl::O_NONBLOCK + end + fcntl(Fcntl::F_SETFL, flags) end - fcntl(Fcntl::F_SETFL, flags) end end diff --git a/lib/puppet/network/http/webrick/rest.rb b/lib/puppet/network/http/webrick/rest.rb index 91008aa1a..d5c146d88 100644 --- a/lib/puppet/network/http/webrick/rest.rb +++ b/lib/puppet/network/http/webrick/rest.rb @@ -1,5 +1,6 @@ require 'puppet/network/http/handler' require 'resolv' +require 'webrick' class Puppet::Network::HTTP::WEBrickREST < WEBrick::HTTPServlet::AbstractServlet diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index a3b055572..7d227b4d4 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -58,18 +58,6 @@ module Puppet::Network::HttpPool http.cert = ssl_host.certificate.content http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.key = ssl_host.key.content - http.verify_callback = self.method(:ssl_verify_callback).to_proc if Puppet[:debug] - end - - def self.ssl_verify_callback(peer_ok, x509_store_ctx) - if not peer_ok - Puppet.debug "OpenSSL: Error(#{x509_store_ctx.error}): #{x509_store_ctx.error_string}" - Puppet.debug "OpenSSL: Cert: #{x509_store_ctx.current_cert.issuer}" - Puppet.debug "OpenSSL: Current CRL: #{x509_store_ctx.current_crl}" - Puppet.debug "OpenSSL: Chain:" - x509_store_ctx.chain.each_index { |i| Puppet.debug "OpenSSL: \t#{i} #{x509_store_ctx.chain[i].issuer}" } - end - peer_ok end # Retrieve a cached http instance if caching is enabled, else return diff --git a/lib/puppet/parser/functions/extlookup.rb b/lib/puppet/parser/functions/extlookup.rb index 63d49e563..bc55410b9 100644 --- a/lib/puppet/parser/functions/extlookup.rb +++ b/lib/puppet/parser/functions/extlookup.rb @@ -52,7 +52,7 @@ the exact same outcome: $snmp_contact = extlookup(\"snmp_contact\") -The obove code shows some other features, you can use any fact or variable that +The above code shows some other features, you can use any fact or variable that is in scope by simply using %{varname} in your data files, you can return arrays by just having multiple values in the csv after the initial variable name. diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index a25a17e3f..9036d652e 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -520,7 +520,7 @@ class Puppet::Parser::Lexer def slurpstring(terminators,escapes=%w{ \\ $ ' " n t s }+["\n"],ignore_invalid_escapes=false) # we search for the next quote that isn't preceded by a # backslash; the caret is there to match empty strings - str = @scanner.scan_until(/([^\\]|^)[#{terminators}]/) or lex_error "Unclosed quote after '#{last}' in '#{rest}'" + str = @scanner.scan_until(/([^\\]|^|[^\\])([\\]{2})*[#{terminators}]/) or lex_error "Unclosed quote after '#{last}' in '#{rest}'" @line += str.count("\n") # literal carriage returns add to the line count. str.gsub!(/\\(.)/) { ch = $1 diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index e34f284fc..c007d4dbe 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -64,6 +64,7 @@ class Puppet::Parser::Resource < Puppet::Resource # Retrieve the associated definition and evaluate it. def evaluate + return if evaluated? @evaluated = true if klass = resource_type and ! builtin_type? finish diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb index 7339b646e..9830fab54 100644 --- a/lib/puppet/provider/nameservice.rb +++ b/lib/puppet/provider/nameservice.rb @@ -165,6 +165,7 @@ class Puppet::Provider::NameService < Puppet::Provider begin execute(self.addcmd) + execute(self.passcmd) if self.feature? :manages_password_age rescue Puppet::ExecutionFailure => detail raise Puppet::Error, "Could not create #{@resource.class.name} #{@resource.name}: #{detail}" end diff --git a/lib/puppet/provider/nameservice/objectadd.rb b/lib/puppet/provider/nameservice/objectadd.rb index 80c142982..dbb9f306f 100644 --- a/lib/puppet/provider/nameservice/objectadd.rb +++ b/lib/puppet/provider/nameservice/objectadd.rb @@ -13,7 +13,8 @@ class ObjectAdd < Puppet::Provider::NameService end def modifycmd(param, value) - cmd = [command(:modify), flag(param), value] + cmd = [command(param.to_s =~ /password_.+_age/ ? :password : :modify)] + cmd << flag(param) << value if @resource.allowdupe? && ((param == :uid) || (param == :gid and self.class.name == :groupadd)) cmd << "-o" end diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index 970359539..b296e0a38 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -38,6 +38,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do commands :launchctl => "/bin/launchctl" commands :sw_vers => "/usr/bin/sw_vers" + commands :plutil => "/usr/bin/plutil" defaultfor :operatingsystem => :darwin confine :operatingsystem => :darwin @@ -52,6 +53,12 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do Launchd_Overrides = "/var/db/launchd.db/com.apple.launchd/overrides.plist" + # Read a plist, whether its format is XML or in Apple's "binary1" + # format. + def self.read_plist(path) + Plist::parse_xml(plutil('-convert', 'xml1', '-o', '-', path)) + end + # returns a label => path map for either all jobs, or just a single # job if the label is specified def self.jobsearch(label=nil) @@ -62,8 +69,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do next if f =~ /^\..*$/ next if FileTest.directory?(f) fullpath = File.join(path, f) - job = Plist::parse_xml(fullpath) - if job and job.has_key?("Label") + if FileTest.file?(fullpath) and job = read_plist(fullpath) and job.has_key?("Label") if job["Label"] == label return { label => fullpath } else @@ -118,8 +124,11 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do def plist_from_label(label) job = self.class.jobsearch(label) job_path = job[label] - job_plist = Plist::parse_xml(job_path) - raise Puppet::Error.new("Unable to parse launchd plist at path: #{job_path}") if not job_plist + if FileTest.file?(job_path) + job_plist = self.class.read_plist(job_path) + else + raise Puppet::Error.new("Unable to parse launchd plist at path: #{job_path}") + end [job_path, job_plist] end @@ -200,9 +209,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do job_plist_disabled = job_plist["Disabled"] if job_plist.has_key?("Disabled") if self.class.get_macosx_version_major == "10.6": - overrides = Plist::parse_xml(Launchd_Overrides) - - unless overrides.nil? + if FileTest.file?(Launchd_Overrides) and overrides = self.class.read_plist(Launchd_Overrides) if overrides.has_key?(resource[:name]) overrides_disabled = overrides[resource[:name]]["Disabled"] if overrides[resource[:name]].has_key?("Disabled") end @@ -227,7 +234,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do # versions this is stored in the job plist itself. def enable if self.class.get_macosx_version_major == "10.6" - overrides = Plist::parse_xml(Launchd_Overrides) + overrides = self.class.read_plist(Launchd_Overrides) overrides[resource[:name]] = { "Disabled" => false } Plist::Emit.save_plist(overrides, Launchd_Overrides) else @@ -242,7 +249,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do def disable if self.class.get_macosx_version_major == "10.6" - overrides = Plist::parse_xml(Launchd_Overrides) + overrides = self.class.read_plist(Launchd_Overrides) overrides[resource[:name]] = { "Disabled" => true } Plist::Emit.save_plist(overrides, Launchd_Overrides) else diff --git a/lib/puppet/provider/user/hpux.rb b/lib/puppet/provider/user/hpux.rb index 50506c4cd..983970935 100644 --- a/lib/puppet/provider/user/hpux.rb +++ b/lib/puppet/provider/user/hpux.rb @@ -26,5 +26,4 @@ Puppet::Type.type(:user).provide :hpuxuseradd, :parent => :useradd do def modifycmd(param,value) super.insert(1,"-F") end - end diff --git a/lib/puppet/provider/user/user_role_add.rb b/lib/puppet/provider/user/user_role_add.rb index c13125925..7e7ad78e5 100644 --- a/lib/puppet/provider/user/user_role_add.rb +++ b/lib/puppet/provider/user/user_role_add.rb @@ -6,13 +6,15 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source => defaultfor :operatingsystem => :solaris - commands :add => "useradd", :delete => "userdel", :modify => "usermod", :role_add => "roleadd", :role_delete => "roledel", :role_modify => "rolemod" + commands :add => "useradd", :delete => "userdel", :modify => "usermod", :password => "chage", :role_add => "roleadd", :role_delete => "roledel", :role_modify => "rolemod" options :home, :flag => "-d", :method => :dir options :comment, :method => :gecos options :groups, :flag => "-G" options :roles, :flag => "-R" options :auths, :flag => "-A" options :profiles, :flag => "-P" + options :password_min_age, :flag => "-m" + options :password_max_age, :flag => "-M" verify :gid, "GID must be an integer" do |value| value.is_a? Integer @@ -22,14 +24,14 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source => value !~ /\s/ end - has_features :manages_homedir, :allows_duplicates, :manages_solaris_rbac, :manages_passwords + has_features :manages_homedir, :allows_duplicates, :manages_solaris_rbac, :manages_passwords, :manages_password_age #must override this to hand the keyvalue pairs def add_properties cmd = [] Puppet::Type.type(:user).validproperties.each do |property| #skip the password because we can't create it with the solaris useradd - next if [:ensure, :password].include?(property) + next if [:ensure, :password, :password_min_age, :password_max_age].include?(property) # 1680 Now you can set the hashed passwords on solaris:lib/puppet/provider/user/user_role_add.rb # the value needs to be quoted, mostly because -c might # have spaces in it @@ -79,6 +81,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source => run(transition("normal"), "transition role to") else run(addcmd, "create") + run(passcmd, "change password policy for") end # added to handle case when password is specified self.password = @resource[:password] if @resource[:password] @@ -140,14 +143,23 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source => run([command(:modify)] + build_keys_cmd(keys_hash) << @resource[:name], "modify attribute key pairs") end - #Read in /etc/shadow, find the line for this user (skipping comments, because who knows) and return the hashed pw (the second entry) + #Read in /etc/shadow, find the line for this user (skipping comments, because who knows) and return it #No abstraction, all esoteric knowledge of file formats, yay + def shadow_entry + return @shadow_entry if defined? @shadow_entry + @shadow_entry = File.readlines("/etc/shadow").reject { |r| r =~ /^[^\w]/ }.collect { |l| l.chomp.split(':') }.find { |user, _| user == @resource[:name] } + end + def password - #got perl? - if ary = File.readlines("/etc/shadow").reject { |r| r =~ /^[^\w]/}.collect { |l| l.split(':')[0..1] }.find { |user, passwd| user == @resource[:name] } - pass = ary[1] - end - pass + shadow_entry[1] if shadow_entry + end + + def min_age + shadow_entry ? shadow_entry[3] : :absent + end + + def max_age + shadow_entry ? shadow_entry[4] : :absent end #Read in /etc/shadow, find the line for our used and rewrite it with the new pw diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index 7ef217d9e..9a62db464 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -3,11 +3,13 @@ require 'puppet/provider/nameservice/objectadd' Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameService::ObjectAdd do desc "User management via `useradd` and its ilk. Note that you will need to install the `Shadow Password` Ruby library often known as ruby-libshadow to manage user passwords." - commands :add => "useradd", :delete => "userdel", :modify => "usermod" + commands :add => "useradd", :delete => "userdel", :modify => "usermod", :password => "chage" options :home, :flag => "-d", :method => :dir options :comment, :method => :gecos options :groups, :flag => "-G" + options :password_min_age, :flag => "-m" + options :password_max_age, :flag => "-M" verify :gid, "GID must be an integer" do |value| value.is_a? Integer @@ -17,9 +19,9 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ value !~ /\s/ end - has_features :manages_homedir, :allows_duplicates + has_features :manages_homedir, :allows_duplicates, :manages_expiry - has_feature :manages_passwords if Puppet.features.libshadow? + has_features :manages_passwords, :manages_password_age if Puppet.features.libshadow? def check_allow_dup @resource.allowdupe? ? ["-o"] : [] @@ -35,10 +37,20 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ cmd end + def check_manage_expiry + cmd = [] + if @resource[:expiry] + cmd << "-e #{@resource[:expiry]}" + end + + cmd + end + def add_properties cmd = [] Puppet::Type.type(:user).validproperties.each do |property| next if property == :ensure + next if property.to_s =~ /password_.+_age/ # the value needs to be quoted, mostly because -c might # have spaces in it if value = @resource.should(property) and value != "" @@ -53,9 +65,38 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ cmd += add_properties cmd += check_allow_dup cmd += check_manage_home + cmd += check_manage_expiry cmd << @resource[:name] end + def passcmd + cmd = [command(:password)] + [:password_min_age, :password_max_age].each do |property| + if value = @resource.should(property) + cmd << flag(property) << value + end + end + cmd << @resource[:name] + end + + def min_age + if Puppet.features.libshadow? + if ent = Shadow::Passwd.getspnam(@resource.name) + return ent.sp_min + end + end + :absent + end + + def max_age + if Puppet.features.libshadow? + if ent = Shadow::Passwd.getspnam(@resource.name) + return ent.sp_max + end + end + :absent + end + # Retrieve the password using the Shadow Password library def password if Puppet.features.libshadow? diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb index 2357e233e..517fa8f03 100644 --- a/lib/puppet/reports/rrdgraph.rb +++ b/lib/puppet/reports/rrdgraph.rb @@ -122,7 +122,7 @@ Puppet::Reports.register_report(:rrdgraph) do # that means we record the total time, the config time, and that's about # it. We should probably send each type's time as a separate metric. def timeclean(metric) - metric.values = metric.values.find_all { |name, label, value| [:total, :config_retrieval].include?(name) } + metric.values = metric.values.find_all { |name, label, value| ['total', 'config_retrieval'].include?(name.to_s) } end end diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index 007b760bc..c8110bb69 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -24,9 +24,16 @@ module Puppet "The provider can modify user passwords, by accepting a password hash." + feature :manages_password_age, + "The provider can set age requirements and restrictions for + passwords." + feature :manages_solaris_rbac, "The provider can manage roles and normal users" + feature :manages_expiry, + "The provider can manage the expiry date for a user." + newproperty(:ensure, :parent => Puppet::Property::Ensure) do newvalue(:present, :event => :user_created) do provider.create @@ -157,6 +164,43 @@ module Puppet end end + newproperty(:password_min_age, :required_features => :manages_password_age) do + desc "The minimum amount of time in days a password must be used before it may be changed" + + munge do |value| + case value + when String + Integer(value) + else + value + end + end + + validate do |value| + if value.to_s !~ /^\d+$/ + raise ArgumentError, "Password minimum age must be provided as a number" + end + end + end + + newproperty(:password_max_age, :required_features => :manages_password_age) do + desc "The maximum amount of time in days a password may be used before it must be changed" + + munge do |value| + case value + when String + Integer(value) + else + value + end + end + + validate do |value| + if value.to_s !~ /^\d+$/ + raise ArgumentError, "Password maximum age must be provided as a number" + end + end + end newproperty(:groups, :parent => Puppet::Property::List) do desc "The groups of which the user is a member. The primary @@ -210,6 +254,17 @@ module Puppet end end + newproperty(:expiry, :required_features => :manages_expiry) do + desc "The expiry date for this user. Must be provided in + a zero padded YYYY-MM-DD format - e.g 2010-02-19." + + validate do |value| + if value !~ /^\d{4}-\d{2}-\d{2}$/ + raise ArgumentError, "Expiry dates must be YYYY-MM-DD" + end + end + end + # Autorequire the group, if it's around autorequire(:group) do autos = [] diff --git a/lib/puppet/util/zaml.rb b/lib/puppet/util/zaml.rb index b60e639ff..ae4da8612 100644 --- a/lib/puppet/util/zaml.rb +++ b/lib/puppet/util/zaml.rb @@ -242,7 +242,6 @@ class String when self =~ /\n/ if self[-1..-1] == "\n" then z.emit('|+') else z.emit('|-') end z.nested { split("\n",-1).each { |line| z.nl; z.emit(line.chomp("\n")) } } - z.nl else z.emit(self) end diff --git a/spec/fixtures/yaml/report0.25.x.yaml b/spec/fixtures/yaml/report0.25.x.yaml new file mode 100644 index 000000000..ce6a64286 --- /dev/null +++ b/spec/fixtures/yaml/report0.25.x.yaml @@ -0,0 +1,64 @@ +--- !ruby/object:Puppet::Transaction::Report + host: mattmac.local + logs: + - !ruby/object:Puppet::Util::Log + level: !ruby/sym info + message: Applying configuration version '1285283846' + source: Puppet + tags: + - info + time: 2010-09-23 16:17:26.977750 -07:00 + metrics: + time: !ruby/object:Puppet::Util::Metric + label: Time + name: time + values: + - - !ruby/sym config_retrieval + - Config retrieval + - 0.955046892166138 + - - !ruby/sym schedule + - Schedule + - 0.00123691558837891 + - - !ruby/sym total + - Total + - 0.956486701965332 + - - !ruby/sym filebucket + - Filebucket + - 0.00020289421081543 + resources: !ruby/object:Puppet::Util::Metric + label: Resources + name: resources + values: + - - !ruby/sym skipped + - Skipped + - 0 + - - !ruby/sym scheduled + - Scheduled + - 7 + - - !ruby/sym applied + - Applied + - 0 + - - !ruby/sym restarted + - Restarted + - 0 + - - !ruby/sym total + - Total + - 10 + - - !ruby/sym failed_restarts + - Failed restarts + - 0 + - - !ruby/sym out_of_sync + - Out of sync + - 0 + - - !ruby/sym failed + - Failed + - 0 + changes: !ruby/object:Puppet::Util::Metric + label: Changes + name: changes + values: + - - !ruby/sym total + - Total + - 0 + records: {} + time: 2010-09-23 16:17:26.987789 -07:00
\ No newline at end of file diff --git a/spec/fixtures/yaml/report2.6.x.yaml b/spec/fixtures/yaml/report2.6.x.yaml new file mode 100644 index 000000000..dd4c3814e --- /dev/null +++ b/spec/fixtures/yaml/report2.6.x.yaml @@ -0,0 +1,190 @@ +--- !ruby/object:Puppet::Transaction::Report + external_times: + !ruby/sym config_retrieval: 0.170313835144043 + host: ubuntu1004desktop.localdomain + logs: + - !ruby/object:Puppet::Util::Log + level: !ruby/sym debug + message: Using cached certificate for ca + source: Puppet + tags: + - debug + time: 2010-09-23 15:44:06.244173 -07:00 + version: &id001 2.6.1 + - !ruby/object:Puppet::Util::Log + level: !ruby/sym debug + message: Using cached certificate for ubuntu1004desktop.localdomain + source: Puppet + tags: + - debug + time: 2010-09-23 15:44:06.244764 -07:00 + version: *id001 + - !ruby/object:Puppet::Util::Log + level: !ruby/sym debug + message: Using cached certificate_revocation_list for ca + source: Puppet + tags: + - debug + time: 2010-09-23 15:44:06.245677 -07:00 + version: *id001 + - !ruby/object:Puppet::Util::Log + level: !ruby/sym debug + message: "catalog supports formats: b64_zlib_yaml dot marshal pson raw yaml; using pson" + source: Puppet + tags: + - debug + time: 2010-09-23 15:44:06.247069 -07:00 + version: *id001 + - !ruby/object:Puppet::Util::Log + level: !ruby/sym info + message: Caching catalog for ubuntu1004desktop.localdomain + source: Puppet + tags: + - info + time: 2010-09-23 15:44:06.409109 -07:00 + version: *id001 + - !ruby/object:Puppet::Util::Log + level: !ruby/sym debug + message: Creating default schedules + source: Puppet + tags: + - debug + time: 2010-09-23 15:44:06.418755 -07:00 + version: *id001 + - !ruby/object:Puppet::Util::Log + level: !ruby/sym debug + message: Loaded state in 0.00 seconds + source: Puppet + tags: + - debug + time: 2010-09-23 15:44:06.427441 -07:00 + version: *id001 + - !ruby/object:Puppet::Util::Log + level: !ruby/sym info + message: Applying configuration version '1285281846' + source: Puppet + tags: + - info + time: 2010-09-23 15:44:06.429532 -07:00 + version: *id001 + metrics: + time: !ruby/object:Puppet::Util::Metric + label: Time + name: time + values: + - - config_retrieval + - Config retrieval + - 0.170313835144043 + - - schedule + - Schedule + - 0.00077 + - - filebucket + - Filebucket + - 0.000166 + resources: !ruby/object:Puppet::Util::Metric + label: Resources + name: resources + values: + - - !ruby/sym total + - Total + - 7 + events: !ruby/object:Puppet::Util::Metric + label: Events + name: events + values: + - - !ruby/sym total + - Total + - 0 + changes: !ruby/object:Puppet::Util::Metric + label: Changes + name: changes + values: + - - !ruby/sym total + - Total + - 0 + resource_statuses: + "Schedule[monthly]": !ruby/object:Puppet::Resource::Status + evaluation_time: 0.000121 + events: [] + file: + line: + resource: "Schedule[monthly]" + source_description: "/Schedule[monthly]" + tags: + - schedule + - monthly + time: 2010-09-23 15:44:06.430577 -07:00 + version: 1285281846 + "Filebucket[puppet]": !ruby/object:Puppet::Resource::Status + evaluation_time: 0.000166 + events: [] + file: + line: + resource: "Filebucket[puppet]" + source_description: "/Filebucket[puppet]" + tags: + - filebucket + - puppet + time: 2010-09-23 15:44:06.430998 -07:00 + version: 1285281846 + "Schedule[never]": !ruby/object:Puppet::Resource::Status + evaluation_time: 0.000119 + events: [] + file: + line: + resource: "Schedule[never]" + source_description: "/Schedule[never]" + tags: + - schedule + - never + time: 2010-09-23 15:44:06.433034 -07:00 + version: 1285281846 + "Schedule[weekly]": !ruby/object:Puppet::Resource::Status + evaluation_time: 0.000118 + events: [] + file: + line: + resource: "Schedule[weekly]" + source_description: "/Schedule[weekly]" + tags: + - schedule + - weekly + time: 2010-09-23 15:44:06.431443 -07:00 + version: 1285281846 + "Schedule[puppet]": !ruby/object:Puppet::Resource::Status + evaluation_time: 0.000129 + events: [] + file: + line: + resource: "Schedule[puppet]" + source_description: "/Schedule[puppet]" + tags: + - schedule + - puppet + time: 2010-09-23 15:44:06.432626 -07:00 + version: 1285281846 + "Schedule[daily]": !ruby/object:Puppet::Resource::Status + evaluation_time: 0.000154 + events: [] + file: + line: + resource: "Schedule[daily]" + source_description: "/Schedule[daily]" + tags: + - schedule + - daily + time: 2010-09-23 15:44:06.430130 -07:00 + version: 1285281846 + "Schedule[hourly]": !ruby/object:Puppet::Resource::Status + evaluation_time: 0.000129 + events: [] + file: + line: + resource: "Schedule[hourly]" + source_description: "/Schedule[hourly]" + tags: + - schedule + - hourly + time: 2010-09-23 15:44:06.432185 -07:00 + version: 1285281846 + time: 2010-09-23 15:44:05.894401 -07:00
\ No newline at end of file diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb index df310ac07..f731692b3 100755 --- a/spec/integration/parser/compiler_spec.rb +++ b/spec/integration/parser/compiler_spec.rb @@ -27,6 +27,27 @@ describe Puppet::Parser::Compiler do @compiler.catalog.version.should == version end + it "should not create duplicate resources when a class is referenced both directly and indirectly by the node classifier (4792)" do + Puppet[:code] = <<-PP + class foo + { + notify { foo_notify: } + include bar + } + class bar + { + notify { bar_notify: } + } + PP + + @node.stubs(:classes).returns(['foo', 'bar']) + + catalog = Puppet::Parser::Compiler.compile(@node) + + catalog.resource("Notify[foo_notify]").should_not be_nil + catalog.resource("Notify[bar_notify]").should_not be_nil + end + describe "when resolving class references" do it "should favor local scope, even if there's an included class in topscope" do Puppet[:code] = <<-PP diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2fe0c36a3..b5b273857 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,6 +20,7 @@ module PuppetSpec FIXTURE_DIR = File.join(dir = File.expand_path(File.dirname(__FILE__)), "fixtures") unless defined?(FIXTURE_DIR) end +require 'spec/lib/puppet_spec/files' require 'monkey_patches/alias_should_to_must' require 'monkey_patches/add_confine_and_runnable_to_rspec_dsl' require 'monkey_patches/publicize_methods' diff --git a/spec/unit/indirector/node/active_record_spec.rb b/spec/unit/indirector/node/active_record_spec.rb index 6cc3f5132..3540ef738 100755 --- a/spec/unit/indirector/node/active_record_spec.rb +++ b/spec/unit/indirector/node/active_record_spec.rb @@ -3,7 +3,6 @@ require File.dirname(__FILE__) + '/../../../spec_helper' require 'puppet/node' -require 'spec/lib/puppet_spec/files.rb' describe "Puppet::Node::ActiveRecord" do include PuppetSpec::Files diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index b27980bf2..2d67bf357 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -30,6 +30,14 @@ describe Puppet::Parser::Lexer do @lexer.line.should == 10 end + + it "should not think the terminator is escaped, when preceeded by an even number of backslashes" do + @lexer.line = 10 + @lexer.string = "here\nis\nthe\nstring\\\\'with\nextra\njunk" + @lexer.slurpstring("'") + + @lexer.line.should == 13 + end end end diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb index 320ee3ace..43e4cba8e 100755 --- a/spec/unit/provider/service/launchd_spec.rb +++ b/spec/unit/provider/service/launchd_spec.rb @@ -98,19 +98,22 @@ describe provider_class do it "should return true if the job plist says disabled is true and the global overrides says disabled is false" do provider_class.stubs(:get_macosx_version_major).returns("10.6") @provider.stubs(:plist_from_label).returns(["foo", {"Disabled" => true}]) - Plist.stubs(:parse_xml).returns({@resource[:name] => {"Disabled" => false}}) + @provider.class.stubs(:read_plist).returns({@resource[:name] => {"Disabled" => false}}) + FileTest.expects(:file?).with(Launchd_Overrides).returns(true) @provider.enabled?.should == :true end it "should return false if the job plist says disabled is false and the global overrides says disabled is true" do provider_class.stubs(:get_macosx_version_major).returns("10.6") @provider.stubs(:plist_from_label).returns(["foo", {"Disabled" => false}]) - Plist.stubs(:parse_xml).returns({@resource[:name] => {"Disabled" => true}}) + @provider.class.stubs(:read_plist).returns({@resource[:name] => {"Disabled" => true}}) + FileTest.expects(:file?).with(Launchd_Overrides).returns(true) @provider.enabled?.should == :false end it "should return true if the job plist and the global overrides have no disabled keys" do provider_class.stubs(:get_macosx_version_major).returns("10.6") @provider.stubs(:plist_from_label).returns(["foo", {}]) - Plist.stubs(:parse_xml).returns({}) + @provider.class.stubs(:read_plist).returns({}) + FileTest.expects(:file?).with(Launchd_Overrides).returns(true) @provider.enabled?.should == :true end end @@ -182,7 +185,7 @@ describe provider_class do describe "when enabling the service on OS X 10.6" do it "should write to the global launchd overrides file once" do provider_class.stubs(:get_macosx_version_major).returns("10.6") - Plist.stubs(:parse_xml).returns({}) + @provider.class.stubs(:read_plist).returns({}) Plist::Emit.expects(:save_plist).once @provider.enable end @@ -191,7 +194,7 @@ describe provider_class do describe "when disabling the service on OS X 10.6" do it "should write to the global launchd overrides file once" do provider_class.stubs(:get_macosx_version_major).returns("10.6") - Plist.stubs(:parse_xml).returns({}) + @provider.class.stubs(:read_plist).returns({}) Plist::Emit.expects(:save_plist).once @provider.enable end diff --git a/spec/unit/provider/user/user_role_add_spec.rb b/spec/unit/provider/user/user_role_add_spec.rb index 211f4260a..b3244f19d 100644 --- a/spec/unit/provider/user/user_role_add_spec.rb +++ b/spec/unit/provider/user/user_role_add_spec.rb @@ -56,7 +56,7 @@ describe provider_class do it "should use the add command when the user is not a role" do @provider.stubs(:is_role?).returns(false) @provider.expects(:addcmd).returns("useradd") - @provider.expects(:run) + @provider.expects(:run).at_least_once @provider.create end @@ -66,6 +66,15 @@ describe provider_class do @provider.expects(:run) @provider.create end + + it "should set password age rules" do + @resource = Puppet::Type.type(:user).new :name => "myuser", :password_min_age => 5, :password_max_age => 10, :provider => :user_role_add + @provider = provider_class.new(@resource) + @provider.stubs(:user_attributes) + @provider.stubs(:execute) + @provider.expects(:execute).with { |cmd, *args| args == ["-m", 5, "-M", 10, "myuser"] } + @provider.create + end end describe "when calling destroy" do @@ -107,6 +116,7 @@ describe provider_class do before do @resource.expects(:allowdupe?).returns true @provider.stubs(:is_role?).returns(false) + @provider.stubs(:execute) @provider.expects(:execute).with { |args| args.include?("-o") } end @@ -246,4 +256,11 @@ describe provider_class do @provider.password=("hashedpassword") end end + + describe "#shadow_entry" do + it "should return the line for the right user" do + File.stubs(:readlines).returns(["someuser:!:10:5:20:7:1::\n", "fakeval:*:20:10:30:7:2::\n", "testuser:*:30:15:40:7:3::\n"]) + @provider.shadow_entry.should == ["fakeval", "*", "20", "10", "30", "7", "2"] + end + end end diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index 6eb9717b8..26367c584 100755 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -15,6 +15,7 @@ describe provider_class do # #1360 it "should add -o when allowdupe is enabled and the user is being created" do @resource.expects(:allowdupe?).returns true + @provider.stubs(:execute) @provider.expects(:execute).with { |args| args.include?("-o") } @provider.create end @@ -26,6 +27,15 @@ describe provider_class do @provider.uid = 150 end + it "should set password age rules" do + provider_class.has_feature :manages_password_age + @resource = Puppet::Type.type(:user).new :name => "myuser", :password_min_age => 5, :password_max_age => 10, :provider => :useradd + @provider = provider_class.new(@resource) + @provider.stubs(:execute) + @provider.expects(:execute).with { |cmd, *args| args == ["-m", 5, "-M", 10, "myuser"] } + @provider.create + end + describe "when checking to add allow dup" do it "should check allow dup" do @resource.expects(:allowdupe?) @@ -109,6 +119,15 @@ describe provider_class do @provider.stubs(:command).with(:add).returns("useradd") @provider.stubs(:add_properties).returns(["-G", "somegroup"]) @resource.stubs(:[]).with(:name).returns("someuser") + @resource.stubs(:[]).with(:expiry).returns("somedate") + @provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", '-e somedate', "someuser"] + end + + it "should return an array without -e if expery is undefined full command" do + @provider.stubs(:command).with(:add).returns("useradd") + @provider.stubs(:add_properties).returns(["-G", "somegroup"]) + @resource.stubs(:[]).with(:name).returns("someuser") + @resource.stubs(:[]).with(:expiry).returns nil @provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", "someuser"] end end diff --git a/spec/unit/reports/rrdgraph_spec.rb b/spec/unit/reports/rrdgraph_spec.rb new file mode 100644 index 000000000..ce2cf7905 --- /dev/null +++ b/spec/unit/reports/rrdgraph_spec.rb @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby + +Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") } + +require 'puppet/reports' + +processor = Puppet::Reports.report(:rrdgraph) + +describe processor do + include PuppetSpec::Files + before do + Puppet[:rrddir] = tmpdir('rrdgraph') + Puppet.settings.use :master + end + + after do + FileUtils.rm_rf(Puppet[:rrddir]) + end + + it "should not error on 0.25.x report format" do + report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report0.25.x.yaml')).extend processor + report.expects(:mkhtml) + lambda{ report.process }.should_not raise_error + end + + it "should not error on 2.6.x report format" do + report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml')).extend processor + report.expects(:mkhtml) + lambda{ report.process }.should_not raise_error + end +end diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb index 4c6eb1150..ccea9ee4c 100755 --- a/spec/unit/type/user_spec.rb +++ b/spec/unit/type/user_spec.rb @@ -35,6 +35,14 @@ describe user do user.provider_feature(:manages_solaris_rbac).should_not be_nil end + it "should have a manages_expiry feature" do + user.provider_feature(:manages_expiry).should_not be_nil + end + + it "should have a manages_password_age feature" do + user.provider_feature(:manages_password_age).should_not be_nil + end + describe "instances" do it "should have a valid provider" do user.new(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider) @@ -47,7 +55,7 @@ describe user do end end - properties = [:ensure, :uid, :gid, :home, :comment, :shell, :password, :groups, :roles, :auths, :profiles, :project, :keys] + properties = [:ensure, :uid, :gid, :home, :comment, :shell, :password, :password_min_age, :password_max_age, :groups, :roles, :auths, :profiles, :project, :keys, :expiry] properties.each do |property| it "should have a #{property} property" do @@ -227,6 +235,16 @@ describe user do end end + describe "when managing expiry" do + before do + @expiry = user.attrclass(:expiry).new(:resource => @resource) + end + + it "should fail if given an invalid date" do + lambda { @expiry.should = "200-20-20" }.should raise_error(Puppet::Error) + end + end + describe "when managing passwords" do before do @password = user.attrclass(:password).new(:resource => @resource, :should => "mypass") diff --git a/spec/unit/util/zaml_spec.rb b/spec/unit/util/zaml_spec.rb index 14cf94f36..b223f89d4 100644..100755 --- a/spec/unit/util/zaml_spec.rb +++ b/spec/unit/util/zaml_spec.rb @@ -11,7 +11,8 @@ describe "Pure ruby yaml implementation" do 'test' => "--- test", [] => "--- []", :symbol => "--- !ruby/sym symbol", - {:a => "A"} => "--- \n !ruby/sym a: A" + {:a => "A"} => "--- \n !ruby/sym a: A", + {:a => "x\ny"} => "--- \n !ruby/sym a: |-\n x\n y" }.each { |o,y| it "should convert the #{o.class} #{o.inspect} to yaml" do o.to_yaml.should == y |