summaryrefslogtreecommitdiff
path: root/lib/chef/policy_builder/policyfile.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove copyright dateslcg/remove-copyright-datesLamont Granquist2020-04-131-1/+1
| | | | | | | | 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-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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/StringLiteralsInInterpolationLamont Granquist2019-07-051-2/+2
| | | | | | 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-021-1/+1
| | | | | | | | | | | | | | 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>
* Convert require to require_relativeLamont Granquist2019-05-081-6/+6
| | | | | | | 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>
* Early alloction of the Chef::RunContextLamont Granquist2019-03-141-3/+6
| | | | | | | | | 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-111-0/+4
| | | | | | 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>
* 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>
* mechanical conversion of most debug log statements to traceThom May2018-03-261-2/+2
| | | | 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-041-6/+7
| | | | | | | | | 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>
* 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>
* Ensure that solo specific code is run at the proper timeThom May2016-05-161-1/+1
| | | | | | 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-141-9/+9
| | | | | 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-031-1/+3
|\ | | | | RFC-060 gem metadata MVP
| * get the formatting for cookbook gems correctLamont Granquist2016-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | 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-091-0/+2
| |
* | Inflating the cookbook version object in policyfile compat modeandy-dufour2016-02-121-1/+1
|/
* autofixing whitespace copsLamont Granquist2016-02-051-3/+2
| | | | | | | | | | | | | | | | | | | | | | 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-021-4/+4
| | | 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-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-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.
* Convert all uses of Chef::REST to Chef::ServerAPItm/no_more_restThom May2016-01-111-2/+2
| | | | | | | 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-261-0/+1
|
* Remove experimental feature warning for policyfilesremove-policyfile-warningdanielsdeleo2015-09-241-6/+4
| | | | Also, improve the language around unsupported features/options.
* Apply a named_run_list in policy builder via configurationdanielsdeleo2015-09-211-1/+35
|
* Add `setup_chef_class` to Policyfile policy builderdanielsdeleo2015-09-171-1/+71
| | | | Also, mark internal public API as @private
* Set the precedence of policyfile attrs and propagate them everywheredanielsdeleo2015-09-171-0/+43
|
* Use the dynamic policy builder everywheredanielsdeleo2015-09-171-10/+2
|
* Display policy name and ID during the chef rundanielsdeleo2015-05-221-0/+1
|
* add resource_resolver and resource_priority_mapLamont Granquist2015-04-151-1/+0
| | | | also wire them up through the Chef class.
* Handle cookbook artfact format differences when fetching cookbookspolicyfile-erchef-integrationdanielsdeleo2015-03-251-1/+5
| | | | | | | | | Cookbook artifacts differ in these ways: * the name field is the cookbook name instead of name+version * there is no "cookbook_name" field * cookbook artifacts don't have a json_class when downloaded from the server * there is an identifier field
* Update policyfile URLs and cookbook artifact data format per RFCdanielsdeleo2015-03-251-4/+4
|
* Include relative URLs in error messagesdanielsdeleo2015-02-121-4/+6
|
* Fetch cookbooks from cookbook_artifacts/ in native api modedanielsdeleo2015-02-121-7/+27
|
* Add policyfile native support to policy builderdanielsdeleo2015-01-271-1/+22
|
* Make FileVendor configuration specific to the two implementationsdanielsdeleo2014-07-301-4/+1
| | | | | | | | | | | | | | | | FileVendor previously was configured by storing a closure/anonymous function as a class instance variable. This had the following downsides: * The API was too general, which caused a lot of code repetition * The block was lazily evaluated, which hid errors and made testing more difficult * The closures captured references to classes with references to large data structures, which complicates GC. Since we've only ever had the same two implementations of FileVendor, we can encapsulate configuration of the FileVendor factory by wrapping each configuration option in a method. As a side benefit, arguments to these methods will be eagerly evaluated, which makes it easier to detect errors.
* Fixed environment chop -> chomp issue which truncated single character ↵Joe Richards2014-03-281-1/+1
| | | | environment names to empty strings
* [CHEF-3506] suppress final node save when using override run listdanielsdeleo2014-02-031-0/+6
|