summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/file_system
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-01-23 16:44:43 -0800
committerdanielsdeleo <dan@getchef.com>2015-01-27 12:46:14 -0800
commit2d847d2caae854f93c0ab5d6de57bf2452dc3e8c (patch)
treec57cd776caa6b4c89506c5ef94871d1557258ca4 /lib/chef/chef_fs/file_system
parent2f817d8d00135abadc9a279e20a448f9ffe91a1c (diff)
downloadchef-2d847d2caae854f93c0ab5d6de57bf2452dc3e8c.tar.gz
Improve policy ChefFS supportpolicyfile-native-api-support
Diffstat (limited to 'lib/chef/chef_fs/file_system')
-rw-r--r--lib/chef/chef_fs/file_system/chef_repository_file_system_policies_dir.rb38
-rw-r--r--lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb7
2 files changed, 42 insertions, 3 deletions
diff --git a/lib/chef/chef_fs/file_system/chef_repository_file_system_policies_dir.rb b/lib/chef/chef_fs/file_system/chef_repository_file_system_policies_dir.rb
new file mode 100644
index 0000000000..42768f10b7
--- /dev/null
+++ b/lib/chef/chef_fs/file_system/chef_repository_file_system_policies_dir.rb
@@ -0,0 +1,38 @@
+#
+# Author:: John Keiser (<jkeiser@opscode.com>)
+# Copyright:: Copyright (c) 2012 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/chef_repository_file_system_entry'
+require 'chef/chef_fs/data_handler/policy_data_handler'
+
+class Chef
+ module ChefFS
+ module FileSystem
+
+ 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
+
diff --git a/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
index 132d6a2b7e..d03baf91fe 100644
--- a/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
@@ -21,12 +21,12 @@ require 'chef/chef_fs/file_system/chef_repository_file_system_entry'
require 'chef/chef_fs/file_system/chef_repository_file_system_acls_dir'
require 'chef/chef_fs/file_system/chef_repository_file_system_cookbooks_dir'
require 'chef/chef_fs/file_system/chef_repository_file_system_data_bags_dir'
+require 'chef/chef_fs/file_system/chef_repository_file_system_policies_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'
require 'chef/chef_fs/data_handler/node_data_handler'
require 'chef/chef_fs/data_handler/role_data_handler'
-require 'chef/chef_fs/data_handler/policy_data_handler'
require 'chef/chef_fs/data_handler/user_data_handler'
require 'chef/chef_fs/data_handler/group_data_handler'
require 'chef/chef_fs/data_handler/container_data_handler'
@@ -34,6 +34,7 @@ require 'chef/chef_fs/data_handler/container_data_handler'
class Chef
module ChefFS
module FileSystem
+
#
# Represents the root of a local Chef repository, with directories for
# nodes, cookbooks, roles, etc. under it.
@@ -158,6 +159,8 @@ class Chef
dirs = paths.map { |path| ChefRepositoryFileSystemCookbooksDir.new(name, self, path) }
elsif name == 'data_bags'
dirs = paths.map { |path| ChefRepositoryFileSystemDataBagsDir.new(name, self, path) }
+ elsif name == 'policies'
+ dirs = paths.map { |path| ChefRepositoryFileSystemPoliciesDir.new(name, self, path) }
elsif name == 'acls'
dirs = paths.map { |path| ChefRepositoryFileSystemAclsDir.new(name, self, path) }
else
@@ -170,8 +173,6 @@ class Chef
Chef::ChefFS::DataHandler::NodeDataHandler.new
when 'roles'
Chef::ChefFS::DataHandler::RoleDataHandler.new
- when 'policies'
- Chef::ChefFS::DataHandler::PolicyDataHandler.new
when 'users'
Chef::ChefFS::DataHandler::UserDataHandler.new
when 'groups'