mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Allow serials to be disabled (#1453)
Facilitate disabling serial devices by allowing for the configuration to explicitly set serials to an empty array and ignoring adding the default serial if this is the case.
This commit is contained in:
@@ -341,7 +341,7 @@ module VagrantPlugins
|
|||||||
# Use Qemu agent to get ip address
|
# Use Qemu agent to get ip address
|
||||||
@qemu_use_agent = UNSET_VALUE
|
@qemu_use_agent = UNSET_VALUE
|
||||||
|
|
||||||
@serials = []
|
@serials = UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def boot(device)
|
def boot(device)
|
||||||
@@ -701,6 +701,8 @@ module VagrantPlugins
|
|||||||
end
|
end
|
||||||
|
|
||||||
def serial(options={})
|
def serial(options={})
|
||||||
|
@serials = [] if @serials == UNSET_VALUE
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
:type => "pty",
|
:type => "pty",
|
||||||
:source => nil,
|
:source => nil,
|
||||||
@@ -965,7 +967,7 @@ module VagrantPlugins
|
|||||||
|
|
||||||
@qemu_use_agent = false if @qemu_use_agent == UNSET_VALUE
|
@qemu_use_agent = false if @qemu_use_agent == UNSET_VALUE
|
||||||
|
|
||||||
@serials = [{:type => 'pty', :source => nil}] if @serials == []
|
@serials = [{:type => 'pty', :source => nil}] if @serials == UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate(machine)
|
def validate(machine)
|
||||||
@@ -1061,9 +1063,11 @@ module VagrantPlugins
|
|||||||
c.merge!(other.qemu_env) if other.qemu_env != UNSET_VALUE
|
c.merge!(other.qemu_env) if other.qemu_env != UNSET_VALUE
|
||||||
result.qemu_env = c
|
result.qemu_env = c
|
||||||
|
|
||||||
s = serials.dup
|
if serials != UNSET_VALUE
|
||||||
s += other.serials
|
s = serials.dup
|
||||||
result.serials = s
|
s += other.serials
|
||||||
|
result.serials = s
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -163,14 +163,16 @@
|
|||||||
<%- end -%>
|
<%- end -%>
|
||||||
<target port='<%= port %>'/>
|
<target port='<%= port %>'/>
|
||||||
</serial>
|
</serial>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
<%- unless @serials.empty? -%>
|
||||||
<%- console_log = @serials.first -%>
|
<%- console_log = @serials.first -%>
|
||||||
<console type='<%= console_log[:type] %>'>
|
<console type='<%= console_log[:type] %>'>
|
||||||
<%- unless console_log[:source].nil? -%>
|
<%- unless console_log[:source].nil? -%>
|
||||||
<source path='<%= console_log[:source][:path] %>'/>
|
<source path='<%= console_log[:source][:path] %>'/>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
<target port='0'/>
|
<target port='0'/>
|
||||||
</console>
|
</console>
|
||||||
|
<%- end -%>
|
||||||
<%- @channels.each do |channel| -%>
|
<%- @channels.each do |channel| -%>
|
||||||
<channel type='<%= channel[:type] %>' >
|
<channel type='<%= channel[:type] %>' >
|
||||||
<%-if channel[:source_mode] or channel[:source_path] -%>
|
<%-if channel[:source_mode] or channel[:source_path] -%>
|
||||||
|
|||||||
Reference in New Issue
Block a user