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
|
||||
@qemu_use_agent = UNSET_VALUE
|
||||
|
||||
@serials = []
|
||||
@serials = UNSET_VALUE
|
||||
end
|
||||
|
||||
def boot(device)
|
||||
@@ -701,6 +701,8 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def serial(options={})
|
||||
@serials = [] if @serials == UNSET_VALUE
|
||||
|
||||
options = {
|
||||
:type => "pty",
|
||||
:source => nil,
|
||||
@@ -965,7 +967,7 @@ module VagrantPlugins
|
||||
|
||||
@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
|
||||
|
||||
def validate(machine)
|
||||
@@ -1061,11 +1063,13 @@ module VagrantPlugins
|
||||
c.merge!(other.qemu_env) if other.qemu_env != UNSET_VALUE
|
||||
result.qemu_env = c
|
||||
|
||||
if serials != UNSET_VALUE
|
||||
s = serials.dup
|
||||
s += other.serials
|
||||
result.serials = s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -163,14 +163,16 @@
|
||||
<%- end -%>
|
||||
<target port='<%= port %>'/>
|
||||
</serial>
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
<%- unless @serials.empty? -%>
|
||||
<%- console_log = @serials.first -%>
|
||||
<console type='<%= console_log[:type] %>'>
|
||||
<%- unless console_log[:source].nil? -%>
|
||||
<source path='<%= console_log[:source][:path] %>'/>
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
<target port='0'/>
|
||||
</console>
|
||||
<%- end -%>
|
||||
<%- @channels.each do |channel| -%>
|
||||
<channel type='<%= channel[:type] %>' >
|
||||
<%-if channel[:source_mode] or channel[:source_path] -%>
|
||||
|
||||
Reference in New Issue
Block a user