Handle setting of graphics options avoiding XML diff (#1577)

The attribute autoport="no" will be dropped, therefore ensure that when
graphics_autoport should be disabled, default it to nil, which allows
the existing code to exclude it from the domain template.

Otherwise being set to no will result in an apparent difference due to
the returned XML after update dropping the attribute.
This commit is contained in:
Darragh Bailey 2022-09-03 15:06:26 +01:00 committed by GitHub
parent cede7fff8b
commit 8f868b9b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -210,6 +210,7 @@ module VagrantPlugins
descr_changed = true
graphics.attributes['autoport'] = config.graphics_autoport
if config.graphics_autoport == 'no'
graphics.attributes.delete('autoport')
graphics.attributes['port'] = config.graphics_port
end
end

View File

@ -896,8 +896,7 @@ module VagrantPlugins
@initrd = '' if @initrd == UNSET_VALUE
@dtb = nil if @dtb == UNSET_VALUE
@graphics_type = 'vnc' if @graphics_type == UNSET_VALUE
@graphics_autoport = 'yes' if @graphics_port == UNSET_VALUE
@graphics_autoport = 'no' if @graphics_port != UNSET_VALUE
@graphics_autoport = @graphics_port == UNSET_VALUE ? 'yes' : nil
if (@graphics_type != 'vnc' && @graphics_type != 'spice') ||
@graphics_passwd == UNSET_VALUE
@graphics_passwd = nil