summaryrefslogtreecommitdiff
path: root/lib/chef/resource/lwrp_base.rb
Commit message (Collapse)AuthorAgeFilesLines
* add a commentLamont Granquist2018-08-221-0/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* lazy the default resource_name until after parsingLamont Granquist2018-08-221-2/+2
| | | | | | | | | | | only set it if the resource doesn't set one. this means that we don't call resource_name or provides before parsing the file so that the chef_version_for_provides API in #7524 can work (otherwise we throw the deprecation warning before we ever parse the file). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* mechanical conversion of most debug log statements to traceThom May2018-03-261-2/+2
| | | | Signed-off-by: Thom May <thom@chef.io>
* prepping for rubocop 0.52.1lcg/rubocop-0.52.1Lamont Granquist2018-01-171-3/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Try removing the const-ificiation of DSL-based resources/providers.Noah Kantrowitz2017-04-031-2/+0
| | | | Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
* 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-8/+8
| | | | | | | 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.
* debug log messages upon reloaded resourcesif/warn-on-reload-resourceIsa Farnik2016-01-121-1/+1
| | | | tests for debug messages when reloading resources
* Remove now-unused function (already implemented by Chef::Resource)John Keiser2015-11-061-4/+0
|
* Update messaging to match LWRP -> Custom Resource renameTim Smith2015-10-211-6/+6
| | | | If you showed up in a post-LWRP world these would be confusing
* Revert "Merge pull request #3603 from chef/jdm/lwrp-base"Jay Mundrawala2015-06-301-46/+11
| | | | | This reverts commit 27d8675ec1c80f1eb7ec57f7b6c854441bb395ee, reversing changes made to 3501ba4020dc21377bc999e57e25eadb315ec783.
* Get tests passingJay Mundrawala2015-06-301-0/+15
|
* Fix ability to monkey match LWRP through Chef::Resource::MyLwrpJay Mundrawala2015-06-301-11/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Repro ===== The following cookbook would repro the issue cookbooks/lwrptest/resources/my_lwrp.rb --------------------------------------- ```ruby ``` cookbooks/lwrptest/providers/my_lwrp.rb --------------------------------------- ```ruby ``` cookbooks/lwrptest/recipes/default.rb ------------------------------------- ```ruby module Something def something puts 'something here' end end ::Chef::Resource::LwrptestMyLwrp.send(:include, Something) lwrptest_my_lwrp 'blah' do something end ``` Why it does not work ==================== Running this in 12.4.0 produces the error ``` NoMethodError ------------- undefined method `something' for LWRP resource lwrptest_my_lwrp from cookbook lwrptest ``` The problem is that LWRP usage through `Chef::Resource::MyLwrp` and `Chef::Provider::MyLwrp` is depreacted. In order to participate in the deprecation, `Chef::Resource::MyLwrp` is a subclass of the actual `MyLwrp` class with `initialize` overriden to do a Chef::Log.deprecation. In the example above, the intention is to add a method to the resource so that it can be used from the dsl. The reason this does not work is because including the method on `Chef::Resource::MyLwrp` adds the method to the subclass, and the resource that is looked up when running the recipe is the actual resource.
* Create property on resource, alias attribute to itJohn Keiser2015-06-231-7/+1
|
* Support arrays as input to actions / allowed_actionsjk/3535John Keiser2015-06-161-1/+2
|
* Ensure :nothing is in the list of allowed actions for an LWRPJohn Keiser2015-06-161-1/+1
|
* Move deprecated LWRP class override to the deprecation method registrarJohn Keiser2015-06-031-5/+2
|
* Fix issue #3463: use real constants instead of const_missingJohn Keiser2015-06-031-3/+6
|
* Add default_action and allowed_actions to Resource class, remove from LWRPJohn Keiser2015-06-011-37/+7
|
* Add use_automatic_resource_nameJohn Keiser2015-06-011-1/+1
|
* Move resource_name up to Resource, and figure out its value automaticallyJohn Keiser2015-06-011-25/+4
|
* Merge branch 'master' of https://github.com/Kasen/chef into Kasen-masterThom May2015-05-201-1/+1
|\
| * Behavior of default_action method changed.Pavel Yudin2015-03-271-1/+1
| |
* | Fix LWRP instance.to_s to look like normal resources againjk/fix_lwrp_class_nameJohn Keiser2015-05-181-2/+2
| |
* | Deprecate Chef::Provider::LwrpClass the same way we did ResourceJohn Keiser2015-05-131-4/+4
| |
* | Allow LWRPBase.loaded_lwrps to be called from subclassesJohn Keiser2015-05-131-4/+6
| |
* | Deprecate dsl_name (the "DSL name for this class" is no longer meaningful).John Keiser2015-05-131-96/+96
| |
* | Make sure LWRPBase requires what it uses (fix travis issue)John Keiser2015-05-131-0/+7
| |
* | Move LWRP class deprecation warning to const_missingJohn Keiser2015-05-131-24/+2
| |
* | Remove provides_nothingJohn Keiser2015-05-131-3/+0
| |
* | Add provides_nothing and let it override even Chef::Resource::X automatic namesJohn Keiser2015-05-131-0/+3
| |
* | Deprecate automatic method_missing and Chef::Resource lookupJohn Keiser2015-05-131-18/+50
|/ | | | | - Declare all resource DSL as methods on Chef::DSL::Resources - Declare all definition DSL as methods on Chef::DSL::Definitions
* Revert "Merge pull request #2956 from chef/lcg/deploy-fixes"Jay Mundrawala2015-03-251-0/+8
| | | | | | | | This reverts commit 2603e2153d6ab50179d2278025a51579edb9033f, reversing changes made to a7f5c92960aedf8d5bfc71abbce430ab075e016a. Conflicts: CHANGELOG.md
* nillable deploy resource + nillable LWRP argsLamont Granquist2015-02-231-8/+0
| | | | | | | | | | | | | introduced nillable_set_or_return so that we can actually set a nil value on a resource from the DSL. this fixes the case where you want to do (and we document) setting symlink_before_migrate to nil on the deploy resource. to implement this better also moved up the attribute DSL method to the base Chef::Resource class. all LWRP resources are now nillable as well.
* fix LWRP constant lookupsLamont Granquist2015-02-031-1/+1
| | | | | | | | * providers had the same bug as CHEF-4117 on resources * removed the strict_const_defined method on Chef::Resource since ruby 1.8.7 deprecation made that method entirely trivial * added tests, verified the failure cases really work * todo added since i think we're leaking state in-between tests
* Use default argument values for #define_method and avoid exceptions (ruby < ↵Xabier de Zuazo2015-01-271-3/+2
| | | | 2 specific, issue #2497)
* LWRPBase#attribute: fix the ArgumentError description to include 0 lengthXabier de Zuazo2015-01-271-1/+1
|
* Use #define_method instead of #class_eval (ruby 1.8 specific, issue #2497)Xabier de Zuazo2015-01-271-11/+3
|
* Fix issue where LWRP resources using `provides` failsJay Mundrawala2014-12-051-1/+1
|
* Merge pull request #2197 from opscode/sersut/fixup-chef-1662Serdar Sutay2014-10-091-1/+12
|\ | | | | Keep deprecation of valid_actions until Chef 13.
| * Revert "Remove appending :actions and :valid_actions"Serdar Sutay2014-10-091-1/+12
| | | | | | | | This reverts commit 4aec038d42eae5c3c3bac50aa211d2b69cf54019.
* | Updates based on PR comments.sersut/no-lwrp-class-reloadSerdar Sutay2014-10-091-1/+0
| |
* | Don't override LWRP resources or providers anymore in Chef 12.Serdar Sutay2014-10-081-13/+12
|/
* fixup adding default_actions to actionLamont Granquist2014-07-231-2/+3
| | | | | | | | | | | | if you specify a default_action we don't inherit from the superclass and initialize to an empty array if we have to (otherwise if we inherited from the superclass and later specified actions, we wouldn't get the correct behavior which overrides the superclass, and behavior would shift based on order of actions and default_action in the resource definition). also uses set union to eliminate dups in the (allowed) actions and eliminates dups in both cases.
* Allow an array in default_actionSeth Vargo2014-07-231-3/+9
|
* Remove appending :actions and :valid_actionsSeth Vargo2014-07-181-12/+1
|
* Use defined? to check for instance variablesSeth Vargo2014-07-111-2/+2
|
* Delegate DSL method values to their superclassSeth Vargo2014-07-111-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | When inheriting from +Resource::LWRPBase+, the +default_action+ and +actions+ attributes are set as class instance variables. In Ruby's object model, class instance variables are **not** shared with children. So subclassing a resource that extended from +Resource::LWRPBase+ would result in some unexplainable side-effects: class Chef::Resource::Parent < Chef::Resource::LWRPBase actions :execute default_action :execute end class Child::Resource::Child < Chef::Resource::Parent # In here, +actions+ and +default_action+ are **not** inherited so they # are +nil+! end This commit tells resources that inherit from LWRPBase to check their superclasses for values if they do not have one on their own. This commit also deprecate +valid_actions+ in favor of just using +actions+ in the LWRP DSL.
* Allow default values to be a DelayedEvaluatorSeth Vargo2014-07-111-0/+4
|
* Allow users to set the +resource_name+ in an LWRP programaticallySeth Vargo2014-06-301-7/+16
| | | | | | | | | Previously this was marked as an internal API, but I am making it public. We are reliably using this API in our LHWRPs in Release Engineering and it is truly a delightful experience. This deprecates using +resource_name = :foo+ in favor of the more "Chef-like" +resource_name(:foo)+.