summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* fix Lint/UselessAccessModifier copLamont Granquist2016-08-162-171/+175
|
* autofixing Style/WhileUntilModifier copLamont Granquist2016-08-161-6/+2
|
* autofixing Style/AccessModifierIndentation copLamont Granquist2016-08-161-1/+1
|
* Merge pull request #5154 from chef/tm/cache_invalidateThom May2016-08-025-0/+30
|\ | | | | Invalidate the file system cache on deletion
| * Invalidate the cache on file creationtm/cache_invalidateThom May2016-08-021-0/+2
| | | | | | | | Signed-off-by: Thom May <thom@chef.io>
| * Invalidate the file system cache on deletionThom May2016-08-015-0/+28
| | | | | | | | Signed-off-by: Thom May <thom@may.lt>
* | Root ACLs are a top level json file not a sub-directorytm/fix_acl_filesThom May2016-08-011-2/+4
|/ | | | | | Ensure that we correctly write to them and manage them. Signed-off-by: Thom May <thom@chef.io>
* Cache ChefFS childrentm/cache_fs_childrenThom May2016-07-262-1/+67
| | | | Signed-off-by: Thom May <thom@chef.io>
* Fix for #5027 - Remove bad variable referenceRob Di Marco2016-06-201-1/+1
| | | | | | | A previous change introduced what appears to be a copy/paste bug. A guard condition from the children method was used in the make_child_entry incorrectly. This removes the reference to the non-existent variable `seen`
* Introduce display_name and use itThom May2016-05-059-9/+38
| | | | | | | | This allows us to use the path we produce for other display purposes and consume it internally to have a canonical path for comparisons and printing Signed-off-by: Thom May <thom@may.lt>
* Repository files need to figure out their extensionThom May2016-05-051-1/+14
| | | | Signed-off-by: Thom May <thom@may.lt>
* Remove file extensions from API targetsThom May2016-05-056-10/+19
| | | | Signed-off-by: Thom May <thom@may.lt>
* Allow rest entries to define a display pathThom May2016-05-0511-7/+66
| | | | | This gives us much more control over what an individual entry will display when formatted
* use superclass' can_have_child?Thom May2016-05-0510-39/+0
|
* remove unnecessary initializerThom May2016-05-051-4/+0
|
* Use the newly created file's pathThom May2016-05-051-2/+2
|
* properly deal with loading ruby filesThom May2016-05-055-15/+34
|
* Clean up ACLstm/flow_253Thom May2016-04-213-2/+87
|
* Create childrenThom May2016-04-211-1/+1
|
* client keys need a sub dirThom May2016-04-212-2/+44
|
* Add separate file implementations for all typesThom May2016-04-2123-102/+405
| | | | Update the directory classes to create files that match
* Combine and tidy two of the file_system_entry implsThom May2016-04-214-126/+69
| | | | | This merges together ChefRepositoryFileSystemEntry and FileSystemEntry, since they weren't really being used separately.
* Extract common ChefFS file codeThom May2016-04-211-0/+120
|
* Move unused code into backcompatThom May2016-04-141-33/+0
|
* Move deprecated error classes into backcompatThom May2016-04-148-160/+0
|
* Rename and add backcompat requires for ChefFS dirstm/fs_dirs_2Thom May2016-04-144-12/+16
| | | | | Policies, ACLs, and Client Keys directories are renamed to match the other directories, and backwards compatible requires are added.
* Ensure most directories are subclasses of Directorytm/flow_252Thom May2016-04-1312-35/+374
| | | | | This doesn't yet change the cookbook classes, but everything that is a directory is treated as such.
* ensure directory and file_system_entry are compatibleThom May2016-04-132-2/+25
|
* Move all ChefFS exceptions into a single filetm/combined_chef_fs_exceptionsThom May2016-04-1330-166/+135
| | | | This leaves back compat requires to ensure nothing breaks.
* Merge pull request #4640 from chef/tm/zero_deep_librariesThom May2016-03-151-1/+1
|\ | | | | Support libraries with sub directories
| * Ensure that chef-zero loads libraries recursivelytm/zero_deep_librariesThom May2016-03-031-1/+1
| |
* | remove parensLamont Granquist2016-03-141-1/+1
| |
* | manual fixing for raise unlessLamont Granquist2016-03-141-1/+2
| |
* | chefstyle Style/AndOr fixesLamont Granquist2016-03-141-1/+1
| | | | | | | | | | this is part of our informal style guide, lets make it formal since clearly its not getting followed very well.
* | Merge pull request #4617 from chef/lcg/chefstyle-perfLamont Granquist2016-03-0420-31/+63
|\ \ | |/ |/| Autofixing new Perf cops in 0.37.2
| * add some @yield docsLamont Granquist2016-03-046-5/+37
| | | | | | | | added some FIXMEs because trying to sort out types for random undocumented code was making me completely aggro
| * remove unused block argumentslcg/chefstyle-perfLamont Granquist2016-02-236-6/+6
| |
| * Autofixing new Perf cops in 0.37.2Lamont Granquist2016-02-2320-23/+23
| | | | | | | | | | | | | | | | | | | | 6 Performance/Casecmp 18 Performance/Detect 1 Performance/RangeInclude 27 Performance/RedundantBlockCall 6 Performance/RedundantMatch 5 Performance/RedundantMerge 18 Performance/StringReplacement
* | Add client keys handling to ChefFSJordan Running2016-02-245-7/+76
|/ | | | Supports work to being chef-zero closer to parity with chef-server.
* flip multiline function arguments aroundlcg/rubocop-0.37.2Lamont Granquist2016-02-199-10/+10
| | | | no enforced trailing comma on arguments...