provisioners/ansible: Add @control_machine instance variable

This minor addition will be used for upcoming shared code in base
superclass and avoid "guest"/"host" repetitions.
This commit is contained in:
Gilles Cornu 2017-08-30 11:51:55 +02:00
parent 270618284c
commit 36616fb208
No known key found for this signature in database
GPG Key ID: F6BC2CF7E1FE8FFF
3 changed files with 7 additions and 4 deletions

View File

@ -40,6 +40,7 @@ module VagrantPlugins
def initialize(machine, config)
super
@control_machine = nil
@command_arguments = []
@environment_variables = {}

View File

@ -10,6 +10,7 @@ module VagrantPlugins
def initialize(machine, config)
super
@control_machine = "guest"
@logger = Log4r::Logger.new("vagrant::provisioners::ansible_guest")
end
@ -65,7 +66,7 @@ module VagrantPlugins
if (!config.version.empty? &&
config.version.to_s.to_sym != :latest &&
!@machine.guest.capability(:ansible_installed, config.version))
raise Ansible::Errors::AnsibleVersionMismatch, system: "guest", required_version: config.version.to_s
raise Ansible::Errors::AnsibleVersionMismatch, system: @control_machine, required_version: config.version.to_s
end
end
@ -174,7 +175,7 @@ module VagrantPlugins
error_key: :config_file_not_found,
config_option: option_name,
path: remote_path,
system: "guest"
system: @control_machine
)
end

View File

@ -11,6 +11,7 @@ module VagrantPlugins
def initialize(machine, config)
super
@control_machine = "host"
@logger = Log4r::Logger.new("vagrant::provisioners::ansible_host")
end
@ -46,7 +47,7 @@ module VagrantPlugins
@logger.info("Checking for Ansible version on Vagrant host...")
found_version = gather_ansible_version
if (!found_version || "ansible #{config.version}\n" != found_version.lines[0])
raise Ansible::Errors::AnsibleVersionMismatch, system: "host", required_version: config.version.to_s
raise Ansible::Errors::AnsibleVersionMismatch, system: @control_machine, required_version: config.version.to_s
end
end
@ -326,7 +327,7 @@ module VagrantPlugins
_key: :config_file_not_found,
config_option: option_name,
path: expanded_path,
system: "host"
system: @control_machine
end
end