summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package/apt_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move idempotency logs to debugPhil Dibowitz2021-03-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This was discussed in the last Chef Triage meeting. In the great move to trace logging, which is great, idempotency check logs moved to trace, which defeats the purpose. The goal is to keep "internal chef" logging in trace so that when users are trying to figure out why their cookbook isn't acting as expected they can look at debug without having to see all the other cruft. But "here's why I didn't install the package you said to install" is table-steaks "I'm trying to debug my cookbook." This moves those logs back to debug. There were a variety of cases where logging was pretty nonstandard in other ways, but to keep this PR scoped, I didn't change those. I did fix a few related logging issues: * A few warns that should have been debug in windows_task * A few places where there was basically no logging whatsoever, I put a few of the "I did X" logs to 'debug' (from trace). It coudl be argued some of those should be 'info', but that's a bigger change that I didn't want to put into this PR Signed-off-by: Phil Dibowitz <phil@ipom.com>
* Fix downgrades in apt_package (#10993)Phil Dibowitz2021-02-081-16/+82
| | | | | | | | | | | | | | | | | | | | `apt_package` never even looks at `new_resource.version` when deciding what version to install. That's silly. This fixes that. It requires the version be exact (as the `yum_package` did for most of Chef's history), and if you specify a non-existent version, it'll raise an exception. The unit tests for this provider are a bit of a mess, so I kinda stuck in the tests where I could. ``` [2021-02-07T15:59:35-08:00] TRACE: apt_package[hub] installed version for hub is 2.14.2-1vcrs.1 [2021-02-07T15:59:35-08:00] TRACE: apt_package[hub] candidate version for hub is 2.14.2-1vcrs.1 [2021-02-07T15:59:35-08:00] TRACE: apt_package[hub] hub 2.14.2-1vcrs.1 needs updating to 2.7.0~ds1-1vcrs.1 [2021-02-07T15:59:38-08:00] INFO: apt_package[hub] installed hub at 2.7.0~ds1-1vcrs.1 ``` Signed-off-by: Phil Dibowitz <phil@ipom.com>
* Remove copyright dateslcg/remove-copyright-datesLamont Granquist2020-04-131-1/+1
| | | | | | | | Legally incredibly dubious, particularly since we don't follow it strictly as policy, and we have git history instead, which does it right. This is just a waste of time and a cargo cult. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix 4 copsLamont Granquist2019-07-051-4/+4
| | | | | | | | | | | | | | - Layout/MultilineMethodCallBraceLayout - Layout/ClosingParenthesisIndentation - Layout/IndentFirstArgument EnforcedStyle: consistent - Layout/BlockEndNewline the first of these autocorrected to horrible looking code which exposed that we really needed the other three as well, which also cleaned up a bunch of other terrible looking code. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fixes for chefstyle bumpLamont Granquist2019-07-021-1/+1
| | | | | | | | result of automation https://github.com/chef/chefstyle/pull/72 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Move response_file and response_file_variables out of base package resourceKapil Chouhan2019-05-071-4/+26
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com> Fix for Move response_file and response_file_variables out of base package resource Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com> update require changes Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com> Updated require changes Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com> Fixed some unit test cases Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com>
* add tests for apt-get --allow-downgradeslcg/apt-get-allow-downgradesLamont Granquist2018-11-201-2/+79
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* add --allow-downgrades to apt-getLamont Granquist2018-11-201-6/+6
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* clean up whitespace againLamont Granquist2018-07-021-2/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/IndentHeredocLamont Granquist2018-07-021-81/+81
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/HashSyntaxLamont Granquist2018-07-021-67/+67
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Unification of shell_out APIsLamont Granquist2018-06-151-38/+38
| | | | | | | converts all usage to just shell_out() from the numerous helper utilities that we've had previously. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* remove uses of shell_out_compact_timeoutLamont Granquist2018-05-311-3/+3
| | | | | | just use shell_out_compact now. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Fix NoMethodError when (un)locking single packages in apt and zypperJonathan Hartman2018-04-091-2/+0
| | | | | | | | These resources don't coerce `package_name` to an array so would raise an exception when trying to call `name.all?` when `package_name`, and thus `name`, was a string. Signed-off-by: Jonathan Hartman <j@hartman.io>
* mechanical conversion of most debug log statements to traceThom May2018-03-261-2/+4
| | | | Signed-off-by: Thom May <thom@chef.io>
* Ensure that we only set config file options if necessarytm/apt_debconf_promptsThom May2018-01-301-435/+429
| | | | | | | | - If the user has already set some options, trust that they know what they're doing - Bonus fixup of the apt_package provider tests. Signed-off-by: Thom May <thom@chef.io>
* temporarily skip tests that have duplicate options while WIPCam Cope2018-01-301-3/+5
|
* fix tests to reflect options changeCam Cope2018-01-301-5/+5
|
* Ensure package (un)locking is idempotentAndy Wagner2018-01-041-0/+22
| | | | | | | | | | | | | | | Due to the nature of the comparison done, the `package_locked` methods will always return false as they presume the package name is a string, when it is in fact always coerced into an array. Additionally in situations where the package_name is set rather than being inherited from the package resource's name, it will always return false. Resolves #6361 Resolves #6493 Signed-off-by: Andy Wagner <andy@andywagner.ca>
* Avoid the need to parse nil versions in the package providerTim Smith2017-11-031-0/+34
| | | | | | | | | | | | | | | | | If we don't have a version installed yet we shouldn't go do a version comparison with nil. No matter what that's a waste of time and in dpkg/apt it's going to require shelling out now. Instead just do the install. This also adds the same version comparison method to the dpkg resource. At the moment it doesn't look like this is going to get called since our upgrade action there is a bit broken (doesn't actually compare versions), but that's going to get fixed next. This also cleans up the version comparison to make sure we're always dealing with strings Signed-off-by: Tim Smith <tsmith@chef.io>
* Remove a whole bunch more stubbed property stuff.Noah Kantrowitz2017-04-111-2/+2
| | | | Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
* Add a spec for apt_package install with quoted optionsmh/apt_package_fixMark Harrison2017-02-231-0/+10
| | | | Signed-off-by: Mark Harrison <mark@mivok.net>
* package provider cleanuplcg/package-cleanupLamont Granquist2017-02-111-27/+27
| | | | | | | | | - cleans up a lot of ivar usage - converts most providers to shell_out_compact_timeout! - almost deprecates a few APIs, but can't quite yet - windows providers need mixlib-shellout to take an argv Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fixed apt-mark commandsEike Waldt2016-09-291-2/+2
|
* added (un)lock_package for apt and zypperc52275322016-09-281-0/+22
|
* add tests around purging and removing virtual packageslcg/multipackage-apt-providerLamont Granquist2016-05-031-8/+30
|
* add check for passing nil candidate_version to superclassLamont Granquist2016-05-031-0/+24
|
* lazier assembly of data, more multipackagingLamont Granquist2016-05-031-9/+18
|
* multipackage apt providerLamont Granquist2016-05-031-23/+31
|
* flip multiline function arguments aroundlcg/rubocop-0.37.2Lamont Granquist2016-02-191-20/+20
| | | | no enforced trailing comma on arguments...
* autofixing whitespace copsLamont Granquist2016-02-051-22/+22
| | | | | | | | | | | | | | | | | | | | | | 4174 Style/SpaceInsideHashLiteralBraces 1860 Style/SpaceAroundOperators 1336 Style/SpaceInsideBlockBraces 1292 Style/AlignHash 997 Style/SpaceAfterComma 860 Style/SpaceAroundEqualsInParameterDefault 310 Style/EmptyLines 294 Style/IndentationConsistency 267 Style/TrailingWhitespace 238 Style/ExtraSpacing 212 Style/SpaceBeforeBlockBraces 166 Style/MultilineOperationIndentation 144 Style/TrailingBlankLines 120 Style/EmptyLineBetweenDefs 101 Style/IndentationWidth 82 Style/SpaceAroundBlockParameters 40 Style/EmptyLinesAroundMethodBody 29 Style/EmptyLinesAroundAccessModifier 1 Style/RescueEnsureAlignment
* Update all auth email address from opscode.com and getchef.com to chef.io.Noah Kantrowitz2016-02-021-1/+1
| | | Generated via git ls-files | xargs perl -pi -e "s/(Author.*?<[^@]+@)(?:opscode\\.com|getchef\\.com)(>)/\\1chef.io\\2/gi"
* Replace all Opscode copyrights with Chef Software.Noah Kantrowitz2016-02-021-1/+1
| | | Created via git ls-files | xargs perl -pi -e "s/(Copyright.*?), Opscode(,)? Inc(\.)?/\\1, Chef Software Inc./gi"
* Copyright year update for 2016 and massive cleanup.Noah Kantrowitz2016-02-021-1/+1
| | | Generated via git ls-files | xargs perl -pi -e "s/[Cc]opyright (?:\([Cc]\) )?((?\!$(date +%Y))\\d{4})(-\\d{4})?([, ][ \d]+)*(,|(?= ))/Copyright \\1-$(date +%Y),/g"
* Use double quotes by defaultThom May2016-01-141-5/+5
| | | | | | | This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
* autocorrecting Style/TrailingCommalcg/trailing_commaLamont Granquist2016-01-131-20/+20
| | | | chefstyle -a fixed 1044 occurrances
* Added spec for #2914lcg/fix-multipackageJay Mundrawala2015-02-171-0/+15
|
* fix virtual package logic in check_package_stateLamont Granquist2015-02-171-1/+1
| | | | | | | | | | | | | | | | since check_package_state calls itself to check virtual packages the array building it does was getting indexed incorrectly as the virtual packages were getting inserted into arrays that were supposed to be indexed by the package arguments the user gave. there was also a bug which broke idempotency with virtual packages and would cause virtual packages to get reinstalled every time (installed_version not geting correctly inherited from the virtual package). WIP2 remove debug fix specs
* convert is_virtual_package to hashLamont Granquist2015-02-171-1/+1
| | | | | | | | | make this a hash based on name so that when we pass an array of names to install_package we can look up the right one and do not have to synchronize arrays. we should probably convert the arrays in the superclass to hashes based on name as well.
* Multipackage fixes to superclassLamont Granquist2015-02-031-2/+6
| | | | | | | - fixes define_resource_requirements - better idempotency (only packages that need updating are updated) - better messaging (only packages that update are output) - better comments
* fix apt default_release attribute broken in 12.0Lamont Granquist2014-12-151-257/+264
| | | | | | | | | | | | | the apt provider attempts to check if it has a provider that responds to :default_release (i.e. a real apt_package resource) via if the provider attribute is explicitly set or not, which is relying on a side-effect which broke in 12.0. the correct behavior is just to duck-type the new_resource object and see if it respond_to?(:default_release) and then use it if it does. Also the unit tests were not testing the apt_provider against both the package and apt_package resources. Added some hacky spec code (which needs a cleanup) to at least exercise the use cases.
* updating resources/providers unit tests to rpsec3Lamont Granquist2014-10-241-35/+35
| | | | mechanically generated patch using transpec 2.3.7 gem
* Chef-12 RC Provider ResolverLamont Granquist2014-10-241-1/+1
| | | | | makes resource and provider class resolution more dynamic. begins deprecation of Chef::Platform static mapping.
* Revert the provider indirection logic while keeping the timeout ↵sersut2014-07-021-3/+3
| | | | functionality to fix resource notifications and ChefSpec stubs.
* Fix apt_spec test to expect custom timeout for apt-cache commanddanielsdeleo2014-06-111-1/+1
|
* Merge pull request #1462 from pdf/CHEF-5168Claire McQuin2014-06-101-43/+87
|\ | | | | [CHEF-5168] Apt Package provider times out
| * [CHEF-5168] Apt Package provider times outPeter Fern2014-05-281-43/+87
| | | | | | | | | | - Convert APT package resource to use `provides :package` - Add timeout parameter
* | CHEF-5113: Fix apt package unit test regression on non-debian platformsBryan McLellan2014-06-101-0/+1
| |
* | CHEF-5113: Add a unit testBryan McLellan2014-06-051-0/+5
|/
* s/mock\(/double(/gLamont Granquist2014-01-291-6/+6
|