diff options
author | John Keiser <john@johnkeiser.com> | 2016-01-14 12:32:54 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2016-01-15 15:04:13 -0800 |
commit | 75fe2f489e3ff3bfbf78df02c5ae2e17c07cc974 (patch) | |
tree | 24d673a64e05b56aa0ed000cb18d1093d33c85f9 | |
parent | 89d6d7dedcc29bb68341c46f917bc522c24b2539 (diff) | |
download | chef-75fe2f489e3ff3bfbf78df02c5ae2e17c07cc974.tar.gz |
Add policies dir that allows directory children
-rw-r--r-- | lib/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb | 38 | ||||
-rw-r--r-- | lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb | 9 |
2 files changed, 43 insertions, 4 deletions
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb new file mode 100644 index 0000000000..91032e6497 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb @@ -0,0 +1,38 @@ +# +# Author:: John Keiser (<jkeiser@opscode.com>) +# Copyright:: Copyright (c) 2013 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/data_handler/policy_data_handler" + +class Chef + module ChefFS + module FileSystem + module Repository + class ChefRepositoryFileSystemPoliciesDir < ChefRepositoryFileSystemEntry + def initialize(name, parent, path = nil) + super(name, parent, path, Chef::ChefFS::DataHandler::PolicyDataHandler.new) + end + + def can_have_child?(name, is_dir) + is_dir && !name.start_with?(".") + end + end + end + end + end +end 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 2add4072ea..8d9f2c21ad 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 @@ -17,11 +17,12 @@ # require "chef/chef_fs/file_system/base_fs_dir" -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" require "chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir" require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir" -require "chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir" require "chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_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" +require "chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir" require "chef/chef_fs/file_system/multiplexed_dir" require "chef/chef_fs/data_handler/client_data_handler" require "chef/chef_fs/data_handler/environment_data_handler" @@ -170,6 +171,8 @@ class Chef end when 'cookbook_artifacts' dirs = paths.map { |path| ChefRepositoryFileSystemVersionedCookbooksDir.new(name, self, path) } + when "policies" + dirs = paths.map { |path| ChefRepositoryFileSystemPoliciesDir.new(name, self, path) } when "data_bags" dirs = paths.map { |path| ChefRepositoryFileSystemDataBagsDir.new(name, self, path) } when "acls" @@ -182,8 +185,6 @@ class Chef Chef::ChefFS::DataHandler::EnvironmentDataHandler.new when "nodes" Chef::ChefFS::DataHandler::NodeDataHandler.new - when "policies" - Chef::ChefFS::DataHandler::PolicyDataHandler.new when "policy_groups" Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new when "roles" |