From 46e45b16358471e6e339fba4b126d97652fa5f32 Mon Sep 17 00:00:00 2001 From: Thom May Date: Mon, 18 Apr 2016 18:47:13 +0100 Subject: Add separate file implementations for all types Update the directory classes to create files that match --- .../chef_fs/file_system/repository/acls_dir.rb | 4 +- lib/chef/chef_fs/file_system/repository/client.rb | 38 ++++++++++ .../chef_fs/file_system/repository/client_key.rb | 38 ++++++++++ .../file_system/repository/client_keys_dir.rb | 4 +- .../chef_fs/file_system/repository/clients_dir.rb | 4 +- .../chef_fs/file_system/repository/container.rb | 38 ++++++++++ .../file_system/repository/containers_dir.rb | 4 +- .../file_system/repository/cookbooks_dir.rb | 1 - .../file_system/repository/data_bag_item.rb | 82 +--------------------- .../chef_fs/file_system/repository/environment.rb | 38 ++++++++++ .../file_system/repository/environments_dir.rb | 4 +- lib/chef/chef_fs/file_system/repository/group.rb | 38 ++++++++++ .../chef_fs/file_system/repository/groups_dir.rb | 4 +- lib/chef/chef_fs/file_system/repository/node.rb | 38 ++++++++++ .../chef_fs/file_system/repository/nodes_dir.rb | 4 +- .../chef_fs/file_system/repository/policies_dir.rb | 4 +- lib/chef/chef_fs/file_system/repository/policy.rb | 38 ++++++++++ .../chef_fs/file_system/repository/policy_group.rb | 38 ++++++++++ .../file_system/repository/policy_groups_dir.rb | 4 +- lib/chef/chef_fs/file_system/repository/role.rb | 38 ++++++++++ .../chef_fs/file_system/repository/roles_dir.rb | 4 +- lib/chef/chef_fs/file_system/repository/user.rb | 38 ++++++++++ .../chef_fs/file_system/repository/users_dir.rb | 4 +- 23 files changed, 405 insertions(+), 102 deletions(-) create mode 100644 lib/chef/chef_fs/file_system/repository/client.rb create mode 100644 lib/chef/chef_fs/file_system/repository/client_key.rb create mode 100644 lib/chef/chef_fs/file_system/repository/container.rb create mode 100644 lib/chef/chef_fs/file_system/repository/environment.rb create mode 100644 lib/chef/chef_fs/file_system/repository/group.rb create mode 100644 lib/chef/chef_fs/file_system/repository/node.rb create mode 100644 lib/chef/chef_fs/file_system/repository/policy.rb create mode 100644 lib/chef/chef_fs/file_system/repository/policy_group.rb create mode 100644 lib/chef/chef_fs/file_system/repository/role.rb create mode 100644 lib/chef/chef_fs/file_system/repository/user.rb 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 897a182708..e2eeca0d42 100644 --- a/lib/chef/chef_fs/file_system/repository/acls_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/acls_dir.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/file_system_entry" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/chef_server/acls_dir" require "chef/chef_fs/data_handler/acl_data_handler" @@ -34,7 +34,7 @@ class Chef protected def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::AclDataHandler.new) + FileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::AclDataHandler.new) end end end diff --git a/lib/chef/chef_fs/file_system/repository/client.rb b/lib/chef/chef_fs/file_system/repository/client.rb new file mode 100644 index 0000000000..6a99b7f005 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/client.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/client_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class Client < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::ClientDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/client_key.rb b/lib/chef/chef_fs/file_system/repository/client_key.rb new file mode 100644 index 0000000000..8ca4f85d2f --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/client_key.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/client_key_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class ClientKey < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::ClientKeyDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/client_keys_dir.rb b/lib/chef/chef_fs/file_system/repository/client_keys_dir.rb index 0cdc25569e..5e8c12080f 100644 --- a/lib/chef/chef_fs/file_system/repository/client_keys_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/client_keys_dir.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/client_key" require "chef/chef_fs/data_handler/client_key_data_handler" require "chef/chef_fs/file_system/repository/directory" @@ -33,7 +33,7 @@ class Chef protected def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::ClientKeyDataHandler.new) + ClientKey.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/clients_dir.rb b/lib/chef/chef_fs/file_system/repository/clients_dir.rb index 6e23a6b8be..31aa80a28f 100644 --- a/lib/chef/chef_fs/file_system/repository/clients_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/clients_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/client" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/exceptions" @@ -31,7 +31,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::ClientDataHandler.new) + Client.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/container.rb b/lib/chef/chef_fs/file_system/repository/container.rb new file mode 100644 index 0000000000..e14a2ded73 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/container.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/container_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class Container < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::ContainerDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/containers_dir.rb b/lib/chef/chef_fs/file_system/repository/containers_dir.rb index b5ff84be7b..0fe541417a 100644 --- a/lib/chef/chef_fs/file_system/repository/containers_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/containers_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/container" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/exceptions" @@ -32,7 +32,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::ContainerDataHandler.new) + Container.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb index e1092f112b..0fd249a2c4 100644 --- a/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb @@ -17,7 +17,6 @@ # require "chef/chef_fs/file_system/repository/directory" -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir" require "chef/cookbook/chefignore" diff --git a/lib/chef/chef_fs/file_system/repository/data_bag_item.rb b/lib/chef/chef_fs/file_system/repository/data_bag_item.rb index a1cff5d1b8..2e3fb39606 100644 --- a/lib/chef/chef_fs/file_system/repository/data_bag_item.rb +++ b/lib/chef/chef_fs/file_system/repository/data_bag_item.rb @@ -17,97 +17,21 @@ # require "chef/chef_fs/data_handler/data_bag_item_data_handler" +require "chef/chef_fs/file_system/repository/base_file" class Chef module ChefFS module FileSystem module Repository - class DataBagItem - - attr_reader :name - attr_reader :parent - attr_reader :path - attr_reader :file_path + class DataBagItem < BaseFile def initialize(name, parent) - @parent = parent - @name = name - @path = Chef::ChefFS::PathUtils.join(parent.path, name) @data_handler = Chef::ChefFS::DataHandler::DataBagItemDataHandler.new - @file_path = "#{parent.file_path}/#{name}" - end - - # Public API callied by chef_fs/file_system - def dir? - false - end - - def name_valid? - !name.start_with?(".") && name.end_with?(".json") - end - - def fs_entry_valid? - name_valid? && File.file?(file_path) - end - - def create(file_contents) - if exists? - raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, self) - else - write(file_contents) - end - end - - def can_have_child?(name, is_dir) - false - end - - def write_pretty_json=(value) - @write_pretty_json = value - end - - def write_pretty_json - @write_pretty_json.nil? ? root.write_pretty_json : @write_pretty_json + super end - def path_for_printing - file_path - end - - def delete(recurse) - File.delete(file_path) - rescue Errno::ENOENT - raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) - end - - def exists? - File.exists?(file_path) - end - - def read - begin - File.open(file_path, "rb") { |f| f.read } - rescue Errno::ENOENT - raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) - end - end - - def write(content) - File.open(file_path, "wb") do |file| - file.write(content) - end - end - - def root - parent.root - end - - def compare_to(other) - nil - end end - end end end diff --git a/lib/chef/chef_fs/file_system/repository/environment.rb b/lib/chef/chef_fs/file_system/repository/environment.rb new file mode 100644 index 0000000000..9ef9741308 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/environment.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/environment_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class Environment < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::EnvironmentDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/environments_dir.rb b/lib/chef/chef_fs/file_system/repository/environments_dir.rb index 50b6dbefca..2c9b31b29b 100644 --- a/lib/chef/chef_fs/file_system/repository/environments_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/environments_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/environment" require "chef/chef_fs/data_handler/environment_data_handler" require "chef/chef_fs/file_system/repository/directory" @@ -32,7 +32,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::EnvironmentDataHandler.new) + Environment.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/group.rb b/lib/chef/chef_fs/file_system/repository/group.rb new file mode 100644 index 0000000000..302e72739b --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/group.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/group_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class Group < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::GroupDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/groups_dir.rb b/lib/chef/chef_fs/file_system/repository/groups_dir.rb index f9ca4956b0..e307000ad8 100644 --- a/lib/chef/chef_fs/file_system/repository/groups_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/groups_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/group" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/exceptions" @@ -32,7 +32,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::GroupDataHandler.new) + Group.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/node.rb b/lib/chef/chef_fs/file_system/repository/node.rb new file mode 100644 index 0000000000..d8f0dec7c4 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/node.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/node_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class Node < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::NodeDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/nodes_dir.rb b/lib/chef/chef_fs/file_system/repository/nodes_dir.rb index 7263dc3132..d04bea0de2 100644 --- a/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/nodes_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/node" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/exceptions" @@ -32,7 +32,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::NodeDataHandler.new) + Node.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/policies_dir.rb b/lib/chef/chef_fs/file_system/repository/policies_dir.rb index 47a93f6655..c74ea5469b 100644 --- a/lib/chef/chef_fs/file_system/repository/policies_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/policies_dir.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/policy" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/data_handler/policy_data_handler" @@ -33,7 +33,7 @@ class Chef protected def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::PolicyDataHandler.new) + Policy.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/policy.rb b/lib/chef/chef_fs/file_system/repository/policy.rb new file mode 100644 index 0000000000..695bf17e83 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/policy.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/policy_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class Policy < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::PolicyDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/policy_group.rb b/lib/chef/chef_fs/file_system/repository/policy_group.rb new file mode 100644 index 0000000000..e4182847b6 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/policy_group.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/policy_group_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class PolicyGroup < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb b/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb index 314c375879..020464a634 100644 --- a/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/policy_group" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/exceptions" @@ -32,7 +32,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new) + PolicyGroup.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/role.rb b/lib/chef/chef_fs/file_system/repository/role.rb new file mode 100644 index 0000000000..d97ae0e7a1 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/role.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/role_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class Role < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::RoleDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/roles_dir.rb b/lib/chef/chef_fs/file_system/repository/roles_dir.rb index e3acd3a730..f59af093bb 100644 --- a/lib/chef/chef_fs/file_system/repository/roles_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/roles_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/role" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/exceptions" @@ -32,7 +32,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::RoleDataHandler.new) + Role.new(child_name, self) end end end diff --git a/lib/chef/chef_fs/file_system/repository/user.rb b/lib/chef/chef_fs/file_system/repository/user.rb new file mode 100644 index 0000000000..59355cc303 --- /dev/null +++ b/lib/chef/chef_fs/file_system/repository/user.rb @@ -0,0 +1,38 @@ +# +# Author:: Thom May () +# 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/user_data_handler" +require "chef/chef_fs/file_system/repository/base_file" + +class Chef + module ChefFS + module FileSystem + module Repository + + class User < BaseFile + + def initialize(name, parent) + @data_handler = Chef::ChefFS::DataHandler::UserDataHandler.new + super + end + + end + end + end + end +end diff --git a/lib/chef/chef_fs/file_system/repository/users_dir.rb b/lib/chef/chef_fs/file_system/repository/users_dir.rb index 928bb2d699..32cebf842d 100644 --- a/lib/chef/chef_fs/file_system/repository/users_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/users_dir.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry" +require "chef/chef_fs/file_system/repository/user" require "chef/chef_fs/file_system/repository/directory" require "chef/chef_fs/file_system/exceptions" @@ -32,7 +32,7 @@ class Chef end def make_child_entry(child_name) - ChefRepositoryFileSystemEntry.new(child_name, self, nil, Chef::ChefFS::DataHandler::UserDataHandler.new) + User.new(child_name, self) end end end -- cgit v1.2.1