summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs
Commit message (Collapse)AuthorAgeFilesLines
* replace some instances of to_hash with to_hlcg/to-h-cleanupLamont Granquist2018-09-262-3/+3
| | | | | | | | | | | 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/MutableConstantLamont Granquist2018-07-025-5/+5
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/PreferredHashMethodsLamont Granquist2018-07-022-6/+6
| | | | | | | absolutely hard requirement on the fixes that went into chef-config 2.2.11, so the floor of that gem is bumped up. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/UnneededInterpolationLamont Granquist2018-07-021-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/DotPositionLamont Granquist2018-07-024-12/+12
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/HashSyntaxLamont Granquist2018-07-029-15/+15
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* added one more rspec testJeremy J. Miller2018-05-161-2/+2
| | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* object validation for DataHandlerBase#normalize_hashJeremy J. Miller2018-05-151-3/+7
| | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* Revert "cookbooks metadata are used instead of directory name"lcg/actuall-test-cheffsLamont Granquist2018-04-231-18/+32
| | | | This reverts commit 85653e8f25c19273fde0d8d512db29ef13c2a579.
* Revert "fix Chef-14 chef_fs/chef-zero perf regression"Lamont Granquist2018-04-231-27/+19
| | | | This reverts commit 79c8782bbc9ca07898bda6ff9a3a7cdcc39bcdcf.
* fix Chef-14 chef_fs/chef-zero perf regressionlcg/chef-zero-perfLamont Granquist2018-04-101-19/+27
| | | | | | | | | | | | | | | | | | Fixes a perf bug introduced by #6471 where we were taking O(n^2) with the number of cookbook versions in the cookbook synch phase. This is a minimum viable fix that changes the algorithm so that it does the old, fast method of looking up the CBV first. Only if it doesn't find it does it then go searching for cookbooks that are in a differently named directory but which match by the name in the metadata. There may be edge conditions here if people mix-and-match and have cookbooks which have both named-directory and name-in-metadata versions. Please try not to do that. Don't cross the streams. 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>
* rubocop fixes from engine bump to 0.54.0lcg/rubocop-fixesLamont Granquist2018-03-211-9/+9
| | | | | | some cops got a little stricter. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge pull request #6838 from chef/revert-6773-revert-6770-tm/ruby_25Lamont Granquist2018-03-121-2/+2
|\ | | | | Bump to ruby 2.5.0
| * chef_fs fix for ruby 2.5Lamont Granquist2018-03-091-2/+2
| | | | | | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* | Fix some yard warningsyard_warningsTim Smith2018-03-112-2/+2
|/ | | | | | More Rubymine warnings Signed-off-by: Tim Smith <tsmith@chef.io>
* fix chefstyletm/fix_chefstyle_againThom May2018-02-201-3/+3
| | | | Signed-off-by: Thom May <thom@chef.io>
* check identifier to resolve exported cookbooks by chef exportsawanoboly2018-02-151-1/+4
| | | | Signed-off-by: SAWANOBORI Yukihiko <sawanoboriyu@higanworks.com>
* Merge pull request #6471 from dimsh99/fix_for_4816Thom May2018-02-141-31/+14
|\ | | | | Fix to use cookbook name in local mode or chef-zero
| * Merge upstreamDmitry Shestoperov2018-02-132-1/+6
| |\
| * | cookbooks metadata are used instead of directory namedmitrys2017-10-031-31/+14
| | | | | | | | | | | | Signed-off-by: dmitrys <dmitrys@northernlight.com>
* | | Merge pull request #6463 from MarkGibbons/invites_sort_failLamont Granquist2018-02-121-1/+1
|\ \ \ | | | | | | | | invites_sort_fail: Clean the invites array before sorting it
| * | | invites_sort_fail: Clean the invites array before sorting itmarkgibbons2017-09-291-1/+1
| |/ / | | | | | | | | | | | | | | | | | | Sort threw an error trying to compare nil with a string while running knife ec backup. This change deletes the nil entries before sorting. Signed-off-by: markgibbons <mark.gibbons@nordstrom.com>
* | | prepping for rubocop 0.52.1lcg/rubocop-0.52.1Lamont Granquist2018-01-173-5/+5
| | | | | | | | | | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* | | Merge pull request #6652 from sandratiffin/CHEF-3058Tim Smith2017-12-191-1/+1
|\ \ \ | | | | | | | | fix for data bag names partially matching search reserved words
| * | | fix for data bag names partially matching search reserved wordsSandra Tiffin2017-12-121-1/+1
| | |/ | |/| | | | | | | Signed-off-by: Sandra Tiffin <sandi.tiffin@gmail.com>
* | | Cleanup some YARD warningsyard2Tim Smith2017-12-131-4/+2
|/ / | | | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* | Remove cookbook_artifacts from CHEF_11_OSS_STATIC_OBJECTSjjh/chef11-cb-artifact-404Josh Hudson2017-10-061-1/+1
| | | | | | | | Signed-off-by: Josh Hudson <jhudson@chef.io>
* | Don't allow creation of data bags named node, role, client or environment ↵Sandra Tiffin2017-10-041-0/+5
|/ | | | | | | | via 'knife upload'. (Fixes the ChefFS code path for data bag creation, for https://github.com/chef/chef/issues/3058). Signed-off-by: Sandra Tiffin <sandi.tiffin@gmail.com>
* Merge pull request #5850 from criteo-forks/rb_supportThom May2017-04-041-1/+1
|\ | | | | Add real support for rb files (at least roles) in knife-serve
| * Ensure ruby nodes are supported in knife serveGrégoire Seux2017-03-061-1/+1
| | | | | | | | | | Change-Id: I4788cac16864c7eb5a876890e9fe41485af80d46 Signed-off-by: Grégoire Seux <g.seux@criteo.com>
| * Support ruby role in knife serveGrégoire Seux2017-03-061-1/+1
| | | | | | | | | | Change-Id: I1076b918e9153f21b4c49d77054899111106eb74 Signed-off-by: Grégoire Seux <g.seux@criteo.com>
* | RFC 67: Remove cookbook segmentsThom May2017-04-046-36/+34
| | | | | | | | | | | | | | | | | | 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>
* | invalidate @this_object_cache also in writeJeremy J. Miller2017-03-101-0/+3
| | | | | | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* | rename target_object to this_object_cacheJeremy J. Miller2017-03-091-5/+5
| | | | | | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* | free up target_object on deleteJeremy J. Miller2017-03-091-0/+2
| | | | | | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* | moved commentJeremy J. Miller2017-03-091-1/+1
| | | | | | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* | add target_object cacheJeremy J. Miller2017-03-081-3/+6
| | | | | | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* | testing short circuiting _read_jsonJeremy J. Miller2017-03-081-2/+3
|/ | | | Signed-off-by: Jeremy J. Miller <jm@chef.io>
* fix specs: RedundantReturn, RedundantSelf, RedundantBeginLamont Granquist2017-02-1328-208/+178
| | | | | | department of redundancy department Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Grant Administrators group permissions to nodes directory under chef-solo ↵Tom Duffield2017-02-062-0/+5
| | | | | (#5781) Signed-off-by: Tom Duffield <tom@chef.io>
* Fix error thrown by solo when run on Windows as SYSTEMScott Christopherson2017-01-032-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Chef::ReservedNames::Win32::Security::SID.current_user` throws an error when `chef-solo` is being run as a `SYSTEM` user: ``` ================================================================================ Chef encountered an error attempting to load the node data for "WIN-00P0BGAA4IV" ================================================================================ Unknown Server Error: --------------------- The server had a fatal error attempting to load the node data. Server Response: ---------------- Exception raised! #<Chef::Exceptions::Win32APIError: No mapping between account names and security IDs was done. ---- Begin Win32 API output ---- System Error Code: 1332 System Error Message: No mapping between account names and security IDs was done. ---- End Win32 API output ---- > c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/win32/error.rb:81:in `raise!' c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/win32/security.rb:383:in `lookup_account_name' c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/win32/security/sid.rb:44:in `from_account' c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/win32/security/sid.rb:241:in `current_user' c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/chef_fs/file_system/repository/nodes_dir.rb:41:in `create_child' ``` This commit modfies these calls to use `SID.default_security_object_owner` instead which will return `SID.Administrators` for users such as `SYSTEM` and then returns `SID.current_user` for everyone else. Signed-off-by: Scott Christopherson <scott@chef.io>
* [cheffs] Don't iterate parent object on exist? callssd/chef-fs-n-squaredSteven Danna2016-12-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this code determined if an object existed by doing the following: parent.children.any? { |child| child.api_child_name == api_child_name } For organizations and object types with a small number of total objects, this wasn't problematic; however, it has very bad worst-case behavior. For example, if a user was attempting to restore an organization with 30k client records to an empty organization, each client upload would do the following: 1. Run GET /clients 2. Iterate the list returned in (1) normalizing the clients names along the way. 3. Upload the client via POST when exist? returned false. When the clients don't exist, this means step (2) will always iterate over every member returned in step (1). By the time you get into the 1000s of clients, this iteration dominates the running time of the process. For instance, consider the following ruby profile data: Measure Mode: wall_time Thread ID: 16939380 Fiber ID: 22163920 Total: 109.860468 Sort by: self_time %self total self wait child calls name 26.83 29.475 29.475 0.000 0.000 500 <Class::IO>#select 8.60 38.876 9.446 0.000 29.430 464125 <Class::Chef::ChefFS::PathUtils>#join 7.02 12.226 7.717 0.000 4.509 928750 Chef::ChefFS::FileSystem::ChefServer::RestListEntry#api_child_name 6.79 7.459 7.459 0.000 0.000 930250 String#gsub 5.31 5.834 5.834 0.000 0.000 2320625 <Class::Chef::ChefFS::PathUtils>#regexp_path_separator 3.33 3.654 3.654 0.000 0.000 500 OpenSSL::X509::Store#set_default_paths 3.28 42.482 3.606 0.000 38.876 464125 Chef::ChefFS::FileSystem::BaseFSObject#initialize 2.95 3.244 3.244 0.000 0.000 930250 <Class::File>#extname 2.29 48.421 2.513 0.000 45.908 483375 *Class#new 38 wall clock seconds spent in PathUtils.join (part of the name normalization during the list walk) Note, an alternative might be to skip the exist? check completely, opting to blindly POST and then rescuing the 409 and retry with a PUT. Experimentation shows that PathUtils.join can also be improved substantially; however, I'll leave those for a follow-up PR. Signed-off-by: Steven Danna <steve@chef.io>
* Merge pull request #5548 from chef/lcg/chefstyle-updatesThom May2016-12-072-2/+2
|\ | | | | Chefstyle updates
| * fix Style/NilComparisonLamont Granquist2016-12-061-1/+1
| | | | | | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
| * fix Style/SelfAssignmentLamont Granquist2016-12-061-1/+1
| | | | | | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* | Ensure chef-solo creates node files w/ correct permissionsCOOL-604/chef-solo-node-permissionsScott Christopherson2016-12-062-1/+31
|/ | | | | | | This commit ensures that the `nodes` dir and the node files within it are created with the correct permissions by chef-solo. Signed-off-by: Scott Christopherson <scott@chef.io>
* Fixed knife download cookbooks issue which used to corrupt the certificate ↵aliasgar162016-10-271-7/+3
| | | | | | files each time the command was fired. Signed-off-by: aliasgar16 <aliasgar.batterywala@msystechnologies.com>
* More Opscode -> Chef updatesTim Smith2016-10-201-1/+1
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* fix Style/BlockDelimiters, Style/MultilineBlockLayout and 0.42.0 engine upgradeLamont Granquist2016-08-171-2/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>