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.
166 167 168 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 166 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
174 175 176 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 174 def [](attr) config[attr] end |
#[]=(attr, val) ⇒ Object
170 171 172 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 170 def []=(attr, val) config[attr] = val end |
#calculate_path(path, type = :directory) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 186 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
178 179 180 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 178 def key?(k) config.key?(k) end |
#keys ⇒ Object
182 183 184 |
# File 'lib/kitchen/provisioner/ansible/config.rb', line 182 def keys config.keys end |