Class: QB::Ansible::ConfigFile
- Inherits:
-
ParseConfig
- Object
- ParseConfig
- QB::Ansible::ConfigFile
- Defined in:
- lib/qb/ansible/config_file.rb
Overview
A parse of an ansible.cfg
file, extending ParseConfig.
We need these to read role path and other Ansible variables so we can setup paths correctly.
Defined Under Namespace
Classes: Defaults
Constant Summary collapse
- FILE_NAME =
The "well-known" name we look for.
'ansible.cfg'
Instance Attribute Summary collapse
-
#rel_root ⇒ Object
readonly
Returns the value of attribute rel_root.
Class Method Summary collapse
-
.end_with_config_file?(file_path) ⇒ Boolean
Test if a file path looks like it points to an Ansible config file - a file with FILE_NAME as the basename.
Instance Method Summary collapse
- #defaults ⇒ QB::Ansible::ConfigFile::Defaults
-
#initialize(path) ⇒ ConfigFile
constructor
Instantiate a new
QB::Ansible::ConfigFile
.
Constructor Details
#initialize(path) ⇒ ConfigFile
Instantiate a new QB::Ansible::ConfigFile
.
130 131 132 133 |
# File 'lib/qb/ansible/config_file.rb', line 130 def initialize path super path @rel_root = QB::Util.resolve(path).dirname end |
Instance Attribute Details
#rel_root ⇒ Object (readonly)
Returns the value of attribute rel_root.
123 124 125 |
# File 'lib/qb/ansible/config_file.rb', line 123 def rel_root @rel_root end |
Class Method Details
.end_with_config_file?(file_path) ⇒ Boolean
Test if a file path looks like it points to an Ansible config file - a file with FILE_NAME as the basename.
Explicitly does not check if the file actually exists and is a file. This is because we need this test to differentiate role search path elements that are meant to point to Ansible config files from those that aren't in Role.search_path.
111 112 113 |
# File 'lib/qb/ansible/config_file.rb', line 111 def self.end_with_config_file? file_path File.basename(file_path).to_s == FILE_NAME end |
Instance Method Details
#defaults ⇒ QB::Ansible::ConfigFile::Defaults
Document defaults method.
Returns @todo Document return value.
144 145 146 |
# File 'lib/qb/ansible/config_file.rb', line 144 def defaults Defaults.new (self['defaults'] || {}), rel_root: @rel_root end |