Class: Kitchen::Provisioner::Ansible::Config
- Inherits:
-
Object
- Object
- Kitchen::Provisioner::Ansible::Config
- Includes:
- Configurable
- Defined in:
- lib/kitchen/provisioner/ansible/config.rb
Overview
Ansible Playbook provisioner.
Instance Attribute Summary collapse
-
#instance ⇒ Object
Returns the value of attribute instance.
Instance Method Summary collapse
- #[](attr) ⇒ Object
- #[]=(attr, val) ⇒ Object
- #calculate_path(path, type = :directory) ⇒ Object
-
#initialize(config = {}) ⇒ Config
constructor
A new instance of Config.
- #key?(k) ⇒ Boolean
- #keys ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Config
Returns a new instance of Config.
152 153 154 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 152 def initialize(config = {}) init_config(config) end |
Instance Attribute Details
#instance ⇒ Object
Returns the value of attribute instance.
31 32 33 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 31 def instance @instance end |
Instance Method Details
#[](attr) ⇒ Object
160 161 162 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 160 def [](attr) config[attr] end |
#[]=(attr, val) ⇒ Object
156 157 158 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 156 def []=(attr, val) config[attr] = val end |
#calculate_path(path, type = :directory) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 172 def calculate_path(path, type = :directory) unless instance fail 'Please ensure that an instance is provided before calling calculate_path' end base = config[:test_base_path] candidates = [] candidates << File.join(base, instance.suite.name, 'ansible', path) candidates << File.join(base, instance.suite.name, path) candidates << File.join(base, path) candidates << File.join(Dir.pwd, path) candidates << File.join(Dir.pwd) if path == 'roles' candidates.find do |c| type == :directory ? File.directory?(c) : File.file?(c) end end |
#key?(k) ⇒ Boolean
164 165 166 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 164 def key?(k) config.key?(k) end |
#keys ⇒ Object
168 169 170 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 168 def keys config.keys end |