summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '2.7.x'Nick Lewis2011-08-244-16/+0
|\ | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/feature/base.rb lib/puppet/file_serving/configuration.rb spec/unit/indirector/ssl_file_spec.rb spec/unit/parser/functions/extlookup_spec.rb spec/unit/resource/catalog_spec.rb test/language/ast/variable.rb
| * Fix posix exec provider spec failures on WindowsNick Lewis2011-08-191-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These specs were assuming that paths such as /foo were always absolute, which is not the case on Windows. Thus, when run on Windows, the provider was complaining about receiving relative paths when it expected absolute, rather than succeeding or failing in the intended way. Now we expand all paths we want to be absolute, to guarantee they will be absolute everywhere. Also, some specs were failing because they were trying to test the case where a file isn't executable. That's not something we can reliably check on Windows, so instead just stub the appropriate executable? methods. Reviewed-By: Matt Robinson <matt@puppetlabs.com> (cherry picked from commit e9b558dd35eec6e221aef9de3f300a5843347454)
| * (#5495) Remove dead Windows-specific code from posix exec providerNick Lewis2011-08-191-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because this provider only applies when the posix feature is present (and thus not the windows feature), it can never be used on Windows. Thus, the Windows-specific command handling is unnecessary and unused. Also added more specific error messages for the cases where a command doesn't exist, isn't a file, and isn't executable. These only apply when the command path is absolute (otherwise the message is simply command not found). Reviewed-By: Matt Robinson <matt@puppetlabs.com> (cherry picked from commit b28bcb031346cfd2026361ec5ffb420c1dcf60d7) Conflicts: spec/unit/provider/exec/posix_spec.rb
| * (#8272) Add missing tests for Windows service provider methods.Cameron Thomas2011-08-191-5/+40
| | | | | | | | | | | | | | | | | | Added missing spec tests for Windows service provider methods: :stop, :enable, :disable, and :manual_start Refactored to match Nick's previous work. Reviewed By: Nick Lewis [nick@puppetlabs.com] (cherry picked from commit d08ae7fd2180c95d1fcafa149128d25cc4680c6c)
| * (#8409) Add a default group provider for WindowsNick Lewis2011-08-191-0/+79
| | | | | | | | | | | | | | | | | | | | | | This provider, windows_adsi, uses the Puppet::Util::ADSI module to manage groups. It can only manage group existence and memberships, but is fully functional in those regards. Based on work by: Joel Rosario <joel.r@.internal.directi.com> Based on work by: Cameron Thomas <cameron@puppetlabs.com> Reviewed-By: Matt Robinson <matt@puppetlabs.com> (cherry picked from commit 01f09f5f395bab66b90a4e81e958aa89025977b4)
| * (#8408) Add a default user provider for WindowsNick Lewis2011-08-191-0/+110
| | | | | | | | | | | | | | | | | | | | | | This provider, windows_adsi, uses the Puppet::Util::ADSI module to manage users. It can currently only manage group memberships, comments, and home directories, which are the only fields that can be managed via ADSI. Based on work by: Joel Rosario <joel.r@.internal.directi.com> Based on work by: Cameron Thomas <cameron@puppetlabs.com> Reviewed-By: Matt Robinson <matt@puppetlabs.com> (cherry picked from commit ac00e9e289f8fdc81f060e7dd289e1a8e0f133c0)
| * (#8644) Host provider on WindowsJosh Cooper2011-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The host provider did not work on Windows because it didn't know where to find its hosts file. The provider now uses Win32::Resolv, which is part of the standard ruby library, to find it. Several host type/provider spec tests were marked as fails_on_windows, but now that the provider is working, I removed the tag from those tests, and verified that the tests now pass. There are two tests in resources_spec that fail because the user and exec providers are not supported on Windows yet, so those tests are marked as fails_on_windows. Reviewed-by: Pieter van de Bruggen <pieter@puppetlabs.com> (cherry picked from commit 82c6b3cb41397c989c011cf767066bcf1e403db2)
| * (#8663) Disable spec tests for unsupported functionality on WindowsJosh Cooper2011-08-192-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mount, shell, and ssh_authorized_key types are not supported on Windows, so these spec tests have been disabled when running on Windows. One of the compiler spec tests fails on Windows because Puppet::Util.execute attempts to execute a program named "git rev-parse HEAD". This has different semantics than Unix, where the command is splatted, Kernel.exec(*command). Since this truly is a Windows bug, I removed the fails_on_windows tag and updated ticket #8410. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit d9ce88d10707268fe41c8f3ad1166137fe8e202f)
| * (#8272) Allow disabled Windows services to be startedNick Lewis2011-08-191-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because Windows allows a service to be both running and disabled, we now support that capability. If a service is explicitly requested to be running and disabled, we will set it to manual start if necessary, start it, and then disable it. If the service is requested to be running and enabled, we will now enable it before attempting to start it (previously, this would simply try to start it and fail). The exception to this rule is a service which is disabled, and for which we are not managing the enable property. In that case, we assume that some other authority has disabled the service, and respect that, failing to start. Thus, if the user actually wants a service to be running and disabled, they must explicitly declare that intent. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 12d0018f93e5a72a728c6decffb351a693a86344)
| * (#8272) Refactor specs for Windows service providerNick Lewis2011-08-191-58/+32
| | | | | | | | | | | | | | | | | | These were using fake objects when that's not really necessary, so replace them with real ones. Additionally, many of these specs were doing the same thing (like creating a resource), so that has been extracted to the before block. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit f5e8dbef9e16bf05e4c05a43407e94027faa2410)
| * (#8272) Use symbols instead of booleans for enabled property on WindowsNick Lewis2011-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | Because the enable property of the service type uses :true and :false as its valid values, rather than true and false, we need to return :true and :false from our enabled? method. Otherwise, the property was being synced every time it was enabled or disabled, regardless of whether it was actually in sync or not. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 44e2d494f499e2005c1b31b92b97834189d4224d)
| * Add basic service provider for WindowsCameron Thomas2011-08-191-0/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provider allows us to query the system state through "puppet resource", and manage the ensure, and enabled properties of services on Windows. This also adds support for a new enabled value of 'manual' on Windows only. With this we support the three major start types for services on Windows, with the following mapping of enabled to start type: true => Automatic false => Disabled manual => Manual (Demand) We use the win32-service gem to provide access to the Windows APIs for our operations. This does add a new gem requirement for running Puppet on Windows, but we were already requiring some gems from the same suite that win32-service is a part of. When referring to a service, the simple service name must be used, instead of the display name. For example, "snmptrap", instead of "SNMP Trap". All system services are reported in 'puppet resource service', including those started prior to run level 3 (system, device drivers, etc.). These services should probably not be managed, without careful thought and planning. This currently does not support being able to move a service from {enabled => false, ensure => stopped} to {enabled => true, ensure => running} (or enabled => manual) in a single Puppet run, since Puppet currently always tries to sync ensure before any other property. Because of this, the puppet run will fail every time, and the service must first be managed as {ensure => stopped, enabled => true} (or enabled => manual), before it can be managed as running and automatic start or manual start. Reviewed by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 82476e8be41b62ce1767ab6854a72b481b917380)
| * Maint: Fix miscellaneous testsJosh Cooper2011-08-192-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several tests were broken due to pecularities of Windows and Ruby on Windows: * Ruby on windows does not differentiate between group and other file permissions. * All open file handles must be closed before the file can be deleted * Sometimes the current working directory (Dir.getwd) is reported as C:/foo and other times as C:\\foo, which confuses the spec tests. * Ruby's sprintf formats floating point values differently on Windows vs Unix. The Windows exponent has an extra leading zero. * Needed to stub execution of security command with the SMF service provider. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 0e4ae653c0628cb0df9ccace98bca4bc7478fb7c)
| * Maint: Tagged spec tests that are known to fail on WindowsJosh Cooper2011-08-196-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many spec tests fail on Windows because there are no default providers implemented for Windows yet. Several others are failing due to Puppet::Util::Cacher not working correctly, so for now the tests that are known to fail are marked with :fails_on_windows => true. To skip these tests, you can run: rspec --tag ~fails_on_windows spec Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 255c5b4663bd389d2c87a2d39ec350034421a6f0) Conflicts: spec/unit/resource/catalog_spec.rb
| * maint: remove inaccurate copyright and license statements.Daniel Pittman2011-08-184-16/+0
| | | | | | | | | | | | | | | | | | | | | | For a while Luke, and other authors, injected a created tag, copyright statement, and "All rights reserved" into every new file they added to the Puppet project. This isn't really true, and we have a global license covering the code, so we have now stripped out all those old tags. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
* | Merge branch '2.7.x'Nick Lewis2011-08-161-3/+5
|\|
| * Fix posix exec provider spec failures on WindowsNick Lewis2011-08-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These specs were assuming that paths such as /foo were always absolute, which is not the case on Windows. Thus, when run on Windows, the provider was complaining about receiving relative paths when it expected absolute, rather than succeeding or failing in the intended way. Now we expand all paths we want to be absolute, to guarantee they will be absolute everywhere. Also, some specs were failing because they were trying to test the case where a file isn't executable. That's not something we can reliably check on Windows, so instead just stub the appropriate executable? methods. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* | Merge branch '2.7.x'Nick Lewis2011-08-161-105/+104
|\| | | | | | | | | | | Conflicts: lib/puppet/provider/augeas/augeas.rb spec/unit/node_spec.rb
| * (#5495) Remove dead Windows-specific code from posix exec providerNick Lewis2011-08-161-105/+104
| | | | | | | | | | | | | | | | | | | | | | | | Because this provider only applies when the posix feature is present (and thus not the windows feature), it can never be used on Windows. Thus, the Windows-specific command handling is unnecessary and unused. Also added more specific error messages for the cases where a command doesn't exist, isn't a file, and isn't executable. These only apply when the command path is absolute (otherwise the message is simply command not found). Reviewed-By: Matt Robinson <matt@puppetlabs.com>
| * (#8808) Fail Augeas resource when unable to save changesDominic Cleal2011-08-061-0/+14
| | | | | | | | | | Raise a failure when Augeas changes cannot be saved (due to invalid layout of the tree, permissions etc). Fixes a regression.
* | Merge pull request #23 from domcleal/tickets/master/5606Daniel Pittman2011-08-121-0/+32
|\ \ | | | | | | (#5606) Print Augeas' /augeas//error info to debug on save failure
| * | (#5606) Print Augeas' /augeas//error info to debug on save failureDominic Cleal2011-08-071-0/+18
| | | | | | | | | | | | | | | | | | When saving fails, the contents of /augeas//error (for put_failed) are printed to the debug log. Should help users track down the issue without needing to replicate it with augtool.
| * | (#8808) Fail Augeas resource when unable to save changesDominic Cleal2011-08-071-0/+14
| | | | | | | | | | | | | | | Raise a failure when Augeas changes cannot be saved (due to invalid layout of the tree, permissions etc). Fixes a regression.
* | | (#8272) Add missing tests for Windows service provider methods.Cameron Thomas2011-08-101-5/+40
| | | | | | | | | | | | | | | | | | | | | | | | Added missing spec tests for Windows service provider methods: :stop, :enable, :disable, and :manual_start Refactored to match Nick's previous work. Reviewed By: Nick Lewis [nick@puppetlabs.com]
* | | (#8409) Add a default group provider for WindowsNick Lewis2011-08-101-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provider, windows_adsi, uses the Puppet::Util::ADSI module to manage groups. It can only manage group existence and memberships, but is fully functional in those regards. Based on work by: Joel Rosario <joel.r@.internal.directi.com> Based on work by: Cameron Thomas <cameron@puppetlabs.com> Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* | | (#8408) Add a default user provider for WindowsNick Lewis2011-08-101-0/+110
|/ / | | | | | | | | | | | | | | | | | | This provider, windows_adsi, uses the Puppet::Util::ADSI module to manage users. It can currently only manage group memberships, comments, and home directories, which are the only fields that can be managed via ADSI. Based on work by: Joel Rosario <joel.r@.internal.directi.com> Based on work by: Cameron Thomas <cameron@puppetlabs.com> Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* | (#8644) Host provider on WindowsJosh Cooper2011-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The host provider did not work on Windows because it didn't know where to find its hosts file. The provider now uses Win32::Resolv, which is part of the standard ruby library, to find it. Several host type/provider spec tests were marked as fails_on_windows, but now that the provider is working, I removed the tag from those tests, and verified that the tests now pass. There are two tests in resources_spec that fail because the user and exec providers are not supported on Windows yet, so those tests are marked as fails_on_windows. Reviewed-by: Pieter van de Bruggen <pieter@puppetlabs.com>
* | (#8663) Disable spec tests for unsupported functionality on WindowsJosh Cooper2011-07-282-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The mount, shell, and ssh_authorized_key types are not supported on Windows, so these spec tests have been disabled when running on Windows. One of the compiler spec tests fails on Windows because Puppet::Util.execute attempts to execute a program named "git rev-parse HEAD". This has different semantics than Unix, where the command is splatted, Kernel.exec(*command). Since this truly is a Windows bug, I removed the fails_on_windows tag and updated ticket #8410. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | (#8272) Allow disabled Windows services to be startedNick Lewis2011-07-261-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because Windows allows a service to be both running and disabled, we now support that capability. If a service is explicitly requested to be running and disabled, we will set it to manual start if necessary, start it, and then disable it. If the service is requested to be running and enabled, we will now enable it before attempting to start it (previously, this would simply try to start it and fail). The exception to this rule is a service which is disabled, and for which we are not managing the enable property. In that case, we assume that some other authority has disabled the service, and respect that, failing to start. Thus, if the user actually wants a service to be running and disabled, they must explicitly declare that intent. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
* | (#8272) Refactor specs for Windows service providerNick Lewis2011-07-261-58/+32
| | | | | | | | | | | | | | | | These were using fake objects when that's not really necessary, so replace them with real ones. Additionally, many of these specs were doing the same thing (like creating a resource), so that has been extracted to the before block. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
* | (#8272) Use symbols instead of booleans for enabled property on WindowsNick Lewis2011-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | Because the enable property of the service type uses :true and :false as its valid values, rather than true and false, we need to return :true and :false from our enabled? method. Otherwise, the property was being synced every time it was enabled or disabled, regardless of whether it was actually in sync or not. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
* | Merge branch 'feature/master/8272-windows_service_support'Cameron Thomas2011-07-221-0/+130
|\ \ | | | | | | | | | | | | | | | * feature/master/8272-windows_service_support: Add basic service provider for Windows Regexp escape substituted commands in Windows wrapper script
| * | Add basic service provider for WindowsCameron Thomas2011-07-221-0/+130
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provider allows us to query the system state through "puppet resource", and manage the ensure, and enabled properties of services on Windows. This also adds support for a new enabled value of 'manual' on Windows only. With this we support the three major start types for services on Windows, with the following mapping of enabled to start type: true => Automatic false => Disabled manual => Manual (Demand) We use the win32-service gem to provide access to the Windows APIs for our operations. This does add a new gem requirement for running Puppet on Windows, but we were already requiring some gems from the same suite that win32-service is a part of. When referring to a service, the simple service name must be used, instead of the display name. For example, "snmptrap", instead of "SNMP Trap". All system services are reported in 'puppet resource service', including those started prior to run level 3 (system, device drivers, etc.). These services should probably not be managed, without careful thought and planning. This currently does not support being able to move a service from {enabled => false, ensure => stopped} to {enabled => true, ensure => running} (or enabled => manual) in a single Puppet run, since Puppet currently always tries to sync ensure before any other property. Because of this, the puppet run will fail every time, and the service must first be managed as {ensure => stopped, enabled => true} (or enabled => manual), before it can be managed as running and automatic start or manual start. Reviewed by: Jacob Helwig <jacob@puppetlabs.com>
* | Maint: Fix miscellaneous testsJosh Cooper2011-07-192-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several tests were broken due to pecularities of Windows and Ruby on Windows: * Ruby on windows does not differentiate between group and other file permissions. * All open file handles must be closed before the file can be deleted * Sometimes the current working directory (Dir.getwd) is reported as C:/foo and other times as C:\\foo, which confuses the spec tests. * Ruby's sprintf formats floating point values differently on Windows vs Unix. The Windows exponent has an extra leading zero. * Needed to stub execution of security command with the SMF service provider. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | Maint: Tagged spec tests that are known to fail on WindowsJosh Cooper2011-07-196-7/+7
|/ | | | | | | | | | | | Many spec tests fail on Windows because there are no default providers implemented for Windows yet. Several others are failing due to Puppet::Util::Cacher not working correctly, so for now the tests that are known to fail are marked with :fails_on_windows => true. To skip these tests, you can run: rspec --tag ~fails_on_windows spec Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* Merge branch '2.7.x'Matt Robinson2011-06-061-1/+106
|\ | | | | | | | | | | | | | | | | | | * 2.7.x: (#7624) Manually fetch all properties in instances. (#7193) Fix path issues with acceptance tests that call old shell tests (#7632) Make secret_agent application compatible with secret_agent face (#7624) Auditing should not be enabled by default for purged resources. maint: Confine augeas specs to require the augeas feature (#2728) Add diff output for changes made by Augeas provider
| * maint: Confine augeas specs to require the augeas featureNick Lewis2011-06-021-1/+1
| |
| * (#2728) Add diff output for changes made by Augeas providerMichael Knox2011-06-021-1/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Utilising Augeas's SAVE_NEWFILE mode (similar to augtool -n) to determine the changes that will be made be made by Augeas. Output a unified diff to info handle non-default root, and multiple files correctly Adding tests for Augeas diff functionality Add test for non-default :root when diff'ing Ensure that multiple files are diffed if changed, not just one Signed-off-by: Josh Cooper <josh@puppetlabs.com> Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | maint: Fix pacman provider to work with Ruby 1.9Matt Robinson2011-05-241-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Ruby 1.9 doesn't allow the lambda to walk up the directory structure to require the spec helper This is the same issue as with commit: f6da3339f59bbd9243a03dc1e417b1fed7955c7e Also, you can't call each on a string in Ruby 1.9 directly since it doesn't implicitly do a split on \n like it did in older Rubies, but each_line works all the way back to 1.8.5 Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | Merge branch '2.7.next' into nextPieter van de Bruggen2011-05-185-13/+8
|\|
| * maint: fix spec_helper inclusions again.Daniel Pittman2011-05-175-13/+8
| | | | | | | | | | | | | | | | | | | | We got rid of the '../../spec_helper' style requires, but a few of them snuck back in in recent changes. This purges them out, replaced with the header: #!/usr/bin/env rspec require 'spec_helper' Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* | Merge branch '2.7.next' into nextPieter van de Bruggen2011-05-177-44/+74
|\|
| * Merge branch '2.7.x' into 2.7.nextPieter van de Bruggen2011-05-176-12/+12
| |\
| | * (#7507) Add ability to filter Ruby 1.9 spec failuresMatt Robinson2011-05-176-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By running: rspec spec --tag ~@fails_on_ruby_1.9.2 We can now just run the specs that pass under Ruby 1.9. Obviously in the long term we want to have all the specs passing, but until then we need notification when we regress. From now on new code will be required to pass under Ruby 1.9, and Jenkins will give us email notification if it doesn't or if we break something that was already working. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
| * | (#7114) Fix specs for ssh authorized key parsed providerNick Lewis2011-05-161-32/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | These tests were unnecessarily creating a stub resource, as well as failing to re-initvars on the provider before each test. This led to test ordering failures, and incompatibilities with the other commits in this series. Now we use a real resource, and properly reinitialize before each test. Paired-With: Josh Cooper
| * | Merge branch 'ticket/2.7.x/7300' into 2.7.nextNick Lewis2011-05-161-0/+41
| |\ \
| | * | (#7300) Add specs for the mount providerStefan Schulte2011-05-011-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add specs to demonstrate that the instances method is currently broken because it does not take the actual mountstate into account. As a result running "puppet resource mount" on the commandline will report every mount that appears in /etc/(v)fstab as unmounted.
* | | | (#1853) Pacman package providerPaul Boyd2011-05-161-0/+1
| | | | | | | | | | | | | | | | Stub the command method, so it doesn't give an error.
* | | | (#1853) Pacman package providerPaul Boyd2011-05-161-0/+237
|/ / / | | | | | | | | | | | | | | | | | | Adds support for use Archlinux's pacman package manager in Puppet. Originally written by Miah Johnson, with bug fixes from Thomas Hatch and myself.
* | | Merge branch '2.7.x' into 2.7.nextMatt Robinson2011-05-131-20/+24
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.7.x: (#7469) Add license to test face so tests pass (#7264) Docs: Clarify that subscribe/notify imply require/before (#7468) Stub spec that tries to connect to pypi.python.org Prevent spec failure caused by network device mock leak Fix #7299 - do not require net/ssh for running rake spec Resolved Conflicts: lib/puppet/util/network_device.rb spec/unit/util/network_device_spec.rb