summaryrefslogtreecommitdiff
path: root/lib/chef/dsl
Commit message (Collapse)AuthorAgeFilesLines
* add the resources() dsl method to providerslcg/fix-resources-dsl-methodLamont Granquist2018-04-121-1/+23
| | | | | | | | | | | Custom resource actions were picking this up via delegation to the wrapping resource, and that wiring was removed in 14, so that API then got dropped accidentally. This should fix that back up. It also consistently injects the resource APIs into resources and providers both now (and consistently across core resources and custom resources). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* mechanical conversion of most debug log statements to traceThom May2018-03-262-8/+8
| | | | Signed-off-by: Thom May <thom@chef.io>
* rubocop fixes from engine bump to 0.54.0lcg/rubocop-fixesLamont Granquist2018-03-211-2/+2
| | | | | | some cops got a little stricter. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge branch 'master' into sp/powershell_execStuart Preston2018-03-071-8/+1
|\ | | | | | | Signed-off-by: <>
| * Remove support for Windows 20032k3Tim Smith2018-03-021-8/+1
| | | | | | | | | | | | Windows 2003 is fully end of life at this point and hasn't been supported by Chef for quite a while. EXTENDED support for Windows 2003 ended July 14, 2015. We avoid a good number of WMI queries by removing this support entirely. Signed-off-by: Tim Smith <tsmith@chef.io>
* | Initial commit of new Chef PowerShell supportStuart Preston2018-03-031-0/+2
|/ | | | Signed-off-by: Stuart Preston <stuart@chef.io>
* Remove previously deprecated mixins and Chef::DSL::Recipe::FullDSLchef14_deprecationsTim Smith2018-01-015-32/+6
| | | | | | | | | | | | We wired these up previously with deprecations. They've been deprecated for a long time and are pretty rarely used on the Supermarket. Additionally we have Foodcritic rules to detect their usage: FC102: Deprecated Chef::DSL::Recipe::FullDSL class used FC100: Deprecated Chef::Mixin::Language mixin used FC099: Deprecated Chef::Mixin::LanguageIncludeRecipe mixin used FC098: Deprecated Chef::Mixin::RecipeDefinitionDSLCore mixin used FC097: Deprecated Chef::Mixin::LanguageIncludeAttribute mixin used Signed-off-by: Tim Smith <tsmith@chef.io>
* Deprecate property namespace magicLamont Granquist2017-06-081-1/+9
| | | | | | | This forces everyone to starting using new_resource.property_name instead of just property_name. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: fix notifying array resourcesLamont Granquist2017-03-311-1/+1
| | | | | | | | 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-4/+4
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: Support nameless resources and remove deprecated multi-arg resourcesLamont Granquist2017-03-301-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Simplify DSL creationLamont Granquist2017-03-211-6/+0
| | | | | | | | | | | | | | 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-212-79/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Chef-13: Remove declare_resource create_if_missing APILamont Granquist2017-03-142-18/+12
| | | | | | | | | | | | | Likely nobody cares about this change, I added it and then a release or two later introduced the better edit_resource style of API. I also changed "created_at" to be a proper named parameter, instead of a positional parameter, which is a breaking change in an API that has been around for quite some time -- makes the API consistent since I added it as a named parameter to the new APIs when I wrote them. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix specs: RedundantReturn, RedundantSelf, RedundantBeginLamont Granquist2017-02-135-43/+39
| | | | | | department of redundancy department Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Make docker? return booleanAndrew Brown2016-12-121-2/+2
| | | | | | Trivial change to ensure node.docker? returns either true or false. Signed-off-by: Andrew Brown <andrew.j.brown@gmail.com>
* Structure deprecations with additional metadatatm/deprecation_with_urlThom May2016-11-162-4/+4
| | | | | | | | This adds URLs to each class of deprecation, and correctly prints and formats them for maximum user efficiency. We also provide the URL to the data collector for Visibility to ingest. Signed-off-by: Thom May <thom@chef.io>
* Fix a few bad copyrightsTim Smith2016-10-205-5/+5
| | | | | | I think this happened when we merged the Opscode and Chef copyrights Signed-off-by: Tim Smith <tsmith@chef.io>
* remove dependency on Chef.run_context global stateLamont Granquist2016-10-181-1/+1
| | | | | | introduce run_context.root_run_context that avoids global state Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* remove block_given?lcg/edit_resource_scopeLamont Granquist2016-10-101-2/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* pass new_resource to edit_resource through instance_execLamont Granquist2016-10-101-1/+7
| | | | | | | | | | helps with scoping issues, best practice would be to always use the |new_resource| argument to the block when using edit_resource inside of resources https://github.com/chef/chef/issues/5438 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* disable Style/OptionalArgumentsLamont Granquist2016-08-161-1/+1
| | | | | | | | fixing this would either be hella ugly or would change the API just prevent more of this leaking into the codebase Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Also clear notifications when deleting a resource.Noah Kantrowitz2016-07-281-1/+9
|
* Add `chef_data_bag_item` to Cheffish DSL methodscheffish-data-bag-itemdanielsdeleo2016-07-191-0/+1
|
* Switch to node attributes for docker detectionAndrew Brown2016-05-301-2/+5
| | | | | Using ::File.exists? makes Travis CI sad due to statically looking for files. We'll use node attributes provided by Ohai instead.
* Style fixesAndrew Brown2016-05-301-1/+1
| | | | Fixing rubocop errors found during CI
* File atomic update default: false on docker filesAndrew Brown2016-05-301-0/+13
| | | | | | If unspecified, the default setting for atomic updates on docker special files should be 'false' to avoid Errno::EBUSY. This allows for a cookbook author to override this behaviour if desired.
* typeofix thanks @ranjiblcg/universal-dslLamont Granquist2016-05-171-1/+1
|
* update for feedback from stevenLamont Granquist2016-05-173-0/+3
|
* create 'universal' DSLLamont Granquist2016-05-163-20/+81
| | | | this is for DSL methods that get mixed in everywhere.
* how did that get there?lcg/fix-resources-api-issuesLamont Granquist2016-04-181-1/+1
|
* fix details in with_run_contextLamont Granquist2016-04-181-7/+7
|
* fix ! in yard commentlcg/resources-apiLamont Granquist2016-04-181-1/+1
|
* typofixLamont Granquist2016-04-151-1/+1
|
* add better resource manipulation APILamont Granquist2016-04-151-7/+182
| | | | | deprecates chef_rewind functionality completely and adds a few more features
* add notifying_block and subcontext_block to chefLamont Granquist2016-04-111-5/+7
|
* rearrange dsl mixinslcg/dsl-rearrangementLamont Granquist2016-03-183-63/+132
| | | | | | | | | | | | | | | | | | | | | | | - creates Chef::DSL::MethodMissing which will be nuked in Chef 13 - creates Chef::DSL::Core which is the mixins into core providers - adds build_resource/define_resource to core providers The intent here is to create Chef::DSL::Core which is intended to become the DSL minus method_missing and things that are only intended for recipes. Right now I've only added build_resource/declare_resource to core providers. We should probably push more into the "Core" DSL so that core providers could do things like use the search API. I would have moved everything other than resources and definitions over but the audit mode stuff is really only appropriate for recipes and not provider code and probably should not be moved over. We should probably have an intermediate mixin which is the "Custom Provider" DSL that has Resources and Definitions mixed into it, but which does not mix in the audit stuff that should only go into the Recipe DSL. There may also be a "Resources DSL" which has mixins for use with not_if/only_if and I'm unclear if that should be the "Core DSL" or another fourth mixin of DSL files.
* rub some YARD on deprecation commentLamont Granquist2016-03-171-1/+1
|
* deprecate Chef::DSL::Recipe::FullDSLlcg/deprecate-fulldslLamont Granquist2016-03-161-18/+16
| | | | | | | | this module was created out of a bit of excessive paranoia instead of simply adding mixins that we always use with Chef::DSL::Recipe directly to Chef::DSL::Recipe. lets try and YAGNI this class and just add it directly. these modules are already injected into everyone's recipes and providers, so I can't imagine a huge amount of backcompat breaks.
* lazy module inclusion into DSL moduleslcg/use-and-lazy-module-includeLamont Granquist2016-03-151-2/+7
| | | | | | Chef::DSL::Recipe::FullDSL.send(:include, MyModule) will now patch all its descendants that it has been included into (works the way actual inheritance works now).
* rm unnecessary mutexNathan Williams2016-03-111-4/+1
|
* fix deprecated Thread.exclusive with MutexNathan Williams2016-03-101-1/+2
|
* flip multiline function arguments aroundlcg/rubocop-0.37.2Lamont Granquist2016-02-191-1/+1
| | | | no enforced trailing comma on arguments...
* autofixing whitespace copsLamont Granquist2016-02-0511-31/+26
| | | | | | | | | | | | | | | | | | | | | | 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-029-11/+11
| | | 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-028-8/+8
| | | 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-0213-13/+13
| | | 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"
* Autofixing Style/PercentLiteralDelimeterslcg/percentliteraldelimetersLamont Granquist2016-01-183-6/+6
| | | | | | See chef/chefstyle#11 for analysis and discussion. We select '{}' since audit of our source code shows that is the most common, and that used to be the dominant learning paradigm (e.g. in ruby 1.9 pickaxe book.
* Use double quotes by defaultThom May2016-01-1412-41/+41
| | | | | | | 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-132-2/+2
| | | | chefstyle -a fixed 1044 occurrances