mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-06-09 00:32:06 -04:00
Adds a communicator which does not provide communication to the guest machine. All methods for the communicator are simply stubbed with a successful result. This allows a guest to be configured with the `:none` communicator and Vagrant to properly `up` it. This currently lacks any user notification or guards within configuration to verify guest configuration does not rely on the communicator. It is wrapped as experimental to allow early access to the basic functionality without making it generally available.
46 lines
1.1 KiB
Ruby
46 lines
1.1 KiB
Ruby
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
require "log4r"
|
|
require "vagrant"
|
|
|
|
module VagrantPlugins
|
|
module CommunicatorNone
|
|
# This class provides no communication with the VM.
|
|
# It allows Vagrant to manage a machine lifecycle
|
|
# while not actually connecting to it. The communicator
|
|
# stubs out all methods to be successful allowing
|
|
# Vagrant to proceed "as normal" without actually
|
|
# doing anything.
|
|
class Communicator < Vagrant.plugin("2", :communicator)
|
|
def self.match?(_)
|
|
# Any machine can be not communicated with
|
|
true
|
|
end
|
|
|
|
def initialize(_)
|
|
@logger = Log4r::Logger.new(self.class.name.downcase)
|
|
end
|
|
|
|
def ready?
|
|
@logger.debug("#ready? stub called on none")
|
|
true
|
|
end
|
|
|
|
def execute(*_)
|
|
@logger.debug("#execute stub called on none")
|
|
0
|
|
end
|
|
|
|
def sudo(*_)
|
|
@logger.debug("#sudo stub called on none")
|
|
0
|
|
end
|
|
|
|
def test(*_)
|
|
@logger.debug("#test stub called on none")
|
|
true
|
|
end
|
|
end
|
|
end
|
|
end
|