summaryrefslogtreecommitdiff
path: root/spec/unit/provider
AgeCommit message (Collapse)AuthorFilesLines
2014-10-15Merge pull request #3164 from ↵Kylo Ginsberg1-0/+15
ffrank/ticket/3.7.x/PUP-3357-purge-unnamed-ssh-keys (PUP-3357) purge unnamed ssh keys
2014-10-15(PUP-3357) unit tests for the purging of multiple unnamed keysFelix Frank1-0/+15
Just makes sure that the user type and ssh_authorized_keys provider generate pseudo-names for keys following the same pattern.
2014-10-10(PUP-643) Ignore pkg's certificate expiration warning messagesKylo Ginsberg1-0/+4
When a pkg certificate is in it's last 30 days before expiration, the pkg tools emit a warning message so you can get a new certificate for some operations. The 'latest' method issues a 'pkg -Hn <package>' which trips this warning message, but the message was unexpected and 'latest' would raise, failing the catalog application. This commit simply ignores such certificate expiration warnings. While I was in there, I split a very compact line of code across a couple lines and added some spaces, in the name of readability.
2014-10-09(PUP-3203) Don't mutate trigger when checking for equalityJosh Cooper1-0/+10
Previously, when checking if the `current` and `desired` triggers were equivalent, we were silently deleting the `index` and `enabled` values from the `current` trigger. If we later needed to delete the `current` trigger, we would have lost its `index`, resulting in a call to `Win32::TaskScheduler.delete_trigger(nil)` causing the error: no implicit conversion from nil to integer This commit ensure that we don't mutate the `current` or `desired` trigger.
2014-10-07(maint) Remove magic behaviorJosh Cooper1-14/+14
Previously, the `#triggers` method on the scheduled task provider would magically return single element or an array of multiple elements. This commit changes the provider to always return an array, of possibly a single element.
2014-10-07(PUP-1165) Ignore scheduled_task trigger start_date when unspecifiedJosh Cooper1-0/+9
Previously, if a scheduled_task resource was created in the past, and the desired value of the resource's trigger did not specify a `start_date`, then puppet would think the resource was out of sync, and attempt to delete the old trigger, and add the new one. This process would repeat once per day, leading to spurious 'triggered changed' messages, and reports. This commit modifies the scheduled_task provider so that if the desired value does not specify a `start_date`, then it will effectively be ignored when comparing the current and desired triggers.
2014-10-07(PUP-1165) Perform validation on desired triggers not currentJosh Cooper1-0/+14
The `enabled` and `index` trigger parameters are read-only, so they will be set in the `current` trigger, but are not allowed in the `desired` trigger. Previously, the `translate_hash_to_trigger` method performed validation based on whether it was passed a `current` or `desired` trigger. This commit moves the validation logic to the `validate_trigger` method, which is only ever called with `desired` trigger values. It also allows the `index` and `enabled` keys to be present in a trigger. This isn't an issue because they are ignored for the purposes of determining if two triggers are the same. The reason for this change, is because ultimately we don't want the `translate_hash_to_trigger` method to mutate the `current` trigger, and this commit makes it so that the `index` and `enabled` keys can be in the `puppet_trigger` but will be ignored.
2014-09-09(PUP-3222) Rescue StandardError instead of non-existent exceptionJosh Cooper1-0/+48
Previously, the windows service provider rescued exceptions of type Win32::Service::Error. However, FFI-based versions of win32-service (v0.8.x) no longer raise that type of error. Instead they raise SystemCallError. So previously, if puppet failed to manage a service, e.g. service didn't exist, puppet would try to rescue the exception specifying a class that was not defined: puppet resource service foo ensure=stopped Error: /Service[foo]: Could not evaluate: uninitialized constant Win32::Service::Error This regression was introduced as part of PUP-1283 when we migrated from win32-service version 0.7.x to 0.8.x. This commit modifies the various provider methods to more broadly rescue StandardErrors and updates the spec tests to handle the negative cases. Paired-with: Ethan J Brown <ethan@puppetlabs.com>
2014-08-14(PUP 229) Fix /etc/shadow parsing so that max/min_age is reported correctlyRahul Gopinath1-1/+23
Before this patch, parsing /etc/shadow, when empty trailing fields were present, they were discarded, and inturn a nil check was used to ensure that the fields did not exist. However, this ran into trouble when a value was appended to the end, causing all the empty fields to be returned as empty strings instead, failing the nil checks. This patch ensures that all empty fields are returned as empty strings, and a check for empty string is used to check whether the field exists or not.
2014-08-11(PUP-2879) Add two nfsd-related upstart services to the blacklistKylo Ginsberg1-0/+2
2014-08-08(PUP-2879) Add cryptdisks-udev to the services blacklistKylo Ginsberg1-1/+5
Also this patch splits out the long line in upstart_spec.rb to be one line per service, so more diff-friendly.
2014-08-04(PUP-2971) Fix yum package provider missing install_options for list.Peter Huene1-0/+1
When executing the list command to filter virtual packages (when allow_virtual is false or nil), the yum package provider was not passing down the install options to the list command. For users passing options like --enablerepo, this prevents the packages from being discovered and the list command fails. The fix is to properly pass down the install options when executing the list command.
2014-07-29Merge pull request #2880 from ↵Adrien Thebo1-0/+15
fiddyspence/feature/2945/warning_on_windows_package_source (PUP-398) Windows package provider source munging and test
2014-07-29(PUP-398) Munge package source on Windowsfiddyspence1-0/+15
Adding munge and slashreplace method to windows package provider to ensure successful installation of packages. Validation in the type validate() not possible because we haven't chosen a provider at that point. Outputs debug as a means of notifying the user that the source has been changed.
2014-07-28Merge pull request #2918 from ↵Peter Huene1-71/+90
adrienthebo/fixup/master/pup-2871-install-uninstall-options-pacman Fixup/master/pup 2871 install uninstall options pacman
2014-07-28(maint) Make pacman (un)install_options privateAdrien Thebo1-43/+0
These methods should not be called by any outside class; this commit makes them private and removes the tests that invoke them directly.
2014-07-28(PUP-2871) Concatenate uninstall_options to argvAdrien Thebo1-4/+8
In the same manner as 9137faf uninstall_options were being appended as a nested array value; this commit changes the uninstall method to concatentate options to the array.
2014-07-28(PUP-2871) Concatenate install install_options to argvAdrien Thebo1-0/+20
Before this commit, install_options were passed as a nested array to pacman/yaourt. This commit changes that to concatentate the values with the argument vector.
2014-07-28(maint) Isolate specs from whether yaourt is installedAdrien Thebo1-13/+10
2014-07-28(maint) use RSpec helpers over instance and local variablesAdrien Thebo1-72/+70
2014-07-23(maint) Add test to ensure upstart is default init daemon in UbuntuWill Hopper1-0/+5
2014-07-17Merge pull request #2874 from adrienthebo/maint/master/update-rspecAndrew Parker1-8/+0
Maint/master/update rspec
2014-07-17(PUP-2732) Restrict Posix exec tests to POSIX envEthan J. Brown1-7/+6
- Instead of trying to simulate a POSIX environment on the Windows for the sake of tests against a provider that never runs on Windows, exclude the tests when Puppet.features.posix? is not true. - Given that these tests will no longer execute on Windows, the usage of expand_path is no longer necessary, nor are any of the Puppet.features.microsoft_windows? guards
2014-07-17(maint) Use Struct::Passwd instead of Etc::PasswdAndrew Parker1-1/+1
The return type of Etc.getpwent (and friends) is available as Etc::Passwd in ruby 1.9.3 and later. However that constant doesn't exist in ruby 1.8.7. However the docs refer to the type as Struct::Passwd, which turns out to be available on 1.8.7, 1.9.3, 2.0.0, and 2.1.0.
2014-07-16Merge pull request #2875 from ↵Rob Reynolds1-11/+0
Iristyle/ticket/master/PUP-2919-remove-win32-taskscheduler-ruby2-pending-tests (PUP-2919) Remove Windows / Ruby 2 pending specs
2014-07-16Merge branch 'pr/2742'Andrew Parker2-10/+19
* pr/2742: (PUP-2732) Test ignoring of user parameter (maint) Use real resource for testing shell provider (maint) Use parameter matchers in tests (PUP-2732) Add tests for user validation (PUP-2732) Use less restrictive exec user validation Closes #2742
2014-07-16(PUP-2732) Test ignoring of user parameterAndrew Parker1-1/+11
When the user parameter is specified, but it is the same as the current user, there isn't any need to control the user when executing the command. This adds a test in the posix provider for this shared behavior. There don't appear to be many tests for how exec works at all.
2014-07-16(maint) Use real resource for testing shell providerAndrew Parker1-2/+2
The shell provider tests were creating an invalid configuration of objects in order to test. The resource needs to be an instance of the :exec type, not a Puppet::Resource.
2014-07-16(maint) Use parameter matchers in testsAndrew Parker1-7/+6
This uses the mocha parameter matchers in the tests rather than a custom with() block. This is a little shorter and should provide better error messages when it fails.
2014-07-16Merge pull request #2835 from ↵Rob Reynolds1-1/+1
Iristyle/ticket/master/PUP-2521-remove-windows-pr-gem (PUP-2521) Remove windows-pr gem
2014-07-15(PUP-2919) Enable win32-taskscheduler Ruby2 specsEthan J. Brown1-11/+0
- Previously removed in 76cde1ba547b6aed12e8de0b4ec3d7339789ce01 as part of https://github.com/puppetlabs/puppet/pull/2846 - Win32-taskscheduler is Windows x64 / Ruby 2 compatible, and therefore these tests can be re-enabled
2014-07-15Merge branch 'ticket/master/PUP-2881-update-win32-taskscheduler'Rob Reynolds1-1/+1
* ticket/master/PUP-2881-update-win32-taskscheduler: (27 commits) (doc) task_scheduler failure on enabled/index in manifest (PUP-2881) Use COM UseInstance Helper for cleanup (PUP-2881) Don't Release TaskScheduler in save (PUP-2881) Refactor Task cleanup (PUP-2881) Use COM interface pointer helper (PUP-2881) Remove taskscheduler VERSION (PUP-2881) Taskscheduler COM initialization (PUP-2881) Remove taskscheduler S_OK constant (PUP-2881) Remove msvcrt/buffer from taskscheduler (PUP-2881) Refactor ITaskTrigger for FFI / COM (PUP-2881) Refactor IPersistFile for FFI / COM (PUP-2881) Remove CoTaskMemFree in windows/com.rb (PUP-2881) Refactor ITask for FFI / COM (PUP-2881) Setup Taskscheduler HRESULT constants (PUP-2881) Refactor IEnumWorkItems for FFI / COM (PUP-2881) Refactor ITaskScheduler for FFI / COM (PUP-2881) Fix Unknownr UseInstance helper (PUP-2881) Use Windows::Error for COM call fails (PUP-2881) Add Windows COM code from Unknownr (PUP-2881) Move COM FFI to file windows/com.rb ...
2014-07-15(maint) Remove nonfunctional directoryservice testAdrien Thebo1-8/+0
It's not possible to test Puppet::Provider::NameService::DirectoryService without stubbing out a huge amount of code, which is done by a different test. The removed test behaved almost identically like the following test so we can remove this without losing test coverage.
2014-07-15(maint) Remove deprecated `.to_not raise_error(args)` callsAdrien Thebo1-1/+1
From RSpec: DEPRECATION: `expect { }.not_to raise_error(SpecificErrorClass, message)` is deprecated. Use `expect { }.not_to raise_error` (with no args) instead. This commit removes all args from `.to_not raise_error` expectations.
2014-07-07(maint) Mark taskscheduler provider tests as pending on ruby 2Josh Cooper1-0/+11
The taskscheduler provider tests don't pass on Windows and ruby 2, because the underlying win32-taskscheduler gem does not work on x64. This commit marks the tests as conditionally pending. The tests will be re-enabled when PUP-2881 is implemented.
2014-07-07(PUP-2881) Move win32-taskscheduler gem into repoEthan J. Brown1-1/+1
- Remove win32-taskscheduler from gemspec through project_data.yaml - Update require statements where appropriate - All specs verified
2014-07-03(PUP-2521) Remove windows-prEthan J. Brown1-1/+1
- Windows::Error no longer exists and the ERROR_FILE_NOT_FOUND constant is part of the Puppet codebase now. - Catch appropriate error in package specs - Remove windows-pr, win32-api and windows-api from gemspec
2014-07-02Merge pull request #2756 from ffrank/ticket/master/PUP-1177-sshkey-mode-600Adrien Thebo1-1/+1
(PUP-1177) make sure ssh_known_hosts is not created with mode 0600
2014-06-30(PUP-2871) Add :install_options and :uninstall_options to the pacman providerAnthony Weems1-1/+44
Without this patch, a user unfamiliar with the pacman provider might write attempt to add flags to install and uninstall, not knowing that they will fail. This patch adds support for these two flags to ensure a more cohesive experience across puppet.
2014-06-26(PUP-2521) Don't use windows-pr constantsEthan J. Brown1-2/+2
- Somehow there were still some remaining constants referencing Windows:: which is part of windows-pr gem. Most are already defined locally as of the code being ported to FFI. Ensure that we use our internal constant definitions rather than those from gem: Puppet::Util::Windows::AccessControlEntry::CONTAINER_INHERIT_ACE Puppet::Util::Windows::AccessControlEntry::OBJECT_INHERIT_ACE Puppet::Util::Windows::AccessControlEntry::INHERIT_ONLY_ACE Puppet::Util::Windows::File::STANDARD_RIGHTS_ALL Puppet::Util::Windows::File::SPECIFIC_RIGHTS_ALL Puppet::Util::Windows::File::FILE_ALL_ACCESS Puppet::Util::Windows::File::FILE_GENERIC_READ Puppet::Util::Windows::File::FILE_GENERIC_EXECUTE - Add new constants to Puppet::Util::Windows::Error ERROR_FILE_NOT_FOUND ERROR_ACCESS_DENIED
2014-06-24(MAINT) Small openbsd package spec tweaksJasper Lievisse Adriaanse1-3/+4
- use .tgz as the package extension - complete 'provider features' and sort lines
2014-06-19(PUP-839) Remove SID mixin from SecurityEthan J. Brown4-22/+22
- SID methods can really standalone on their own, and should for the sake of sanity / code maintenance. Adjust all callsites (including specs) accordingly. - Make SID methods into static module_functions since they're already stateless
2014-06-19Merge pull request #2557 from jasperla/serviceAdrien Thebo1-2/+26
(PUP-2578) Adjustments for new OpenBSD service provider
2014-06-19(PUP-2578) Adjust spec tests to recent changes:Jasper Lievisse Adriaanse1-2/+26
- Ensure strict ordering of the result of #pkg_scripts_append - Add test for #in_base? - Ensure package scripts don't end up with empty flags
2014-06-11Merge branch 'pr/2734'Josh Cooper1-0/+6
* pr/2734: (PUP-2579) Improve regular expression for options of ssh_authorized_keys Closes GH-2734
2014-06-11(PUP-2579) Improve regular expression for options of ssh_authorized_keysRomain LE DISEZ1-0/+6
An option of an SSH key containing escaped double quotes were not correctly parsed by the ssh_authorized_keys provider, because of an incomplete regular expression. This commit improves the regular expression by ensuring that the option is ended by an non-escaped double quote.
2014-06-11Merge pull request #2558 from jasperla/openbsd/upgradeableAdrien Thebo1-4/+44
(PUP-1069) Implement feature :upgradeable for OpenBSD package provider.
2014-06-11(PUP-1177) update ParsedFile provider unit testsFelix Frank1-1/+1
The constructor for the :flat filetype accepts a second argument now. This second argument must be taken into account when stubbing specific invocations.
2014-06-06(PUP-2656) FFI Puppet::Util::Windows::RegistryRob Reynolds1-3/+3
- FFI GetACP - Remove requirement on gem windows-pr by removing 'windows/national' - Moved require for windows/registry into windows platform specific - Added module definition to satisfy MSI/Windows Package
2014-06-02(PUP-2577) Fix version comparison for OS X >= 10.10Kylo Ginsberg1-0/+8