diff options
| author | Michael Stahnke <stahnma@puppetlabs.com> | 2011-07-25 14:35:35 -0700 |
|---|---|---|
| committer | Michael Stahnke <stahnma@puppetlabs.com> | 2011-07-25 14:35:35 -0700 |
| commit | fc420008b75a482575250df4b8cd132fae061557 (patch) | |
| tree | eae97ce11910499e4ffa5c1fc31dde16edee4181 | |
| parent | d19fc2b34ddbb26c68edf6890588b771ec550cfd (diff) | |
| parent | e1a4fed4f3bda7f1b76d0f1c4173cfa884319728 (diff) | |
| download | puppet-fc420008b75a482575250df4b8cd132fae061557.tar.gz puppet-fc420008b75a482575250df4b8cd132fae061557.tar.xz puppet-fc420008b75a482575250df4b8cd132fae061557.zip | |
Merge branch '2.7rc' into 2.7.x
| -rw-r--r-- | CHANGELOG | 125 | ||||
| -rw-r--r-- | conf/redhat/puppet.spec | 50 | ||||
| -rw-r--r-- | conf/solaris/pkginfo | 2 | ||||
| -rw-r--r-- | conf/suse/puppet.spec | 7 | ||||
| -rw-r--r-- | lib/puppet.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/parser/functions/regsubst.rb | 26 | ||||
| -rw-r--r-- | lib/puppet/parser/functions/shellquote.rb | 26 | ||||
| -rw-r--r-- | lib/puppet/parser/functions/sprintf.rb | 26 | ||||
| -rw-r--r-- | lib/puppet/provider/package/pacman.rb | 94 | ||||
| -rw-r--r-- | lib/puppet/type/service.rb | 44 | ||||
| -rw-r--r-- | spec/unit/provider/package/pacman_spec.rb | 237 |
11 files changed, 604 insertions, 35 deletions
@@ -1,3 +1,128 @@ +2.7.2rc2 +=== +8ec0804 (#8301) Red Hat spec file for 2.7.2rc1 won't work +2263be6 (#5108) Update service type docs for new hasstatus default + +2.7.2rc1 +=== +902c414 Update configurer_spec.rb to work with Ruby 1.8.5 +7ad1b04 Clean up indentation, whitespace, and commented out code +014d952 Remove order dependency from functions integration spec +243aaa9 (#7956) Porting cron tests +3e3fc69 (#7956) Port resource acceptance tests +534ccfe (#8048) Gem install puppet no longer fails if rdoc enabled. +bbde5b5 Readying for release of 2.6.9 +5160822 Clean up indentation, whitespace, and commented out code +92a8f4a Remove order dependency from functions integration spec +31554c0 (#6854) Update Red Hat spec file +cba645c Bumping release in lib/puppet.rb and updating CHANGELOG. +43027de Bumping RPM spec file to 2.6.9rc1. +99330fa (#7224) Reword 'hostname was not match' error message +1d867b0 (#7224) Add a helper to Puppet::SSL::Certificate to retrieve alternate names +db1a392 (#7506) Organize READMEs; specify supported Ruby versions in README.md +de06469 (#5641) Help text: document that puppet doc takes modulepath, manifestdir, and environment options +381fa40 (#6418) Make test 64118 more portable +98ba407 (#7127) Stop puppet if a prerun command fails +6996e0b Do not needlessly create multiple reports when creating a transaction +caca469 (#4416) Ensure types are providified after reloading +413b136 (#4416) Always remove old provider before recreating it +d866ce1 Cleanup indentation, comment, and unused code +d1c965a Make temporary auth.conf in acceptance test readable by Puppet +4af9784 (#7117) Use a different auth.conf instead of overwriting the default +ecde134 (#3360) Delete SSL directory in acceptance test before running +b502423 Update acceptance tests to use with_master_running_on +053e613 Remove pending copy of an active acceptance test +98f58ce (#2128) Add WARNING for node_name_{fact,value} descriptions +1cd848c (#2128) Whitespace only reflow commit +d9b5c1a (#2128) In-line docs for node_name_{fact,value} +3f0dbb5 (#650) Allow symlinks for configuration directories +c260cf1 Fix acceptance tests not managing their masters +1c70f0c (#2128) Add support for setting node name based on a fact +c629958 (#2128) Get facts before retrieving catalog +cd4fe14 (#2128) Add the ability to specify a node name +8ebec1e (#7193) Fix path issues with acceptance tests that call old shell tests +16b2311 (#6885) puppet agent fingerprint requires --verbose to return a value. +77a5987 maint: Confine augeas specs to require the augeas feature +8eb0e16 (#2728) Add diff output for changes made by Augeas provider +a00fd25 maint: Refactor specs in preparation for making node name more flexible +2f8bc26 maint: Fix order dependent test failure +c02126d (#5966) Add support for hostname regular expressions in auth.conf +75e2764 (#5318) Always notice changes to manifests when compiling. +bc71266 maint: Fix order dependent spec failure for face indirection +6547835 (#7690) Don't blow up when listing terminuses available for faces +0bcbca5 maint: Dedup the loadpath so we don't have to walk it multiple times +4a5e99d (#7681) Add an acceptance test for resource refs with array variables +996dc07 Maint: Fix ellipses for short descriptions +53af6f3 (#7563) DRY: Remove indirector boilerplate from individual faces +74aff59 (#7564) Finish templates +3026333 (#7561) Complete help text for all faces and actions +13e473e Maint: Add ellipsis to generated short_descriptions. +89d447b (#6962) Add "arguments" method to help API +646919e (4123) Fix test for 4123/4 on old egrep in cent4 +b101804 add puppet master polling step for ticket 7117 +9145569 maint: Remove reliance on system clock from schedule spec tests +107b38a maint: Fix pacman provider to work with Ruby 1.9 +8eea3f5 Added the vcsrepo type and providers to the core +8f0cecf Added the vcsrepo type and providers to the core +4645c99 add puppet master polling step for ticket 7117 +17e7223 (#7507) Add exclude filter for ruby 1.9 spec failures +181098b (#7502) Fixed parser spec for ruby 1.8.5 +9c3bedd (#7507) Add more 1.9 filters +f037662 (#6395) Add extpuppet help, eval, and interfaces +4d4d587 Adding a sleep state post starting master +c81f5c6 Adding a sleep state post starting master +d1cc24f maint: fix spec_helper inclusions again. +3ac7aed (#7523) Refactor the grammar to reduce duplication +d22b130 (#7114) Fix specs for ssh authorized key parsed provider +551cb3e (#7114) Target returns correct value +15c6fc7 (#7114) Add integration tests for authorized_key +a5ac82a (#7114) Improve unit tests for ssh_authorized_key +1c7f0c3 (#7114) Improve value validation for authorized_key +0b8ebac (#7300) Fix instances method of mount provider +1dc662a (#1853) Pacman package provider +6bb2a85 (#1853) Pacman package provider +c8775f9 (#7259) Remove ActiveRecord requirement from indirector face spec +1ad8158 (#7259) Do not try to load all Terminus classes when configuring the Indirector +8b76be3 (#3836) External nodes should only capture stdout +d63fc34 Revert "(#7220) Add the ability to "inherit" options." +c21539f maint: sync 'authconfig' to 'rest_authconfig' setting +81d566f Fixed #7481 - Added MIT license to Thomas Bellman's function code +1695dac (#7264) Docs: Clarify that subscribe/notify imply require/before +8f907f2 adding test for ticket 7139 +90eb937 (#7139) Accept '/' as a valid path in filesets +1f3b8e7 (#7300) Add specs for the mount provider +1b2a7d9 case seems needless here as there is only two opts, also the rest of the file seems to use if so this should make things more consistant +729336e (#6845) Mount writes incorrect vfstab entries +16cf1ac (#6442) Be able to start agents --listen without namespaceauth.conf +e059539 Update CHANGELOG for 2.6.8 +ac0581f (#7101) Fix template error messages in Ruby 1.8.5 +9d2500e (#7101) Fix template error messages in Ruby 1.8.5 +0352402 (#3420) Nagios "name" attribute does not output correctly +f656818 (#4487) When setting environment on a host, ensure it is a string. +89e9a21 add test for ticket 7101 +74498af add test for ticket 7101 +2cce326 add test for ticket 7101 +c1edcb2 add test for ticket 7101 +9329a1f (#7220) Add the ability to "inherit" options. +c306db2 (#6487) Add some testing for OS X version support in DirectoryService provider +0008b63 (#6487) Directoryservice provider will fail in future OS releases +f21162b (#6368) Make the File type autorequire its nearest ancestor directory +c3a76a9 (#7021) Fix order dependent spec failures +7bd6a2f maint: Remove unused code +34f9f41 Maint: Fix a #4655 introduced log inconsistency +6981ee5 Maint: Fix a #4655 introduced log inconsistency +cb43cfc Moving tests from Puppet-acceptance repo +ac428b9 Move tests from Puppet-acceptance repo +db26326 Move tests from puppet-acceptance repo +6b18f8f Move acceptance tests from puppet-acceptance repo +9a5bf6e Fixed #7166 - Replaced deprecated stomp "send" method with "publish" +a18ac78 maint: Fix PSON order dependency in test +656eff8 (#4655) Allow stage to be set using a default class parameter +b3ab0d9 (#4655) Allow stage to be set using a default class parameter +7d3c303 Fixed #7166 - Replaced deprecated stomp "send" method with "publish" +7f658e6 vim: Initial ftplugin and indent support +ccbe9f3 Fixed #6681 - Remove --force-yes option from aptitude is used + 2.7.1 === a49d5b8 (#8048) Gem install puppet no longer fails if rdoc enabled. diff --git a/conf/redhat/puppet.spec b/conf/redhat/puppet.spec index 4581c486f..06a4b57b7 100644 --- a/conf/redhat/puppet.spec +++ b/conf/redhat/puppet.spec @@ -5,13 +5,13 @@ %global confdir conf/redhat Name: puppet -Version: 2.6.9 -Release: 1%{?dist} +Version: 2.7.2 +Release: 0.2.rc1%{?dist} Summary: A network tool for managing many disparate systems -License: Apache 2.0 +License: ASL 2.0 URL: http://puppetlabs.com Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz -#Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.asc +Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz.asc Group: System Environment/Base @@ -110,7 +110,7 @@ touch %{buildroot}%{_sysconfdir}/puppet/puppetmasterd.conf touch %{buildroot}%{_sysconfdir}/puppet/puppetca.conf touch %{buildroot}%{_sysconfdir}/puppet/puppetd.conf -# Install the ext/ directory to %{_datadir}/%{name} +# Install the ext/ directory to %%{_datadir}/%%{name} install -d %{buildroot}%{_datadir}/%{name} cp -a ext/ %{buildroot}%{_datadir}/%{name} # emacs and vim bits are installed elsewhere @@ -136,7 +136,7 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \ %files %defattr(-, root, root, 0755) -%doc CHANGELOG COPYING LICENSE README.md README.queueing examples +%doc CHANGELOG LICENSE README.md examples %{_bindir}/pi %{_bindir}/puppet %{_bindir}/ralsh @@ -172,6 +172,34 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \ %{_mandir}/man8/puppetd.8.gz %{_mandir}/man8/ralsh.8.gz %{_mandir}/man8/puppetdoc.8.gz +%{_mandir}/man8/puppet-agent.8.gz +%{_mandir}/man8/puppet-apply.8.gz +%{_mandir}/man8/puppet-catalog.8.gz +%{_mandir}/man8/puppet-describe.8.gz +%{_mandir}/man8/puppet-cert.8.gz +%{_mandir}/man8/puppet-certificate.8.gz +%{_mandir}/man8/puppet-certificate_request.8.gz +%{_mandir}/man8/puppet-certificate_revocation_list.8.gz +%{_mandir}/man8/puppet-config.8.gz +%{_mandir}/man8/puppet-device.8.gz +%{_mandir}/man8/puppet-doc.8.gz +%{_mandir}/man8/puppet-facts.8.gz +%{_mandir}/man8/puppet-file.8.gz +%{_mandir}/man8/puppet-filebucket.8.gz +%{_mandir}/man8/puppet-help.8.gz +%{_mandir}/man8/puppet-inspect.8.gz +%{_mandir}/man8/puppet-key.8.gz +%{_mandir}/man8/puppet-kick.8.gz +%{_mandir}/man8/puppet-man.8.gz +%{_mandir}/man8/puppet-node.8.gz +%{_mandir}/man8/puppet-parser.8.gz +%{_mandir}/man8/puppet-plugin.8.gz +%{_mandir}/man8/puppet-queue.8.gz +%{_mandir}/man8/puppet-report.8.gz +%{_mandir}/man8/puppet-resource.8.gz +%{_mandir}/man8/puppet-resource_type.8.gz +%{_mandir}/man8/puppet-secret_agent.8.gz +%{_mandir}/man8/puppet-status.8.gz %files server %defattr(-, root, root, 0755) @@ -187,6 +215,7 @@ echo "D /var/run/%{name} 0755 %{name} %{name} -" > \ %{_mandir}/man8/puppetmasterd.8.gz %{_mandir}/man8/puppetrun.8.gz %{_mandir}/man8/puppetqd.8.gz +%{_mandir}/man8/puppet-master.8.gz # Fixed uid/gid were assigned in bz 472073 (Fedora), 471918 (RHEL-5), # and 471919 (RHEL-4) @@ -253,6 +282,13 @@ fi rm -rf %{buildroot} %changelog +* Wed Jul 06 2011 Michael Stahnke <stahnma@puppetlabs.com> - 2.7.2-0.2.rc1 +- Clean up rpmlint errors +- Put man pages in correct package + +* Wed Jul 06 2011 Michael Stahnke <stahnma@puppetlabs.com> - 2.7.2-0.1.rc1 +- Update to 2.7.2rc1 + * Tue Jun 21 2011 Michael Stahnke <stahnma@puppetlabs.com> - 2.6.9-1 - Release of 2.6.9 @@ -323,7 +359,7 @@ rm -rf %{buildroot} - Update to 0.25.0 - Fix permissions on /var/log/puppet (#495096) - Install emacs mode and vim syntax files (#491437) -- Install ext/ directory in %%{_datadir}/%{name} (/usr/share/puppet) +- Install ext/ directory in %%{_datadir}/%%{name} (/usr/share/puppet) * Mon May 04 2009 Todd Zullinger <tmz@pobox.com> - 0.25.0-0.1.beta1 - Update to 0.25.0beta1 diff --git a/conf/solaris/pkginfo b/conf/solaris/pkginfo index 14a2f0a79..547f489fb 100644 --- a/conf/solaris/pkginfo +++ b/conf/solaris/pkginfo @@ -1,6 +1,6 @@ PKG=CSWpuppet NAME=puppet - System Automation Framework -VERSION=2.7.0 +VERSION=2.7.2 CATEGORY=application VENDOR=http://projects.puppetlabs.com/projects/puppet EMAIL=luke@puppetlabs.com diff --git a/conf/suse/puppet.spec b/conf/suse/puppet.spec index 2a5b9f4db..0613045ea 100644 --- a/conf/suse/puppet.spec +++ b/conf/suse/puppet.spec @@ -4,8 +4,8 @@ Summary: A network tool for managing many disparate systems Name: puppet -Version: 2.6.1 -Release: 1%{?dist} +Version: 2.7.2 +Release: 0.1rc1%{?dist} License: Apache 2.0 Group: Productivity/Networking/System @@ -136,6 +136,9 @@ find %{buildroot}%{ruby_sitelibdir} -type f -perm +ugo+x -exec chmod a-x '{}' \; %{__rm} -rf %{buildroot} %changelog +* Wed Jul 06 2011 Michael Stahnke <stahnma@puppetlabs.com> - 2.7.2-0.1rc1 +- Updating to 2.7.2rc1 + * 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 diff --git a/lib/puppet.rb b/lib/puppet.rb index c895da921..765c95cbf 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.7.1' + PUPPETVERSION = '2.7.2' def Puppet.version PUPPETVERSION diff --git a/lib/puppet/parser/functions/regsubst.rb b/lib/puppet/parser/functions/regsubst.rb index b6bb5afcf..397d2b2ee 100644 --- a/lib/puppet/parser/functions/regsubst.rb +++ b/lib/puppet/parser/functions/regsubst.rb @@ -1,3 +1,29 @@ +# Copyright (C) 2009 Thomas Bellman +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THOMAS BELLMAN BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of Thomas Bellman shall +# not be used in advertising or otherwise to promote the sale, use or +# other dealings in this Software without prior written authorization +# from Thomas Bellman. + module Puppet::Parser::Functions newfunction( diff --git a/lib/puppet/parser/functions/shellquote.rb b/lib/puppet/parser/functions/shellquote.rb index 3ddb988f2..ee070c740 100644 --- a/lib/puppet/parser/functions/shellquote.rb +++ b/lib/puppet/parser/functions/shellquote.rb @@ -1,3 +1,29 @@ +# Copyright (C) 2009 Thomas Bellman +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THOMAS BELLMAN BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of Thomas Bellman shall +# not be used in advertising or otherwise to promote the sale, use or +# other dealings in this Software without prior written authorization +# from Thomas Bellman. + module Puppet::Parser::Functions Safe = 'a-zA-Z0-9@%_+=:,./-' # Safe unquoted diff --git a/lib/puppet/parser/functions/sprintf.rb b/lib/puppet/parser/functions/sprintf.rb index 5eb4a4f9d..118020412 100644 --- a/lib/puppet/parser/functions/sprintf.rb +++ b/lib/puppet/parser/functions/sprintf.rb @@ -1,3 +1,29 @@ +# Copyright (C) 2009 Thomas Bellman +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THOMAS BELLMAN BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of Thomas Bellman shall +# not be used in advertising or otherwise to promote the sale, use or +# other dealings in this Software without prior written authorization +# from Thomas Bellman. + module Puppet::Parser::Functions newfunction( diff --git a/lib/puppet/provider/package/pacman.rb b/lib/puppet/provider/package/pacman.rb new file mode 100644 index 000000000..5e05d147e --- /dev/null +++ b/lib/puppet/provider/package/pacman.rb @@ -0,0 +1,94 @@ +require 'puppet/provider/package' + +Puppet::Type.type(:package).provide :pacman, :parent => Puppet::Provider::Package do + desc "Support for the Package Manager Utility (pacman) used in Archlinux." + + commands :pacman => "/usr/bin/pacman" + defaultfor :operatingsystem => :archlinux + confine :operatingsystem => :archlinux + has_feature :upgradeable + + # Install a package using 'pacman'. + # Installs quietly, without confirmation or progressbar, updates package + # list from servers defined in pacman.conf. + def install + pacman "--noconfirm", "--noprogressbar", "-Sy", @resource[:name] + + unless self.query + raise Puppet::ExecutionFailure.new("Could not find package %s" % self.name) + end + end + + def self.listcmd + [command(:pacman), " -Q"] + end + + # Fetch the list of packages currently installed on the system. + def self.instances + packages = [] + begin + execpipe(listcmd()) do |process| + # pacman -Q output is 'packagename version-rel' + regex = %r{^(\S+)\s(\S+)} + fields = [:name, :ensure] + hash = {} + + process.each_line { |line| + if match = regex.match(line) + fields.zip(match.captures) { |field,value| + hash[field] = value + } + + name = hash[:name] + hash[:provider] = self.name + + packages << new(hash) + hash = {} + else + warning("Failed to match line %s" % line) + end + } + end + rescue Puppet::ExecutionFailure + return nil + end + packages + end + + # Because Archlinux is a rolling release based distro, installing a package + # should always result in the newest release. + def update + # Install in pacman can be used for update, too + self.install + end + + def latest + pacman "-Sy" + output = pacman "-Sp", "--print-format", "%v", @resource[:name] + output.chomp + end + + # Querys the pacman master list for information about the package. + def query + begin + output = pacman("-Qi", @resource[:name]) + + if output =~ /Version.*:\s(.+)/ + return { :ensure => $1 } + end + rescue Puppet::ExecutionFailure + return { + :ensure => :purged, + :status => 'missing', + :name => @resource[:name], + :error => 'ok', + } + end + nil + end + + # Removes a package from the system. + def uninstall + pacman "--noconfirm", "--noprogressbar", "-R", @resource[:name] + end +end diff --git a/lib/puppet/type/service.rb b/lib/puppet/type/service.rb index 5a2c69b87..3116f5f8e 100644 --- a/lib/puppet/type/service.rb +++ b/lib/puppet/type/service.rb @@ -8,17 +8,15 @@ module Puppet newtype(:service) do @doc = "Manage running services. Service support unfortunately varies - widely by platform --- some platforms have very little if any - concept of a running service, and some have a very codified and - powerful concept. Puppet's service support will generally be able - to do the right thing regardless (e.g., if there is no - 'status' command, then Puppet will look in the process table for a - command matching the service name), but the more information you - can provide, the better behaviour you will get. In particular, any - virtual services that don't have a predictable entry in the process table - (for example, `network` on Red Hat/CentOS systems) will manifest odd - behavior on restarts if you don't specify `hasstatus` or a `status` - command. + widely by platform --- some platforms have very little if any concept of a + running service, and some have a very codified and powerful concept. + Puppet's service support is usually capable of doing the right thing, but + the more information you can provide, the better behaviour you will get. + + Puppet 2.7 and newer expect init scripts to have a working status command. + If this isn't the case for any of your services' init scripts, you will + need to set `hasstatus` to false and possibly specify a custom status + command in the `status` attribute. Note that if a `service` receives an event from another resource, the service will get restarted. The actual command to restart the @@ -93,19 +91,17 @@ module Puppet end newparam(:hasstatus) do - desc "Declare the the service's init script has a - functional status command. Based on testing, it was found - that a large number of init scripts on different platforms do - not support any kind of status command; thus, you must specify - manually whether the service you are running has such a - command. Alternately, you can provide a specific command using the - `status` attribute. - - If you specify neither of these, then Puppet will look for the - service name in the process table. Be aware that 'virtual' init - scripts such as networking will respond poorly to refresh events - (via notify and subscribe relationships) if you don't override - this default behavior." + desc "Declare whether the service's init script has a functional status + command; defaults to `true`. This attribute's default value changed in + Puppet 2.7.0. + + If a service's init script does not support any kind of status command, + you should set `hasstatus` to false and either provide a specific + command using the `status` attribute or expect that Puppet will look for + the service name in the process table. Be aware that 'virtual' init + scripts (like 'network' under Red Hat systems) will respond poorly to + refresh events from other resources if you override the default behavior + without providing a status command." newvalues(:true, :false) diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb new file mode 100644 index 000000000..679172621 --- /dev/null +++ b/spec/unit/provider/package/pacman_spec.rb @@ -0,0 +1,237 @@ +#!/usr/bin/env rspec +require 'spec_helper' + +provider = Puppet::Type.type(:package).provider(:pacman) + +describe provider do + before do + provider.stubs(:command).with(:pacman).returns('/usr/bin/pacman') + @resource = stub 'resource' + @resource.stubs(:[]).returns("package") + @resource.stubs(:name).returns("name") + @provider = provider.new(@resource) + end + + describe "when installing" do + before do + @provider.stubs(:query).returns({ + :ensure => '1.0' + }) + end + + it "should call pacman" do + provider. + expects(:execute). + at_least_once. + with { |args| + args[0] == "/usr/bin/pacman" + }. + returns "" + + @provider.install + end + + it "should be quiet" do + provider. + expects(:execute). + with { |args| + args[1,2] == ["--noconfirm", "--noprogressbar"] + }. + returns("") + + @provider.install + end + + it "should install the right package" do + provider. + expects(:execute). + with { |args| + args[3,4] == ["-Sy", @resource[0]] + }. + returns("") + + @provider.install + end + + it "should raise an ExecutionFailure if the installation failed" do + provider.stubs(:execute).returns("") + @provider.expects(:query).returns(nil) + + lambda { @provider.install }.should raise_exception(Puppet::ExecutionFailure) + end + end + + describe "when updating" do + it "should call install" do + @provider.expects(:install).returns("install return value") + @provider.update.should == "install return value" + end + end + + describe "when uninstalling" do + it "should call pacman" do + provider. + expects(:execute). + with { |args| + args[0] == "/usr/bin/pacman" + }. + returns "" + + @provider.uninstall + end + + it "should be quiet" do + provider. + expects(:execute). + with { |args| + args[1,2] == ["--noconfirm", "--noprogressbar"] + }. + returns("") + + @provider.uninstall + end + + it "should remove the right package" do + provider. + expects(:execute). + with { |args| + args[3,4] == ["-R", @resource[0]] + }. + returns("") + + @provider.uninstall + end + end + + describe "when querying" do + it "should query pacman" do + provider. + expects(:execute). + with(["/usr/bin/pacman", "-Qi", @resource[0]]) + @provider.query + end + + it "should return the version" do + query_output = <<EOF +Name : package +Version : 1.01.3-2 +URL : http://www.archlinux.org/pacman/ +Licenses : GPL +Groups : base +Provides : None +Depends On : bash libarchive>=2.7.1 libfetch>=2.25 pacman-mirrorlist +Optional Deps : fakeroot: for makepkg usage as normal user + curl: for rankmirrors usage +Required By : None +Conflicts With : None +Replaces : None +Installed Size : 2352.00 K +Packager : Dan McGee <dan@archlinux.org> +Architecture : i686 +Build Date : Sat 22 Jan 2011 03:56:41 PM EST +Install Date : Thu 27 Jan 2011 06:45:49 AM EST +Install Reason : Explicitly installed +Install Script : Yes +Description : A library-based package manager with dependency support +EOF + + provider.expects(:execute).returns(query_output) + @provider.query.should == {:ensure => "1.01.3-2"} + end + + it "should return a nil if the package isn't found" do + provider.expects(:execute).returns("") + @provider.query.should be_nil + end + + it "should return a hash indicating that the package is missing on error" do + provider.expects(:execute).raises(Puppet::ExecutionFailure.new("ERROR!")) + @provider.query.should == { + :ensure => :purged, + :status => 'missing', + :name => @resource[0], + :error => 'ok', + } + end + end + + describe "when fetching a package list" do + it "should query pacman" do + provider.expects(:execpipe).with(["/usr/bin/pacman", ' -Q']) + provider.instances + end + + it "should return installed packages with their versions" do + provider.expects(:execpipe).yields("package1 1.23-4\npackage2 2.00\n") + packages = provider.instances + + packages.length.should == 2 + + packages[0].properties.should == { + :provider => :pacman, + :ensure => '1.23-4', + :name => 'package1' + } + + packages[1].properties.should == { + :provider => :pacman, + :ensure => '2.00', + :name => 'package2' + } + end + + it "should return nil on error" do + provider.expects(:execpipe).raises(Puppet::ExecutionFailure.new("ERROR!")) + provider.instances.should be_nil + end + + it "should warn on invalid input" do + provider.expects(:execpipe).yields("blah") + provider.expects(:warning).with("Failed to match line blah") + provider.instances.should == [] + end + end + + describe "when determining the latest version" do + it "should refresh package list" do + refreshed = states('refreshed').starts_as('unrefreshed') + provider. + expects(:execute). + when(refreshed.is('unrefreshed')). + with(['/usr/bin/pacman', '-Sy']). + then(refreshed.is('refreshed')) + + provider. + stubs(:execute). + when(refreshed.is('refreshed')). + returns("") + + @provider.latest + end + + it "should get query pacman for the latest version" do + refreshed = states('refreshed').starts_as('unrefreshed') + provider. + stubs(:execute). + when(refreshed.is('unrefreshed')). + then(refreshed.is('refreshed')) + + provider. + expects(:execute). + when(refreshed.is('refreshed')). + with(['/usr/bin/pacman', '-Sp', '--print-format', '%v', @resource[0]]). + returns("") + + @provider.latest + end + + it "should return the version number from pacman" do + provider. + expects(:execute). + at_least_once(). + returns("1.00.2-3\n") + + @provider.latest.should == "1.00.2-3" + end + end +end |
