diff options
author | Thom May <thom@chef.io> | 2016-04-13 17:18:13 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-04-13 18:52:09 +0100 |
commit | d4a7d82ae1042a601f768edca3bdb94f81a3a387 (patch) | |
tree | b0dcf7965c6941ea2a29679ebf2a0e0527683bd8 /lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb | |
parent | bf121d46ad8e73b9927bfe3c9a241ecbe9d13c9f (diff) | |
download | chef-d4a7d82ae1042a601f768edca3bdb94f81a3a387.tar.gz |
Ensure most directories are subclasses of Directorytm/flow_252
This doesn't yet change the cookbook classes, but everything that is a
directory is treated as such.
Diffstat (limited to 'lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb')
-rw-r--r-- | lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb index c7209ba634..4457910317 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb @@ -18,9 +18,17 @@ require "chef/chef_fs/file_system/base_fs_dir" require "chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir" +require "chef/chef_fs/file_system/repository/clients_dir" require "chef/chef_fs/file_system/repository/cookbooks_dir" require "chef/chef_fs/file_system/repository/cookbook_artifacts_dir" +require "chef/chef_fs/file_system/repository/containers_dir" require "chef/chef_fs/file_system/repository/data_bags_dir" +require "chef/chef_fs/file_system/repository/environments_dir" +require "chef/chef_fs/file_system/repository/groups_dir" +require "chef/chef_fs/file_system/repository/nodes_dir" +require "chef/chef_fs/file_system/repository/policy_groups_dir" +require "chef/chef_fs/file_system/repository/roles_dir" +require "chef/chef_fs/file_system/repository/users_dir" require "chef/chef_fs/file_system/repository/chef_repository_file_system_client_keys_dir" require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" require "chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir" @@ -166,6 +174,14 @@ class Chef return NonexistentFSObject.new(name, self) end case name + when "acls" + dirs = paths.map { |path| ChefRepositoryFileSystemAclsDir.new(name, self, path) } + when "client_keys" + dirs = paths.map { |path| ChefRepositoryFileSystemClientKeysDir.new(name, self, path) } + when "clients" + dirs = paths.map { |path| ClientsDir.new(name, self, path) } + when "containers" + dirs = paths.map { |path| ContainersDir.new(name, self, path) } when "cookbooks" if versioned_cookbooks dirs = paths.map { |path| VersionedCookbooksDir.new(name, self, path) } @@ -174,36 +190,24 @@ class Chef end when "cookbook_artifacts" dirs = paths.map { |path| CookbookArtifactsDir.new(name, self, path) } - when "policies" - dirs = paths.map { |path| ChefRepositoryFileSystemPoliciesDir.new(name, self, path) } when "data_bags" dirs = paths.map { |path| DataBagsDir.new(name, self, path) } - when "acls" - dirs = paths.map { |path| ChefRepositoryFileSystemAclsDir.new(name, self, path) } - when "client_keys" - dirs = paths.map { |path| ChefRepositoryFileSystemClientKeysDir.new(name, self, path) } + when "environments" + dirs = paths.map { |path| EnvironmentsDir.new(name, self, path) } + when "groups" + dirs = paths.map { |path| GroupsDir.new(name, self, path) } + when "nodes" + dirs = paths.map { |path| NodesDir.new(name, self, path) } + when "policy_groups" + dirs = paths.map { |path| PolicyGroupsDir.new(name, self, path) } + when "policies" + dirs = paths.map { |path| ChefRepositoryFileSystemPoliciesDir.new(name, self, path) } + when "roles" + dirs = paths.map { |path| RolesDir.new(name, self, path) } + when "users" + dirs = paths.map { |path| UsersDir.new(name, self, path) } else - data_handler = case name - when "clients" - Chef::ChefFS::DataHandler::ClientDataHandler.new - when "environments" - Chef::ChefFS::DataHandler::EnvironmentDataHandler.new - when "nodes" - Chef::ChefFS::DataHandler::NodeDataHandler.new - when "policy_groups" - Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new - when "roles" - Chef::ChefFS::DataHandler::RoleDataHandler.new - when "users" - Chef::ChefFS::DataHandler::UserDataHandler.new - when "groups" - Chef::ChefFS::DataHandler::GroupDataHandler.new - when "containers" - Chef::ChefFS::DataHandler::ContainerDataHandler.new - else - raise "Unknown top level path #{name}" - end - dirs = paths.map { |path| ChefRepositoryFileSystemEntry.new(name, self, path, data_handler) } + raise "Unknown top level path #{name}" end MultiplexedDir.new(dirs) end |