summaryrefslogtreecommitdiff
path: root/spec/integration/recipes
Commit message (Collapse)AuthorAgeFilesLines
* Disable Naming/AsciiIdentifiers in our specsTim Smith2020-07-091-1/+1
| | | | | | | RuboCop 0.87 expanded this cop to detect these uses of non-ASCII characters. Signed-off-by: Tim Smith <tsmith@chef.io>
* Fix quotes for ChefstyleTim Smith2020-07-077-7/+7
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* expand_path with __dir__ instead of __FILE__Tim Smith2020-07-077-7/+7
| | | | | | It's easier to read this at a glance and understand what path we're trying to get. Signed-off-by: Tim Smith <tsmith@chef.io>
* Add spaces after attrsTim Smith2020-07-072-0/+4
| | | | | | This makes it easier to read the classes. Signed-off-by: Tim Smith <tsmith@chef.io>
* Remove test file that added a method to top-level scope.Pete Higgins2020-06-261-0/+4
| | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* Fix some odd whitespacing in tests.Pete Higgins2020-06-241-2/+2
| | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* Remove copyright dateslcg/remove-copyright-datesLamont Granquist2020-04-133-3/+3
| | | | | | | | 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>
* Add resource partialsLamont Granquist2020-04-082-0/+128
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Add after_resource to pair with current_resourceLamont Granquist2020-03-311-10/+131
| | | | | | | | | | | | | | | | | | | For custom resources which correctly implement load_current_value the new after_resource comes for "free" and load_current_value will be called twice to load the current_resource (should be renamed the "before_resource" but that ship sailed) and then the after_resource. Appropriate wiring is added for a new event and capturing that into the action_collection and then the data_collector. The resource_reporter has not and will not be updated. For old style resources which are difficult to convert to custom resources (thinking here particularly of the 1:N model of the service resource in core chef, or stuff that just may be a lot of work like the file resource) then they can override the load_after_resource to manually wire up their own after_resource. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge pull request #9493 from chef/log_improvementsTim Smith2020-03-168-0/+8
|\ | | | | Pull in many of Zenspider's rspec improvements
| * Fix all(?) circular requires coming from the specs.Ryan Davis2020-03-168-0/+8
| | | | | | | | | | | | | | Lots more in lib, but that's out of scope for this. I'm just trying to make it easier to debug a failing spec when needed. Signed-off-by: Ryan Davis <zenspider@chef.io>
* | Turn off notifications from log resource by defaultLamont Granquist2020-03-122-26/+42
|/ | | | | | This should be switched to the notify_group resource now. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Remove the canonical DSLLamont Granquist2020-03-037-161/+70
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix comverge_if_changed to compare default valueslcg/converge-if-changedLamont Granquist2019-09-231-19/+19
| | | | | | | | Fixes #6300. This may be a breaking change. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Add unified_mode switch for resourcesLamont Granquist2019-08-121-0/+876
| | | | | | | | | | | | | | | | | | | | | | | | | | This is inspired by "use_inline_resources". Setting `unified_mode false` in a resource would be the existing behavior with separate compile/converge phases. Setting `unified_mode true` in a resource will eliminate the converge phase. Reverse notifications and delayed notifications will still fire. The resource action will behave like all resources are executing at compile time. As a aside, notifications have never worked for resources firing at compile time. This implementation gets that behavior correct so that notifications will work. Of course forward immediate notifications to resources not yet declared will not be possible. Setting `resource_unified_mode_default true` in `Chef::Config` would turn off the split compile/converge mode for every custom resource. NOTE: This does not affect recipe mode at all. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix 4 copsLamont Granquist2019-07-051-1/+2
| | | | | | | | | | | | | | - 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>
* Style/SymbolProcLamont Granquist2019-07-051-2/+2
| | | | | | enforce pretzels. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/StringLiteralsInInterpolationLamont Granquist2019-07-056-34/+34
| | | | | | since we use double quotes, be consistent everywhere. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/EmptyMethodLamont Granquist2019-07-022-4/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolArrayLamont Granquist2019-07-022-7/+7
| | | | | | start enforcing using %i{} instead of arrays of symbols Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Remove chef-* binstubs from chef gemLamont Granquist2019-04-296-7/+7
| | | | | | | | | | | | | | | | This is for the relicensing effort. Note that this PR leaves the knife and ohai binstubs still in the gem(s) while that discussion is still ongoing. This PR extracts the binstubs to chef-binstubs gem which is not intended to be redistributed outside of the omnibus chef binaries. A blank gem for chef-binstubs has been pushed to rubygems.org for obvious security concerns and so that bundler/rubygems can resolve the gem Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* changes for rubocop engine upgrades.lcg/rubocop-upgradesLamont Granquist2019-01-155-50/+50
| | | | | | | this is the result of changes to rules we already previously had enabled. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* clean up whitespace againLamont Granquist2018-07-021-8/+8
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/DotPositionLamont Granquist2018-07-022-11/+11
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/IndentHeredocLamont Granquist2018-07-024-279/+279
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/HashSyntaxLamont Granquist2018-07-026-17/+17
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* remove deprecated proprety namespace collisionslcg/remove-deprecated-namespace-collisionsLamont Granquist2018-03-051-95/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | require writing `new_resource.my_property` instead of just `my_property` in provider code. a surprise in this code was that methods directly on the resource are all injected into the provider, and we never deprecated that, because we didn't know about it. that makes `action_class {}` helpers unnecessary, but causes additional namespace pollution, but at least the methods declared in the resource will lose to DSL methods (i.e. `def execute` will not work). but that also means that resources which are injected into the DSL which overwrite resource methods in other cookbooks may break their use in that cookbooks providers/action_classes. we should probably deprecate that as well, but we didn't and people probably found this behavior and used it. i cleaned it up a bit and removed the methods on Chef::Resource directly which polluted the provider class with all kinds of bizzare crap methods (not_if and only_if were getting injected into the provider, etc). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix integration testslcg/node-map-last-writer-winsLamont Granquist2018-01-221-26/+26
|
* prepping for rubocop 0.52.1lcg/rubocop-0.52.1Lamont Granquist2018-01-171-25/+25
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Improve property warnings in resourcesbetter_resource_errorsTim Smith2017-12-291-1/+1
| | | | | | Give more details on why people are seeing these problems so they can fix them. Signed-off-by: Tim Smith <tsmith@chef.io>
* travis caught another speclcg/lwrp-test-speedupLamont Granquist2017-12-061-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* speedup lwrp testsLamont Granquist2017-12-062-31/+31
| | | | | | | | | | | | | | | | | | reset the global resource and provider handler maps before each and every test. note that mutation through the top-level keys will get preserved so this is not perfect, but deep-duping through every single test we run becomes expensive. this is sufficient to flush out the global state of all the test lwrp fixtures that we setup. it discovered several usage bugs where we either relied on this feature or where we were testing different fixtures from the ones we thought we were. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Hide sensitive properties in converge_if_changed.Chris Arnold2017-11-271-15/+71
| | | | Signed-off-by: Chris Arnold <cma.arnold@gmail.com>
* Deprecate property namespace magicLamont Granquist2017-06-083-34/+29
| | | | | | | This forces everyone to starting using new_resource.property_name instead of just property_name. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Update some more tests for removing use_inline_resources.Noah Kantrowitz2017-04-041-11/+7
| | | | Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
* Chef-13: fix notifying array resourcesLamont Granquist2017-03-311-0/+29
| | | | | | | | this also deprecates the multi-resource notification syntax where `foo[a,b]` would attempt to notify both `foo[a]` and `foo[b]` because that is hella ambiguous. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* make nameless properties opt-inLamont Granquist2017-03-301-5/+22
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: Support nameless resources and remove deprecated multi-arg resourcesLamont Granquist2017-03-302-12/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes nameless resources work in the DSL: ```ruby apt_update ``` It does it by giving it an empty-string name of "" It also drops support for multi-arg resources, that has been deprecated for some time: ```ruby some_resource "foo", "bar", "baz" ``` Note that multipackage package resources do not use multiple args, but a single argument which is an arry: ```ruby package [ "lsof", "strace", "tcpdump" ] ``` So this change does not affect that usage. Multi-arg has been deprecated for some time now and its not clear that it was ever used by anyone. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: remove more deprecated provider_resolver codeLamont Granquist2017-03-291-75/+0
| | | | | | | I think this nukes descendants tracker, although might need to clean it up in a few more spots. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Fix Chef-13 action_class bug and cleanupLamont Granquist2017-03-271-27/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old action_class code was doing some magical stuff with the provider accessor in order to determine if the class was supposed to be a custom resource or not and have the action_class autovivifying accessor return nil in cases when the resource wasn't a custom resource and implementing inheritance by walking back up the tree in ways that were difficult to grok. This removes the magic from the provider so that there's no longer any accessor that magically short-circuits to nil if the resource is not supposed to be a custom resource. There is now a simple inherited API for `Chef::Resource.custom_resource?` which just defines if the class is a custom resource or not. Since both `action` and `action_class` call `define_action_class` they both wind up setting this boolean on the class, which is then inherited to subclasses automatically, which eliminates the need to walk up the hierarchy. The superclass.respond_to?(:action_class) checks have also been rendered unnecessary by removing the code that walked up the inheritance hierarchy and also because Chef::Resource is never going to be a custom resource itself, so will never call `define_action_class` so from inside of `define_action_class` you can always rely on the superclass being a resource and implementing `custom_resource?` and `action_class`. The wiring for picking the provider is now moved explicitly to the ProviderResolver -- even though custom resources hardcode a 1:1 resource-to-provider mapping. This reads much clearer to me than the magical wiring to the provider accessor off of the instance. The bug that this fixes was that the way the magical accessor nil-or-action_class was implemented the old way of defining action helpers with class_eval broke: ```ruby action_class.class_eval << EOM def a "foo" end EOM ``` If that came before any action_class-with-a-block or action declaration and the resource did not inherit from another custom resource then the action_class would not be created and it would return nil, which was an API which the magical wiring in the provider accessor required. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: Simplify DSL creationLamont Granquist2017-03-212-3/+21
| | | | | | | | | | | | | | we did actually have tests around creating actions with spaces and hyphens in their names. we had fallback code for properties, but it was broken and threw a "private method define_resource called" and then it created a closure and didn't have the `name` in the binding so it called itself and blew up the stack. this change walks that back. it does prove that we still support UTF-8 in property names, actions and DSL names, which i'd argue is more than enough. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: remove method_missing from the DSLLamont Granquist2017-03-211-29/+0
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Revert "Chef-13: remove more deprecated provider_resolver code"Lamont Granquist2017-03-201-0/+86
| | | | | | forgot to branch and need more coffee This reverts commit 02ec917f9356d999c44aceb7f1ff43957b0fe832.
* Chef-13: remove more deprecated provider_resolver codeLamont Granquist2017-03-201-86/+0
| | | | | | | I think this nukes descendants tracker, although might need to clean it up in a few more spots. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: remove Chef::Platform.set and related methodsLamont Granquist2017-03-171-73/+0
| | | | | | Switch over the Chef-12.0 ProviderResolver is now completed. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* re-fix redundant selflcg/fix-more-chefstylesLamont Granquist2017-02-131-31/+31
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* greenify rspecLamont Granquist2017-02-131-58/+58
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix specs: RedundantReturn, RedundantSelf, RedundantBeginLamont Granquist2017-02-131-31/+31
| | | | | | department of redundancy department Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge pull request #5631 from chef/lcg/deprecate-chef-platform-methodsLamont Granquist2016-12-091-0/+3
|\ | | | | Properly deprecate old Chef::Platform methods
| * Properly deprecate old Chef::Platform methodsLamont Granquist2016-12-071-0/+3
| | | | | | | | | | | | | | | | These should have been deprecated formally in 12.5.1 after the Dynamic Provider-Resolver'ing of the internal chef resources was completed. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>