Return empty results when no content to parse
This commit is contained in:
parent
2d08919314
commit
6aa50189a2
@ -52,6 +52,12 @@ module VagrantPlugins
|
|||||||
|
|
||||||
def parse_vagrantfile_subvm(req, _)
|
def parse_vagrantfile_subvm(req, _)
|
||||||
subvm = mapper.map(req.subvm)
|
subvm = mapper.map(req.subvm)
|
||||||
|
# If the subvm has no custom configuration, just return an empty result
|
||||||
|
if subvm.config_procs.empty?
|
||||||
|
return Hashicorp::Vagrant::ParseVagrantfileResponse.new(
|
||||||
|
data: SDK::Args::Hash.new(entries: [])
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
parse_item_to_proto(subvm.config_procs)
|
parse_item_to_proto(subvm.config_procs)
|
||||||
end
|
end
|
||||||
@ -59,14 +65,26 @@ module VagrantPlugins
|
|||||||
def parse_vagrantfile_provider(req, _)
|
def parse_vagrantfile_provider(req, _)
|
||||||
subvm = mapper.map(req.subvm)
|
subvm = mapper.map(req.subvm)
|
||||||
provider = req.provider.to_sym
|
provider = req.provider.to_sym
|
||||||
config = parse_item(subvm.config_procs)
|
|
||||||
|
|
||||||
|
# If the subvm has no custom configuration, just return an empty result
|
||||||
|
if subvm.config_procs.empty?
|
||||||
|
return Hashicorp::Vagrant::ParseVagrantfileResponse.new(
|
||||||
|
data: SDK::Args::Hash.new(entries: [])
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
config = parse_item(subvm.config_procs)
|
||||||
overrides = config.vm.get_provider_overrides(provider)
|
overrides = config.vm.get_provider_overrides(provider)
|
||||||
|
|
||||||
return Hashicorp::Vagrant::ParseVagrantfileResponse.new(data: SDK::Args::Hash.new(entries: [])) if
|
# If the overrides are empty then no overrides were provided, just return
|
||||||
overrides.empty?
|
# an empty result
|
||||||
|
if overrides.empty?
|
||||||
|
return Hashicorp::Vagrant::ParseVagrantfileResponse.new(
|
||||||
|
data: SDK::Args::Hash.new(entries: [])
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
parse_item_to_proto(config.vm.get_provider_overrides(provider))
|
parse_item_to_proto(overrides)
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_item(item)
|
def parse_item(item)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user