Class: VagrantPlugins::ProxyConf::Action::ConfigureAptProxy
- Inherits:
-
Object
- Object
- VagrantPlugins::ProxyConf::Action::ConfigureAptProxy
- Defined in:
- lib/vagrant-proxyconf/action/configure_apt_proxy.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ConfigureAptProxy
constructor
A new instance of ConfigureAptProxy.
Constructor Details
#initialize(app, env) ⇒ ConfigureAptProxy
Returns a new instance of ConfigureAptProxy.
10 11 12 13 |
# File 'lib/vagrant-proxyconf/action/configure_apt_proxy.rb', line 10 def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant::proxyconf::action::configure_apt_proxy') end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
8 9 10 |
# File 'lib/vagrant-proxyconf/action/configure_apt_proxy.rb', line 8 def logger @logger end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-proxyconf/action/configure_apt_proxy.rb', line 15 def call(env) @app.call env proxy_config = env[:machine].config.apt_proxy # Vagrant does not seem to call `finalize!` if the configuration # key is not used in Vagrantfiles. # https://github.com/tmatilai/vagrant-proxyconf/issues/2 proxy_config.finalize! if !proxy_config.enabled? logger.debug "apt_proxy not enabled or configured" elsif !proxy_conf_capability?(env[:machine]) env[:ui].info "Skipping Apt proxy config as the machine does not support it" else env[:ui].info "Configuring proxy for Apt..." write_apt_proxy_conf(env[:machine], proxy_config) end end |