summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-04-20 12:53:56 +0100
committerThom May <thom@chef.io>2016-04-21 08:37:08 +0100
commitec211cd56072ffb29db5f3c4ea3745b1757514df (patch)
tree23ee983195844e7757cd84cbf094edf137c8a102 /lib/chef/chef_fs
parentcba4457d9f1ab3be138f73f0dc9640f2f5abc229 (diff)
downloadchef-ec211cd56072ffb29db5f3c4ea3745b1757514df.tar.gz
Clean up ACLstm/flow_253
Diffstat (limited to 'lib/chef/chef_fs')
-rw-r--r--lib/chef/chef_fs/file_system/repository/acl.rb38
-rw-r--r--lib/chef/chef_fs/file_system/repository/acls_dir.rb9
-rw-r--r--lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb42
3 files changed, 87 insertions, 2 deletions
diff --git a/lib/chef/chef_fs/file_system/repository/acl.rb b/lib/chef/chef_fs/file_system/repository/acl.rb
new file mode 100644
index 0000000000..e2ba2e8771
--- /dev/null
+++ b/lib/chef/chef_fs/file_system/repository/acl.rb
@@ -0,0 +1,38 @@
+#
+# Author:: Thom May (<thom@chef.io>)
+# Copyright:: Copyright 2013-2016, Chef Software 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/data_handler/acl_data_handler"
+require "chef/chef_fs/file_system/repository/base_file"
+
+class Chef
+ module ChefFS
+ module FileSystem
+ module Repository
+
+ class Acl < BaseFile
+
+ def initialize(name, parent)
+ @data_handler = Chef::ChefFS::DataHandler::AclDataHandler.new
+ super
+ end
+
+ end
+ end
+ end
+ end
+end
diff --git a/lib/chef/chef_fs/file_system/repository/acls_dir.rb b/lib/chef/chef_fs/file_system/repository/acls_dir.rb
index e2eeca0d42..619031aa70 100644
--- a/lib/chef/chef_fs/file_system/repository/acls_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/acls_dir.rb
@@ -16,8 +16,9 @@
# limitations under the License.
#
-require "chef/chef_fs/file_system/repository/file_system_entry"
+require "chef/chef_fs/file_system/repository/acl"
require "chef/chef_fs/file_system/repository/directory"
+require "chef/chef_fs/file_system/repository/acls_sub_dir"
require "chef/chef_fs/file_system/chef_server/acls_dir"
require "chef/chef_fs/data_handler/acl_data_handler"
@@ -34,7 +35,11 @@ class Chef
protected
def make_child_entry(child_name)
- FileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::AclDataHandler.new)
+ if child_name == "organization.json"
+ Acl.new(child_name, self)
+ else
+ AclsSubDir.new(child_name, self)
+ end
end
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb b/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb
new file mode 100644
index 0000000000..8eee8e1d70
--- /dev/null
+++ b/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb
@@ -0,0 +1,42 @@
+#
+# Author:: Jordan Running (<jr@chef.io>)
+# Copyright:: Copyright 2013-2016, Chef Software 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/acl"
+require "chef/chef_fs/data_handler/acl_data_handler"
+require "chef/chef_fs/file_system/repository/directory"
+
+class Chef
+ module ChefFS
+ module FileSystem
+ module Repository
+ class AclsSubDir < Repository::Directory
+
+ def can_have_child?(name, is_dir)
+ !is_dir && File.extname(name) == ".json"
+ end
+
+ protected
+
+ def make_child_entry(child_name)
+ Acl.new(child_name, self)
+ end
+ end
+ end
+ end
+ end
+end