File tree Expand file tree Collapse file tree 5 files changed +21
-32
lines changed Expand file tree Collapse file tree 5 files changed +21
-32
lines changed Original file line number Diff line number Diff line change 1
1
require 'vagrant-hostmanager/hosts_file'
2
+ require 'vagrant-hostmanager/util'
2
3
3
4
module VagrantPlugins
4
5
module HostManager
@@ -11,14 +12,7 @@ def initialize(app, env)
11
12
@machine = env [ :machine ]
12
13
@global_env = @machine . env
13
14
@provider = @machine . provider_name
14
-
15
- # config_global is deprecated from v1.5
16
- if Gem ::Version . new ( ::Vagrant ::VERSION ) >= Gem ::Version . new ( '1.5' )
17
- @config = @global_env . vagrantfile . config
18
- else
19
- @config = @global_env . config_global
20
- end
21
-
15
+ @config = Util . get_config ( @global_env )
22
16
@logger = Log4r ::Logger . new ( 'vagrant::hostmanager::update_all' )
23
17
end
24
18
Original file line number Diff line number Diff line change 1
1
require 'vagrant-hostmanager/hosts_file'
2
+ require 'vagrant-hostmanager/util'
2
3
3
4
module VagrantPlugins
4
5
module HostManager
@@ -11,14 +12,7 @@ def initialize(app, env)
11
12
@machine = env [ :machine ]
12
13
@global_env = @machine . env
13
14
@provider = env [ :provider ]
14
-
15
- # config_global is deprecated from v1.5
16
- if Gem ::Version . new ( ::Vagrant ::VERSION ) >= Gem ::Version . new ( '1.5' )
17
- @config = @global_env . vagrantfile . config
18
- else
19
- @config = @global_env . config_global
20
- end
21
-
15
+ @config = Util . get_config ( @global_env )
22
16
@logger = Log4r ::Logger . new ( 'vagrant::hostmanager::update_guest' )
23
17
end
24
18
Original file line number Diff line number Diff line change 1
1
require 'vagrant-hostmanager/hosts_file'
2
+ require 'vagrant-hostmanager/util'
2
3
3
4
module VagrantPlugins
4
5
module HostManager
@@ -10,14 +11,7 @@ def initialize(app, env)
10
11
@app = app
11
12
@global_env = env [ :global_env ]
12
13
@provider = env [ :provider ]
13
-
14
- # config_global is deprecated from v1.5
15
- if Gem ::Version . new ( ::Vagrant ::VERSION ) >= Gem ::Version . new ( '1.5' )
16
- @config = @global_env . vagrantfile . config
17
- else
18
- @config = @global_env . config_global
19
- end
20
-
14
+ @config = Util . get_config ( @global_env )
21
15
@logger = Log4r ::Logger . new ( 'vagrant::hostmanager::update_host' )
22
16
end
23
17
Original file line number Diff line number Diff line change @@ -7,14 +7,7 @@ def initialize(machine, config)
7
7
super ( machine , config )
8
8
@global_env = machine . env
9
9
@provider = machine . provider_name
10
-
11
- # config_global is deprecated from v1.5
12
- if Gem ::Version . new ( ::Vagrant ::VERSION ) >= Gem ::Version . new ( '1.5' )
13
- @config = @global_env . vagrantfile . config
14
- else
15
- @config = @global_env . config_global
16
- end
17
-
10
+ @config = Util . get_config ( @global_env )
18
11
end
19
12
20
13
def provision
Original file line number Diff line number Diff line change
1
+ module VagrantPlugins
2
+ module HostManager
3
+ module Util
4
+ def self . get_config ( env )
5
+ # config_global has been removed from v1.5
6
+ if Gem ::Version . new ( ::Vagrant ::VERSION ) >= Gem ::Version . new ( '1.5' )
7
+ env . vagrantfile . config
8
+ else
9
+ env . config_global
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
You can’t perform that action at this time.
0 commit comments