Check name config option with respond_to?

Prior to this commit, the check used to look for the config option
`name` in a provisioner config would accidentally create a "DummyConfig"
based on how vagrant handles missing config options. This commit fixes
that by instead using the `respond_to?` method to check for the
existance of the config option name.
This commit is contained in:
Brian Cain 2020-01-07 10:29:39 -08:00
parent dd5d73e8a9
commit 6855dd8c74
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 2 additions and 1 deletions

View File

@ -35,7 +35,8 @@ module Vagrant
# Note: `name` is set to a symbol, since it is converted to one via #Config::VM.provision
provisioner_name = provisioner.name
if !provisioner_name
if provisioner.config.name
if provisioner.config.respond_to?(:name) &&
provisioner.config.name
provisioner_name = provisioner.config.name.to_sym
end
else