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:
parent
270618284c
commit
36616fb208
|
@ -40,6 +40,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def initialize(machine, config)
|
def initialize(machine, config)
|
||||||
super
|
super
|
||||||
|
@control_machine = nil
|
||||||
|
|
||||||
@command_arguments = []
|
@command_arguments = []
|
||||||
@environment_variables = {}
|
@environment_variables = {}
|
||||||
|
|
|
@ -10,6 +10,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def initialize(machine, config)
|
def initialize(machine, config)
|
||||||
super
|
super
|
||||||
|
@control_machine = "guest"
|
||||||
@logger = Log4r::Logger.new("vagrant::provisioners::ansible_guest")
|
@logger = Log4r::Logger.new("vagrant::provisioners::ansible_guest")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ module VagrantPlugins
|
||||||
if (!config.version.empty? &&
|
if (!config.version.empty? &&
|
||||||
config.version.to_s.to_sym != :latest &&
|
config.version.to_s.to_sym != :latest &&
|
||||||
!@machine.guest.capability(:ansible_installed, config.version))
|
!@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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ module VagrantPlugins
|
||||||
error_key: :config_file_not_found,
|
error_key: :config_file_not_found,
|
||||||
config_option: option_name,
|
config_option: option_name,
|
||||||
path: remote_path,
|
path: remote_path,
|
||||||
system: "guest"
|
system: @control_machine
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def initialize(machine, config)
|
def initialize(machine, config)
|
||||||
super
|
super
|
||||||
|
@control_machine = "host"
|
||||||
@logger = Log4r::Logger.new("vagrant::provisioners::ansible_host")
|
@logger = Log4r::Logger.new("vagrant::provisioners::ansible_host")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ module VagrantPlugins
|
||||||
@logger.info("Checking for Ansible version on Vagrant host...")
|
@logger.info("Checking for Ansible version on Vagrant host...")
|
||||||
found_version = gather_ansible_version
|
found_version = gather_ansible_version
|
||||||
if (!found_version || "ansible #{config.version}\n" != found_version.lines[0])
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -326,7 +327,7 @@ module VagrantPlugins
|
||||||
_key: :config_file_not_found,
|
_key: :config_file_not_found,
|
||||||
config_option: option_name,
|
config_option: option_name,
|
||||||
path: expanded_path,
|
path: expanded_path,
|
||||||
system: "host"
|
system: @control_machine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue