summaryrefslogtreecommitdiff
path: root/lib/chef/node
Commit message (Collapse)AuthorAgeFilesLines
* fix specs: RedundantReturn, RedundantSelf, RedundantBeginLamont Granquist2017-02-132-11/+9
| | | | | | department of redundancy department Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix comment [ci skip]Lamont Granquist2017-01-111-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix node attribute "unless" API methodsLamont Granquist2017-01-111-6/+5
| | | | | | | | | | closes #5556 corrects behavior to 12.11.x behavior which was lost in the refactor may address #5715 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge pull request #5547 from chef/lcg/unified-integerLamont Granquist2016-11-161-1/+1
|\ | | | | Core: fix Lint/UnifiedInteger cop
| * fix Lint/UnifiedInteger copLamont Granquist2016-11-151-1/+1
| | | | | | | | | | | | believe this becomes necessary for ruby 2.4/3.0 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* | Structure deprecations with additional metadatatm/deprecation_with_urlThom May2016-11-161-3/+3
| | | | | | | | | | | | | | | | 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>
* | Remove debug writeAdam Ward2016-11-161-1/+0
|/ | | | | | | Obvious fix. Introduced in: e57e29b96b75ff7fc04abb7f9db73920b2a5894a Signed-off-by: Adam Ward <adamw@subdesigns.net>
* fix ImmutableArray slicesLamont Granquist2016-11-141-2/+5
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix existing specsLamont Granquist2016-10-312-2/+5
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* add attribute_changed hook to event handlersLamont Granquist2016-10-284-47/+72
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* rename __path to __path__ and __node to __node__lcg/node-path-trackingLamont Granquist2016-10-254-26/+26
| | | | | | | | | | | | consistency with Unchain here: https://github.com/chef/chef/blob/master/lib/chef/decorator/unchain.rb#L23-L24 and with SimpleDelegator: https://ruby-doc.org/stdlib-2.1.0/libdoc/delegate/rdoc/SimpleDelegator.html#method-i-__getobj__ Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* remove breadcrumb stateLamont Granquist2016-10-255-35/+28
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* standardize initializer args for VividMash+ImmutableMashLamont Granquist2016-10-254-30/+31
| | | | | | | | | | | | | | | | | | | if anyone is using these directly this might be a breaking change, although it makes it considerably easier to use VividMash and IMO ImmutableMash is an implementation detail of the deep merge cache and Chef::Node object. we definitely have never documented these APIs, so I think the onus is on the consumer to update their code. VividMash.new() should now work. VividMash.new({ foo: :bar }) should also now work. IDK what object people would have been passing in as the root object before. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* green testsLamont Granquist2016-10-253-6/+5
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix immutablize to add __rootLamont Granquist2016-10-251-2/+2
| | | | | | much less red now Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* savegame for more aggressive refactoringLamont Granquist2016-10-255-29/+28
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* add a deep_merge_cache mixinLamont Granquist2016-10-252-83/+115
| | | | | | gets the inheritence chain correct Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* s/path_tracking/state_tracking and add __root stateLamont Granquist2016-10-254-13/+25
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* add code to implement node path trackingLamont Granquist2016-10-256-75/+198
| | | | | | | | | | via node.__path variable using __underscore format because node["path"] could very well be used and we still have to deal with node.path method_missing horribleness. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Call convert_value in AttrArray constructorGiacomo Bagnoli2016-09-211-1/+21
|
* Convert attributes defined as literal arraysGiacomo Bagnoli2016-09-212-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | VividMash, unlike Mash, does not recursively convert values inside arrays, just the array itself. As such, hashes inside arrays are not converted to *Mash, introducing a behaviour that differs from Chef 11, e.g. having this attr defined node['foo'] = [ { 'attr' => 'value' } ] in Chef 11 `node[:foo][0][:attr]` returns `'value'` while in Chef 12 it returns `nil` This commit fixes VividMash so arrays are recursively converted and the behaviour restored. Plus, immutablize merge_all result, so to be sure that hashes contained in Arrays are properly immutablized as well, so not existing attributes are not automatically vivified (thus returning an empty VividMash instead of nil) This problem was first reported in chef/chef#2871. Signed-off-by: Giacomo Bagnoli <gbagnoli@gmail.com>
* fix Style/BlockDelimiters, Style/MultilineBlockLayout and 0.42.0 engine upgradeLamont Granquist2016-08-171-2/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* autofixing Style/AccessModifierIndentation copLamont Granquist2016-08-161-1/+1
|
* Merge pull request #5103 from chef/lcg/fix-5012Lamont Granquist2016-07-121-2/+2
|\ | | | | add back method_missing support to set_unless
| * fix stray double quoteslcg/fix-5012Lamont Granquist2016-07-111-2/+2
| |
* | fix for #5094 12.12.13 node.default_unless issueLamont Granquist2016-07-081-0/+5
|/ | | | | | note that the node_spec test in this commit is not red on master so it ain't testing the right thing yet, but this fixes the issue in chef-shell...
* Attributes v1.1 changeslcg/attributes-v1.1Lamont Granquist2016-06-274-202/+283
| | | | | | | | | | | - fixes *_unless behavior and set_unless_value_present hack from Chef 12 - simplifies rm_* code - introduces functional read/write/unlink/exist? API - deprecates method_missing access to attributes for Chef 13 - deprecates set/set_unless aliases for Chef 14 - removes MultiMash mess that I wrote for Chef 13 https://github.com/chef/chef/pull/5029 for more details
* autofixing some missed copsLamont Granquist2016-02-051-1/+1
| | | | second round of autofixing for some reason...
* autofixing whitespace copsLamont Granquist2016-02-053-283/+283
| | | | | | | | | | | | | | | | | | | | | | 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-022-3/+3
| | | Generated via git ls-files | xargs perl -pi -e "s/(Author.*?<[^@]+@)(?:opscode\\.com|getchef\\.com)(>)/\\1chef.io\\2/gi"
* Copyright year update for 2016 and massive cleanup.Noah Kantrowitz2016-02-022-2/+2
| | | 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-133-7/+7
| | | | chefstyle -a fixed 1044 occurrances
* tags always an array; fix set_unlessLamont Granquist2015-12-142-3/+3
| | | | | | | previously if the node had a { normal: { tags: nil } } that we read since the key existed (but was nil) we would not initialize with an array. replacing the code with a call to node.set_unless revealed that set_unless was similarly buggy. fixed both issues by fixing set_unless.
* Completing tests for https://github.com/chef/chef/pull/2310, fixes ↵tball/complete-2310tyler-ball2015-02-111-0/+4
| | | | https://github.com/chef/chef/issues/1562
* Use #define_method instead of #class_eval (ruby 1.8 specific, issue #2497)Xabier de Zuazo2015-01-273-27/+15
|
* deep_merge_cache fixes for bugs in 12.0.0Lamont Granquist2015-01-141-4/+4
| | | | | | | | In 12.0.0 we introduced a cache for the merged attributes for the top-level node attribute keys. This fixes this so that node['foo'] and node[:foo] are not cached separately. This also showed up in bugs as issues between node['foo'] access and node.foo access because node.foo is translated into node[:foo].
* WIP: immutabilizing deep mergelcg/remove-knockout-mergeLamont Granquist2014-11-212-1/+7
|
* deleted the last end accidentallyLamont Granquist2014-11-211-2/+4
|
* add more commentaryLamont Granquist2014-11-211-4/+20
|
* add partial deep merge cacheLamont Granquist2014-11-212-1/+53
|
* revert to serdar's deep_merge de-dup versionLamont Granquist2014-11-191-4/+16
|
* fix ImmutableAttributeModification exceptionLamont Granquist2014-11-192-7/+3
|
* remove cache resettingLamont Granquist2014-11-192-9/+0
|
* remove lots of useless deep merge dupingLamont Granquist2014-11-191-2/+2
|
* WIP: lazy deep mergingLamont Granquist2014-11-191-46/+78
|
* fix autovivificationLamont Granquist2014-11-082-31/+78
|
* chef-12 attribute changesLamont Granquist2014-11-082-13/+159
| | | | | | - adding rm, rm_default, rm_normal, rm_override APIs - adding default!, normal! and override! APIs - changing force_default! and force_override! APIs
* [CHEF-5132] ImmutableCollections #to_a and #to_hash methods fixed and improvedXabier de Zuazo2014-03-281-11/+19
|
* [CHEF-3953] ImmutableMash and ImmutableArray should implement to_hash and ↵brianbianco2014-03-281-0/+24
| | | | | | | | to_a respectively - ImmutableMash now implements a to_hash method. This recurses through the ImmutableMash and returns a fully mutable Hash - ImmutableArray now implements a to_a method. This recurses through the ImmutableArray and returns a fully mutable Array - Unit tests added for both of the above methods