Class: Chef::ChefFS::FileSystem::ChefServerRootDir
- Inherits:
-
BaseFSDir
- Object
- BaseFSObject
- BaseFSDir
- Chef::ChefFS::FileSystem::ChefServerRootDir
- Defined in:
- lib/chef/chef_fs/file_system/chef_server_root_dir.rb
Instance Attribute Summary collapse
-
#chef_private_key ⇒ Object
readonly
Returns the value of attribute chef_private_key.
-
#chef_server_url ⇒ Object
readonly
Returns the value of attribute chef_server_url.
-
#chef_username ⇒ Object
readonly
Returns the value of attribute chef_username.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#repo_mode ⇒ Object
readonly
Returns the value of attribute repo_mode.
Attributes inherited from BaseFSObject
Instance Method Summary collapse
- #api_path ⇒ Object
- #can_have_child?(name, is_dir) ⇒ Boolean
- #children ⇒ Object
-
#initialize(root_name, chef_config, repo_mode) ⇒ ChefServerRootDir
constructor
A new instance of ChefServerRootDir.
- #path_for_printing ⇒ Object
- #rest ⇒ Object
Methods inherited from BaseFSDir
Methods inherited from BaseFSObject
#child, #compare_to, #dir?, #exists?, #root
Constructor Details
#initialize(root_name, chef_config, repo_mode) ⇒ ChefServerRootDir
Returns a new instance of ChefServerRootDir.
29 30 31 32 33 34 35 36 37 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 29 def initialize(root_name, chef_config, repo_mode) 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 = repo_mode @root_name = root_name end |
Instance Attribute Details
#chef_private_key ⇒ Object (readonly)
Returns the value of attribute chef_private_key.
41 42 43 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 41 def chef_private_key @chef_private_key end |
#chef_server_url ⇒ Object (readonly)
Returns the value of attribute chef_server_url.
39 40 41 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 39 def chef_server_url @chef_server_url end |
#chef_username ⇒ Object (readonly)
Returns the value of attribute chef_username.
40 41 42 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 40 def chef_username @chef_username end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
42 43 44 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 42 def environment @environment end |
#repo_mode ⇒ Object (readonly)
Returns the value of attribute repo_mode.
43 44 45 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 43 def repo_mode @repo_mode end |
Instance Method Details
#api_path ⇒ Object
49 50 51 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 49 def api_path "" end |
#can_have_child?(name, is_dir) ⇒ Boolean
57 58 59 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 57 def can_have_child?(name, is_dir) is_dir && children.any? { |child| child.name == name } end |
#children ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 61 def children @children ||= begin result = [ CookbooksDir.new(self), DataBagsDir.new(self), RestListDir.new("environments", self), RestListDir.new("roles", self) ] if repo_mode == 'everything' result += [ RestListDir.new("clients", self), NodesDir.new(self), RestListDir.new("users", self) ] end result.sort_by { |child| child.name } end end |
#path_for_printing ⇒ Object
53 54 55 |
# File 'lib/chef/chef_fs/file_system/chef_server_root_dir.rb', line 53 def path_for_printing "#{@root_name}/" end |