Make code similar to other providers

This commit is contained in:
Sergey Leschenko 2016-10-20 13:39:33 +03:00
parent 1c2208a30e
commit 671bd55cea

View file

@ -8,27 +8,22 @@ module Vagrant
The LXC provider allows Vagrant to manage and control
LXC-based virtual machines.
EOF
locale_loaded = false
provider(:lxc, parallel: true, priority: 7) do
require File.expand_path("../provider", __FILE__)
if not locale_loaded
I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml')
I18n.reload!
locale_loaded = true
end
init!
Provider
end
command "lxc" do
require_relative 'command/root'
init!
Command::Root
end
config(:lxc, :provider) do
require File.expand_path("../config", __FILE__)
init!
Config
end
@ -41,6 +36,16 @@ module Vagrant
require_relative "provider/cap/public_address"
Provider::Cap::PublicAddress
end
protected
def self.init!
return if defined?(@_init)
I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml')
I18n.reload!
@_init = true
end
end
end
end