class Vagrant::Vagrantfile::ConfigFetcher

Public Class Methods

new(namespace, client:) click to toggle source
# File lib/vagrant/vagrantfile/remote.rb, line 60
def initialize(namespace, client:)
  @namespace = namespace
  @client = client
  @logger = ::Log4r::Logger.new("vagrant::vagrantfile::remote::configfetcher")
end

Public Instance Methods

method_missing(*args, **opts, &block) click to toggle source
# File lib/vagrant/vagrantfile/remote.rb, line 66
def method_missing(*args, **opts, &block)
  begin
    return @client.get_value(@namespace, args.last) if
      (args.size == 2 && args.first.to_sym == :[]) ||
      args.size == 1
  rescue => err
    @logger.trace("failed to get config value from remote, calling direct (#{err})")
    return @client.get_config(@namespace).send(*args, **opts, &block)
  end

  @client.get_config(@namespace).send(*args, **opts, &block)
end