class ChefFS::FileSystem::ChefServerRootDir
Attributes
chef_private_key[R]
chef_server_url[R]
chef_username[R]
cookbook_version[R]
environment[R]
repo_mode[R]
Public Class Methods
new(root_name, chef_config, options = {})
click to toggle source
Calls superclass method
ChefFS::FileSystem::BaseFSDir::new
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 36 def initialize(root_name, chef_config, options = {}) super("", nil) @chef_server_url = chef_config[:chef_server_url] @chef_username = chef_config[:node_name] @chef_private_key = chef_config[:client_key] @environment = chef_config[:environment] @repo_mode = chef_config[:repo_mode] @root_name = root_name @cookbook_version = options[:cookbook_version] # Used in knife diff and download for server cookbook version end
Public Instance Methods
api_path()
click to toggle source
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 62 def api_path "" end
can_have_child?(name, is_dir)
click to toggle source
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 70 def can_have_child?(name, is_dir) is_dir && children.any? { |child| child.name == name } end
children()
click to toggle source
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 82 def children @children ||= begin result = [ CookbooksDir.new(self), DataBagsDir.new(self), EnvironmentsDir.new(self), RestListDir.new("roles", self, nil, ChefFS::DataHandler::RoleDataHandler.new) ] if repo_mode == 'hosted_everything' result += [ AclsDir.new(self), RestListDir.new("clients", self, nil, ChefFS::DataHandler::ClientDataHandler.new), RestListDir.new("containers", self, nil, ChefFS::DataHandler::ContainerDataHandler.new), RestListDir.new("groups", self, nil, ChefFS::DataHandler::GroupDataHandler.new), NodesDir.new(self) ] elsif repo_mode != 'static' result += [ RestListDir.new("clients", self, nil, ChefFS::DataHandler::ClientDataHandler.new), NodesDir.new(self), RestListDir.new("users", self, nil, ChefFS::DataHandler::UserDataHandler.new) ] end result.sort_by { |child| child.name } end end
fs_description()
click to toggle source
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 54 def fs_description "Chef server at #{chef_server_url} (user #{chef_username}), repo_mode = #{repo_mode}" end
org()
click to toggle source
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 74 def org @org ||= if URI.parse(chef_server_url).path =~ /^\/+organizations\/+([^\/]+)$/ $1 else nil end end
path_for_printing()
click to toggle source
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 66 def path_for_printing "#{@root_name}/" end
rest()
click to toggle source
# File lib/chef_fs/file_system/chef_server_root_dir.rb, line 58 def rest Chef::REST.new(chef_server_url, chef_username, chef_private_key) end