summaryrefslogtreecommitdiff
path: root/lib/chef/policy_builder
Commit message (Collapse)AuthorAgeFilesLines
* Get lib/ free of spelling violations.Pete Higgins2020-05-181-1/+1
| | | | 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>
* Fix node[:cookbooks] attributeLamont Granquist2019-08-262-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | closes #8817 Note that if any calling code winds up seeing this error message: ``` NoMethodError: undefined method `set_cookbook_attribute' for nil:NilClass ``` That means that the cookbook_collection was set before the node was set on the run_context. That wouldn't be a bug in core chef, that must be fixed in the caller to reverse the order of operations. Since I only made the positional arguments to the run_context constructor optional in Chef-15.0 though I don't expect this breaks any existing code written in the past month or two, but if anything crops up in the future, consider this a definitive statement that the caller must reverse the order of their operations and this error being thrown is a feature not a bug to be fixed. (The fact that we silently aborted rather than threw a NoMethodError on NilClass meant that we shipped this defect -- sometimes defensive programming can be overly defensive and swallow real errors). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolProcLamont Granquist2019-07-051-1/+1
| | | | | | enforce pretzels. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/StringLiteralsInInterpolationLamont Granquist2019-07-052-3/+3
| | | | | | since we use double quotes, be consistent everywhere. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/ClassCheckLamont Granquist2019-07-051-1/+1
| | | | | | convert kind_of? to is_a? Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/AlignArgumentslcg/new-chefstyleLamont Granquist2019-07-022-3/+3
| | | | | | | | | | | | | | this is using: Layout/AlignArguments: Enabled: true EnforcedStyle: with_fixed_indentation the default style can use really excessive whitespace. on starting lines which are already long, it fully indents across to where the arguments start and then begins the line there. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* more distro constants for "Chef"Marc Chamberland2019-05-231-1/+1
| | | | Signed-off-by: Marc Chamberland <mchamberland@pbsc.com>
* More distro constant applicationsMarc Chamberland2019-05-231-1/+1
| | | | Signed-off-by: Marc Chamberland <mchamberland@pbsc.com>
* This hits the ones that are most frequently required.lcg/require-idempotencyLamont Granquist2019-05-201-1/+1
| | | | | | | | | Stops the kernel from scanning through all the activated gems every time in order to resolve names into pathnames. See rubygems/rubygems#2762 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Convert require to require_relativeLamont Granquist2019-05-083-17/+17
| | | | | | | This gives a speed boost since rubygems does not have to scan through every gem in the gemset in order to find the file. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* chef-client => Chef::Dist::CLIENTMarc Chamberland2019-04-261-1/+2
| | | | Signed-off-by: Marc Chamberland <mchamberland@pbsc.com>
* Allow empty strings in -o to result in empty override run listlcg/empty-override-runlistLamont Granquist2019-04-121-4/+4
| | | | | | | | | | | | | | | | | Previously this was not possible. Now you can do this: ``` chef-client -o "" ./foo.rb ``` And it will only run foo.rb and not any of the recipes in your run_list at all. Node will not be saved at the end. Useful to one-shot something like keyrotation (which still needs keys and needs to talk to the chef server API, so this is a different use case from simple chef-apply). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Early alloction of the Chef::RunContextLamont Granquist2019-03-142-22/+27
| | | | | | | | | Allow for allocation of the Chef::RunContext without its arguments and use that to allocate it early. The APIs are kept backcompatible since otherwise this has a decent chance of blowing up something like chefspec. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Remove experimental wording in policyfiles commentTim Smith2019-03-111-7/+1
| | | | | | It's used all over and very much stable at this point Signed-off-by: Tim Smith <tsmith@chef.io>
* Extract Action Collection from Data CollectorLamont Granquist2019-03-113-6/+18
| | | | | | See the PR for details on this change. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* change HTTPServerException to HTTPClientException for ruby 2.6Lamont Granquist2019-01-031-1/+1
| | | | | | includes backcompat for 2.5 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Always run policy_file if a policy_file or policy_group existspolicy_files_alwaysTim Smith2018-11-091-1/+1
| | | | | | Remove the config to turn it off Signed-off-by: Tim Smith <tsmith@chef.io>
* replace some instances of to_hash with to_hlcg/to-h-cleanupLamont Granquist2018-09-261-3/+5
| | | | | | | | | | | to_hash on a lot of these objects should go away, but even eliminating all our calls to to_hash on these objects internally is difficult. (e.g. converting the knife ui code to call #to_h means we wind up calling nil#to_h which "helpfully" becomes '{}' which is hilarious and i don't know why someone thought that was a good idea). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/HashSyntaxLamont Granquist2018-07-021-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* mechanical conversion of most debug log statements to traceThom May2018-03-263-4/+4
| | | | Signed-off-by: Thom May <thom@chef.io>
* RFC 106: expose name and chef_environment as attrstm/chef_environmentThom May2018-03-091-0/+6
| | | | | | | We also now set chef_environment the same as policy group when that's appropriate Signed-off-by: Thom May <thom@chef.io>
* Remove redundant defensive codeJon Cowie2018-03-051-4/+1
| | | | Signed-off-by: Jon Cowie <jonlives@gmail.com>
* Add attribute hoisting into coreJon Cowie2018-03-011-0/+13
| | | | | | This commit implements RFC-105 and adds specs to verify attribute hoisting is working correctly in conjunction with existing attributes. Signed-off-by: Jon Cowie <jonlives@gmail.com>
* Properly send run_list_expanded event in policy node casetc/fix-expanded-run-list-reporting-for-policyfilesTyler Cloke2017-06-201-1/+27
| | | | Signed-off-by: Tyler Cloke <tylercloke@gmail.com>
* RFC 67: Remove cookbook segmentsThom May2017-04-042-7/+9
| | | | | | | | | This implements RFC 67, which removes cookbook segments, and moves to a single list of all the files contained in a cookbook. This allows us to move forward with better audit modes and also proper shipping of ohai plugins. Signed-off-by: Thom May <thom@chef.io>
* Chef-13: Remove Chef::PolicyBuilder::ExpandNodeObject#load_nodeLamont Granquist2017-02-281-28/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge pull request #5410 from johnbellone/masterThom May2017-01-171-0/+1
|\ | | | | Add the policyfile revision_id as an automatic attribute.
| * Add the policyfile revision_id as an automatic attribute.John Bellone2016-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | /cc @coderanger @danielsdeleo We have been looking for an easy way to get this value into our error reporting application and it surprised me that it isn't already captured. If there's a better way to do this totally open for thoughts! Signed-off-by: John Bellone <jbellone@bloomberg.net>
* | Structure deprecations with additional metadatatm/deprecation_with_urlThom May2016-11-161-1/+1
|/ | | | | | | | 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>
* Ensure that solo specific code is run at the proper timeThom May2016-05-163-5/+5
| | | | | | ie, only when we're in OG mode and not in local mode. Signed-off-by: Thom May <thom@chef.io>
* fix specsLamont Granquist2016-03-141-3/+3
|
* manual fixing for raise unlessLamont Granquist2016-03-141-9/+5
|
* chefstyle Style/AndOr fixesLamont Granquist2016-03-142-10/+10
| | | | | this is part of our informal style guide, lets make it formal since clearly its not getting followed very well.
* Merge pull request #4478 from chef/lcg/rfc-060-gem-metadataLamont Granquist2016-03-032-2/+8
|\ | | | | RFC-060 gem metadata MVP
| * get the formatting for cookbook gems correctLamont Granquist2016-02-092-5/+5
| | | | | | | | | | | | | | | | | | | | this leverages the PR: https://github.com/bundler/bundler/pull/4245 to redirect output from bundler into chef's logger/formatter to get the UI right. if you don't have that in the external bundler you'll just get output on STDOUT. fix is to upgrade bundler.
| * RFC-060 gem metadata MVPLamont Granquist2016-02-092-0/+6
| |
* | deal with 0.37.2 renamed copsLamont Granquist2016-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 252 Style/TrailingCommaInLiteral 84 Style/TrailingCommaInArguments 15 Style/SpaceAroundKeyword -- 351 Total We already dealt with SpaceAroundKeyword under its old name SpaceBeforeModifierKeyword, it looks like it got stricter about spaces after keywords. TrailingComma also got split, and it looks like the TrailingCommaInArguments behavior is new?
* | Merge pull request #4573 from chef/lcg/bump-rubocopLamont Granquist2016-02-121-3/+3
|\ \ | | | | | | pull rubocop 0.37.2 into chefstyle
| * | convert MultilineOperationIndentation style to "indented"Lamont Granquist2016-02-122-4/+4
| | | | | | | | | | | | this looks nicer.
| * | pull rubocop 0.37.2 into chefstyleLamont Granquist2016-02-121-1/+1
| |/ | | | | | | | | this is from the same ruleset that we had, but the new code catches more conditions.
* | Inflating the cookbook version object in policyfile compat modeandy-dufour2016-02-121-1/+1
|/
* autofixing whitespace copsLamont Granquist2016-02-053-8/+7
| | | | | | | | | | | | | | | | | | | | | | 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-8/+8
| | | 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-023-3/+3
| | | 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-143-20/+20
| | | | | | | 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.
* really fix copslcg/really-fix-copsLamont Granquist2016-01-121-4/+4
|
* Convert all uses of Chef::REST to Chef::ServerAPItm/no_more_restThom May2016-01-113-6/+10
| | | | | | | In the process, stop auto-expanding JSON in the HTTP client, and let individual classes control that themselves. Fixes #2737, Fixes #3518
* validateLamont Granquist2015-10-262-0/+3
|
* Added run list expansion json conversion. Creates a json tree from the run ↵kyleen/addExpandedRunListKyleen MacGugan2015-10-211-0/+1
| | | | | | | | | | list expansion trace. Added event to report expanded run list Updated json conversion to use chef compat json. Remove RunListExpansion from JsonCompat