vagrant-invade 0.4.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +52 -43
- data/lib/vagrant-invade/action/generate.rb +52 -43
- data/lib/vagrant-invade/action/validate.rb +7 -2
- data/lib/vagrant-invade/builder/hostmanager.rb +40 -0
- data/lib/vagrant-invade/builder/machine.rb +45 -0
- data/lib/vagrant-invade/builder/vagrantfile.rb +6 -5
- data/lib/vagrant-invade/builder.rb +2 -1
- data/lib/vagrant-invade/generator/hostmanager.rb +23 -0
- data/lib/vagrant-invade/generator/machine.rb +25 -0
- data/lib/vagrant-invade/generator/{section → machine_part}/network.rb +1 -1
- data/lib/vagrant-invade/generator/{section → machine_part}/plugin.rb +1 -1
- data/lib/vagrant-invade/generator/{section → machine_part}/provider.rb +1 -1
- data/lib/vagrant-invade/generator/{section → machine_part}/provision.rb +1 -1
- data/lib/vagrant-invade/generator/{section → machine_part}/ssh.rb +1 -1
- data/lib/vagrant-invade/generator/{section → machine_part}/synced_folder.rb +1 -1
- data/lib/vagrant-invade/generator/{section → machine_part}/vm.rb +1 -1
- data/lib/vagrant-invade/generator/machine_part.rb +23 -0
- data/lib/vagrant-invade/generator/vagrantfile.rb +2 -3
- data/lib/vagrant-invade/generator.rb +3 -2
- data/lib/vagrant-invade/template/hostmanager.erb +8 -0
- data/lib/vagrant-invade/template/{definition.erb → machine.erb} +7 -9
- data/lib/vagrant-invade/template/network/forwarded_port.erb +8 -8
- data/lib/vagrant-invade/template/network/private_network.erb +1 -1
- data/lib/vagrant-invade/template/network/public_network.erb +1 -1
- data/lib/vagrant-invade/template/plugin/hostmanager.erb +3 -15
- data/lib/vagrant-invade/template/provider/virtualbox.erb +0 -1
- data/lib/vagrant-invade/template/provider/vmware.erb +0 -1
- data/lib/vagrant-invade/template/synced_folder/nfs.erb +0 -1
- data/lib/vagrant-invade/template/v2.erb +2 -1
- data/lib/vagrant-invade/template/vm/vm.erb +1 -1
- data/lib/vagrant-invade/validator/hostmanager.rb +56 -0
- data/lib/vagrant-invade/validator/invade.rb +1 -2
- data/lib/vagrant-invade/validator.rb +1 -0
- data/lib/vagrant-invade/version.rb +1 -1
- metadata +18 -14
- data/lib/vagrant-invade/builder/definition.rb +0 -45
- data/lib/vagrant-invade/generator/definition.rb +0 -25
- data/lib/vagrant-invade/generator/section.rb +0 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5191a889f6ebf32cf3c274ca1e181c8279bc69c
|
|
4
|
+
data.tar.gz: 38baac08e719c4592a75398db5de41e31b51af71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0148801b3964e771405d343f93e835f923fb413039396f8b3733ea430c1e7235d18d3e7948f1c50e537d21e3c7ff2aadd266115d1c37f54a2be3e66f929acb86
|
|
7
|
+
data.tar.gz: 1d1e97b99888876a00420972612d4acacdfe91a2be6dfc6b99546b4bc30bc055f79c2c634e4f1cd73c7b923b7cd5cd6f1c1b6810152abec018a105e21b9ea65a
|
data/Gemfile
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
2
|
|
|
3
3
|
group :development do
|
|
4
|
-
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git", :ref => 'v1.
|
|
4
|
+
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git", :ref => 'v1.8.5'
|
|
5
|
+
gem "vagrant-hostmanager", git: "https://github.com/devopsgroup-io/vagrant-hostmanager"
|
|
5
6
|
end
|
|
6
7
|
|
|
7
8
|
group :plugins do
|
data/Gemfile.lock
CHANGED
|
@@ -1,41 +1,47 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: https://github.com/devopsgroup-io/vagrant-hostmanager
|
|
3
|
+
revision: 4ae7655be4ca149482b43592acf0e759463a0bfc
|
|
4
|
+
specs:
|
|
5
|
+
vagrant-hostmanager (1.8.5)
|
|
6
|
+
|
|
1
7
|
GIT
|
|
2
8
|
remote: https://github.com/mitchellh/vagrant.git
|
|
3
|
-
revision:
|
|
4
|
-
ref: v1.
|
|
9
|
+
revision: 93f9528687b9a737585d22bc4db5d2ab5d9852d3
|
|
10
|
+
ref: v1.8.5
|
|
5
11
|
specs:
|
|
6
|
-
vagrant (1.
|
|
7
|
-
bundler (
|
|
12
|
+
vagrant (1.8.5)
|
|
13
|
+
bundler (= 1.12.5)
|
|
8
14
|
childprocess (~> 0.5.0)
|
|
9
15
|
erubis (~> 2.7.0)
|
|
10
16
|
hashicorp-checkpoint (~> 0.1.1)
|
|
11
17
|
i18n (>= 0.6.0, <= 0.8.0)
|
|
12
|
-
listen (~> 3.
|
|
18
|
+
listen (~> 3.1.5)
|
|
13
19
|
log4r (~> 1.1.9, < 1.1.11)
|
|
14
20
|
net-scp (~> 1.1.0)
|
|
15
21
|
net-sftp (~> 2.1)
|
|
16
|
-
net-ssh (
|
|
17
|
-
nokogiri (= 1.6.
|
|
22
|
+
net-ssh (~> 3.0.1)
|
|
23
|
+
nokogiri (= 1.6.7.1)
|
|
18
24
|
rb-kqueue (~> 0.2.0)
|
|
19
|
-
rest-client (>= 1.6.0, <
|
|
25
|
+
rest-client (>= 1.6.0, < 3.0)
|
|
20
26
|
wdm (~> 0.1.0)
|
|
21
|
-
winrm (~> 1.
|
|
22
|
-
winrm-fs (~> 0.
|
|
27
|
+
winrm (~> 1.6)
|
|
28
|
+
winrm-fs (~> 0.3.0)
|
|
23
29
|
|
|
24
30
|
PATH
|
|
25
31
|
remote: .
|
|
26
32
|
specs:
|
|
27
|
-
vagrant-invade (0.
|
|
33
|
+
vagrant-invade (0.5.0)
|
|
28
34
|
|
|
29
35
|
GEM
|
|
30
36
|
remote: https://rubygems.org/
|
|
31
37
|
specs:
|
|
32
38
|
builder (3.2.2)
|
|
33
|
-
childprocess (0.5.
|
|
39
|
+
childprocess (0.5.9)
|
|
34
40
|
ffi (~> 1.0, >= 1.0.11)
|
|
35
|
-
domain_name (0.5.
|
|
41
|
+
domain_name (0.5.20160615)
|
|
36
42
|
unf (>= 0.0.5, < 1.0.0)
|
|
37
43
|
erubis (2.7.0)
|
|
38
|
-
ffi (1.9.
|
|
44
|
+
ffi (1.9.14)
|
|
39
45
|
gssapi (1.2.0)
|
|
40
46
|
ffi (>= 1.0.1)
|
|
41
47
|
gyoku (1.3.1)
|
|
@@ -43,65 +49,68 @@ GEM
|
|
|
43
49
|
hashicorp-checkpoint (0.1.4)
|
|
44
50
|
http-cookie (1.0.2)
|
|
45
51
|
domain_name (~> 0.5)
|
|
46
|
-
httpclient (2.
|
|
52
|
+
httpclient (2.8.1)
|
|
47
53
|
i18n (0.7.0)
|
|
48
|
-
listen (3.
|
|
49
|
-
rb-fsevent (>= 0.9.
|
|
50
|
-
rb-inotify (>= 0.9)
|
|
54
|
+
listen (3.1.5)
|
|
55
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
56
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
57
|
+
ruby_dep (~> 1.2)
|
|
51
58
|
little-plugger (1.1.4)
|
|
52
59
|
log4r (1.1.10)
|
|
53
|
-
logging (1.
|
|
54
|
-
little-plugger (
|
|
55
|
-
multi_json (
|
|
56
|
-
mime-types (
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
logging (2.1.0)
|
|
61
|
+
little-plugger (~> 1.1)
|
|
62
|
+
multi_json (~> 1.10)
|
|
63
|
+
mime-types (3.1)
|
|
64
|
+
mime-types-data (~> 3.2015)
|
|
65
|
+
mime-types-data (3.2016.0521)
|
|
66
|
+
mini_portile2 (2.0.0)
|
|
67
|
+
multi_json (1.12.1)
|
|
59
68
|
net-scp (1.1.2)
|
|
60
69
|
net-ssh (>= 2.6.5)
|
|
61
70
|
net-sftp (2.1.2)
|
|
62
71
|
net-ssh (>= 2.6.5)
|
|
63
|
-
net-ssh (
|
|
72
|
+
net-ssh (3.0.2)
|
|
64
73
|
netrc (0.11.0)
|
|
65
|
-
nokogiri (1.6.
|
|
66
|
-
|
|
74
|
+
nokogiri (1.6.7.1)
|
|
75
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
67
76
|
nori (2.6.0)
|
|
68
|
-
rb-fsevent (0.9.
|
|
69
|
-
rb-inotify (0.9.
|
|
77
|
+
rb-fsevent (0.9.7)
|
|
78
|
+
rb-inotify (0.9.7)
|
|
70
79
|
ffi (>= 0.5.0)
|
|
71
80
|
rb-kqueue (0.2.4)
|
|
72
81
|
ffi (>= 0.5.0)
|
|
73
|
-
rest-client (
|
|
82
|
+
rest-client (2.0.0)
|
|
74
83
|
http-cookie (>= 1.0.2, < 2.0)
|
|
75
|
-
mime-types (>= 1.16, <
|
|
76
|
-
netrc (~> 0.
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
mime-types (>= 1.16, < 4.0)
|
|
85
|
+
netrc (~> 0.8)
|
|
86
|
+
ruby_dep (1.4.0)
|
|
87
|
+
rubyntlm (0.6.0)
|
|
88
|
+
rubyzip (1.2.0)
|
|
79
89
|
unf (0.1.4)
|
|
80
90
|
unf_ext
|
|
81
|
-
unf_ext (0.0.7.
|
|
82
|
-
uuidtools (2.1.5)
|
|
91
|
+
unf_ext (0.0.7.2)
|
|
83
92
|
wdm (0.1.1)
|
|
84
|
-
winrm (1.
|
|
93
|
+
winrm (1.8.1)
|
|
85
94
|
builder (>= 2.1.2)
|
|
86
95
|
gssapi (~> 1.2)
|
|
87
96
|
gyoku (~> 1.0)
|
|
88
97
|
httpclient (~> 2.2, >= 2.2.0.2)
|
|
89
98
|
logging (>= 1.6.1, < 3.0)
|
|
90
99
|
nori (~> 2.0)
|
|
91
|
-
rubyntlm (~> 0.
|
|
92
|
-
|
|
93
|
-
winrm-fs (0.2.3)
|
|
100
|
+
rubyntlm (~> 0.6.0)
|
|
101
|
+
winrm-fs (0.3.2)
|
|
94
102
|
erubis (~> 2.7)
|
|
95
|
-
logging (
|
|
103
|
+
logging (>= 1.6.1, < 3.0)
|
|
96
104
|
rubyzip (~> 1.1)
|
|
97
|
-
winrm (~> 1.
|
|
105
|
+
winrm (~> 1.5)
|
|
98
106
|
|
|
99
107
|
PLATFORMS
|
|
100
108
|
ruby
|
|
101
109
|
|
|
102
110
|
DEPENDENCIES
|
|
103
111
|
vagrant!
|
|
112
|
+
vagrant-hostmanager!
|
|
104
113
|
vagrant-invade!
|
|
105
114
|
|
|
106
115
|
BUNDLED WITH
|
|
107
|
-
1.
|
|
116
|
+
1.12.5
|
|
@@ -17,87 +17,96 @@ module VagrantPlugins
|
|
|
17
17
|
# Define invade config
|
|
18
18
|
config = @env[:invade]
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
|
|
20
|
+
# Final vagrantfile hash
|
|
21
|
+
vagrantfile = Hash.new
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
# Machine hashes
|
|
24
|
+
machine = Hash.new
|
|
25
|
+
machine_part = Hash.new
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
# Hostmanager plugin configuration
|
|
28
|
+
unless config['hostmanager'] == nil
|
|
29
|
+
vagrantfile['hostmanager'] = Generator::HostManager.new(config['hostmanager']).generate
|
|
30
|
+
end
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
# Iterate over each machine defined in config
|
|
33
|
+
unless config['machines'] == nil
|
|
34
|
+
config['machines'].each_with_index do |(name, part), index|
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
unless
|
|
32
|
-
|
|
36
|
+
# VM
|
|
37
|
+
unless part['vm'] == nil
|
|
38
|
+
machine_part['vm'] = Generator::MachinePart::VM.new(name, part['vm']).generate
|
|
33
39
|
end
|
|
34
40
|
|
|
35
41
|
# NETWORK
|
|
36
|
-
unless
|
|
37
|
-
|
|
42
|
+
unless part['network'] == nil
|
|
43
|
+
machine_part['network'] = ''
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
part['network'].each do |type, data|
|
|
46
|
+
machine_part['network'].concat(Generator::MachinePart::Network.new(name, type, data).generate)
|
|
41
47
|
end
|
|
42
48
|
end
|
|
43
49
|
|
|
44
50
|
# SSH
|
|
45
|
-
unless
|
|
46
|
-
|
|
51
|
+
unless part['ssh'] == nil
|
|
52
|
+
machine_part['ssh'] = (Generator::MachinePart::SSH.new(name, part['ssh']).generate)
|
|
47
53
|
end
|
|
48
54
|
|
|
49
55
|
# PROVIDER
|
|
50
|
-
unless
|
|
51
|
-
|
|
56
|
+
unless part['provider'] == nil
|
|
57
|
+
machine_part['provider'] = ''
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
parts = Generator::
|
|
55
|
-
|
|
59
|
+
part['provider'].each do |type, data|
|
|
60
|
+
parts = Generator::MachinePart::Provider.new(name, type, data).generate
|
|
61
|
+
machine_part['provider'].concat(parts)
|
|
56
62
|
end
|
|
57
63
|
end
|
|
58
64
|
|
|
59
65
|
# SYNCED FOLDER
|
|
60
|
-
unless
|
|
61
|
-
|
|
66
|
+
unless part['synced_folder'] == nil
|
|
67
|
+
machine_part['synced_folder'] = ''
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
parts = Generator::
|
|
65
|
-
|
|
69
|
+
part['synced_folder'].each do |folder_name, data|
|
|
70
|
+
parts = Generator::MachinePart::SyncedFolder.new(folder_name, data).generate
|
|
71
|
+
machine_part['synced_folder'].concat(parts)
|
|
66
72
|
end
|
|
67
73
|
end
|
|
68
74
|
|
|
69
75
|
# PROVISION
|
|
70
|
-
unless
|
|
71
|
-
|
|
76
|
+
unless part['provision'] == nil
|
|
77
|
+
machine_part['provision'] = ''
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
parts = Generator::
|
|
75
|
-
|
|
79
|
+
part['provision'].each do |provision_name, data|
|
|
80
|
+
parts = Generator::MachinePart::Provision.new(name, provision_name, data).generate
|
|
81
|
+
machine_part['provision'].concat(parts)
|
|
76
82
|
end
|
|
77
83
|
end
|
|
78
84
|
|
|
79
85
|
# PLUGIN
|
|
80
|
-
unless
|
|
81
|
-
|
|
86
|
+
unless part['plugin'] == nil
|
|
87
|
+
machine_part['plugin'] = ''
|
|
82
88
|
|
|
83
|
-
|
|
84
|
-
parts = Generator::
|
|
85
|
-
|
|
89
|
+
part['plugin'].each do |type, data|
|
|
90
|
+
parts = Generator::MachinePart::Plugin.new(name, @env[:ui], type, data).generate
|
|
91
|
+
machine_part['plugin'].concat(parts)
|
|
86
92
|
end
|
|
87
93
|
end
|
|
88
94
|
|
|
89
|
-
#
|
|
90
|
-
|
|
95
|
+
# Generate machine from parts
|
|
96
|
+
machine[name] = Generator::Machine.new(name, machine_part).generate
|
|
97
|
+
|
|
91
98
|
end
|
|
92
99
|
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
vagrantfile['machine'] = machine
|
|
101
|
+
end
|
|
95
102
|
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
# Finally generate Vagrantfile from machines and add it to Vagrant env
|
|
104
|
+
@env[:invade]['vagrantfile'] = Generator::Vagrantfile.new(vagrantfile).generate
|
|
98
105
|
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
# Finally done with generating. Delete machines from Vagrant env
|
|
107
|
+
@env[:invade].delete("machines")
|
|
108
|
+
|
|
109
|
+
@app.call(env)
|
|
101
110
|
end
|
|
102
111
|
|
|
103
112
|
end
|
|
@@ -23,7 +23,12 @@ module VagrantPlugins
|
|
|
23
23
|
###############################################################
|
|
24
24
|
|
|
25
25
|
# INVADE
|
|
26
|
-
config['invade'] = Validator::Invade.new(
|
|
26
|
+
config['invade'] = Validator::Invade.new(config['invade']).validate
|
|
27
|
+
|
|
28
|
+
# Hostmanager Plugin
|
|
29
|
+
unless config['hostmanager'] == nil
|
|
30
|
+
config['hostmanager'] = Validator::HostManager.new( config['hostmanager']).validate
|
|
31
|
+
end
|
|
27
32
|
|
|
28
33
|
# Iterate over each machine configuration
|
|
29
34
|
machines = config['machines']
|
|
@@ -33,7 +38,6 @@ module VagrantPlugins
|
|
|
33
38
|
# VM
|
|
34
39
|
unless sections['vm'] == nil
|
|
35
40
|
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating VM section...") unless quiet
|
|
36
|
-
|
|
37
41
|
sections['vm'] = Validator::VM.new(env, sections['vm']).validate
|
|
38
42
|
end
|
|
39
43
|
|
|
@@ -118,6 +122,7 @@ module VagrantPlugins
|
|
|
118
122
|
sections['ssh'] = Validator::SSH.new(env, sections['ssh']).validate
|
|
119
123
|
end
|
|
120
124
|
|
|
125
|
+
# PLUGINS
|
|
121
126
|
unless sections['plugin'] == nil
|
|
122
127
|
@env[:ui].info("\n[Invade] #{machine.upcase}: Validating PLUGIN section...") unless quiet
|
|
123
128
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Builder
|
|
4
|
+
|
|
5
|
+
require 'erubis'
|
|
6
|
+
|
|
7
|
+
class HostManager
|
|
8
|
+
|
|
9
|
+
attr_reader :result
|
|
10
|
+
attr_accessor :hostmanager_data
|
|
11
|
+
|
|
12
|
+
def initialize(hostmanager_data, result: nil)
|
|
13
|
+
@hostmanager_data = hostmanager_data
|
|
14
|
+
@result = result
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def build
|
|
18
|
+
b = binding
|
|
19
|
+
template_file = "#{TEMPLATE_PATH}/hostmanager.erb"
|
|
20
|
+
|
|
21
|
+
begin
|
|
22
|
+
|
|
23
|
+
# Values for hostmanager part
|
|
24
|
+
enabled = @hostmanager_data['enabled']
|
|
25
|
+
manage_host = @hostmanager_data['manage_host']
|
|
26
|
+
manage_guest = @hostmanager_data['manage_guest']
|
|
27
|
+
ignore_private_ip = @hostmanager_data['ignore_private_ip']
|
|
28
|
+
include_offline = @hostmanager_data['include_offline']
|
|
29
|
+
|
|
30
|
+
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
31
|
+
@result = eruby.result b
|
|
32
|
+
rescue TypeError, SyntaxError, SystemCallError => e
|
|
33
|
+
raise(e)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Builder
|
|
4
|
+
|
|
5
|
+
require 'erubis'
|
|
6
|
+
|
|
7
|
+
class Machine
|
|
8
|
+
|
|
9
|
+
attr_reader :result
|
|
10
|
+
attr_accessor :machine_data
|
|
11
|
+
|
|
12
|
+
def initialize(machine_name, machine_data, result: nil)
|
|
13
|
+
@machine_name = machine_name
|
|
14
|
+
@machine_data = machine_data
|
|
15
|
+
@result = result
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def build
|
|
19
|
+
b = binding
|
|
20
|
+
template_file = "#{TEMPLATE_PATH}/machine.erb"
|
|
21
|
+
|
|
22
|
+
begin
|
|
23
|
+
|
|
24
|
+
# Machine name
|
|
25
|
+
machine_name = @machine_name
|
|
26
|
+
|
|
27
|
+
# Data to build machine entry
|
|
28
|
+
vm = @machine_data['vm']
|
|
29
|
+
network = @machine_data['network']
|
|
30
|
+
ssh = @machine_data['ssh']
|
|
31
|
+
provider = @machine_data['provider']
|
|
32
|
+
synced_folder = @machine_data['synced_folder']
|
|
33
|
+
plugin = @machine_data['plugin']
|
|
34
|
+
provision = @machine_data['provision']
|
|
35
|
+
|
|
36
|
+
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
37
|
+
@result = eruby.result b
|
|
38
|
+
rescue TypeError, SyntaxError, SystemCallError => e
|
|
39
|
+
raise(e)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -7,10 +7,10 @@ module VagrantPlugins
|
|
|
7
7
|
class Vagrantfile
|
|
8
8
|
|
|
9
9
|
attr_reader :result
|
|
10
|
-
attr_accessor :
|
|
10
|
+
attr_accessor :vagrantfile_data
|
|
11
11
|
|
|
12
|
-
def initialize(
|
|
13
|
-
@
|
|
12
|
+
def initialize(vagrantfile_data, result: nil)
|
|
13
|
+
@vagrantfile_data = vagrantfile_data
|
|
14
14
|
@result = result
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -20,8 +20,9 @@ module VagrantPlugins
|
|
|
20
20
|
|
|
21
21
|
begin
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
|
|
23
|
+
# Set variables for template files
|
|
24
|
+
hostmanager = @vagrantfile_data['hostmanager']
|
|
25
|
+
machines = @vagrantfile_data['machine']
|
|
25
26
|
|
|
26
27
|
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
27
28
|
@result = eruby.result b
|
|
@@ -2,6 +2,7 @@ module VagrantPlugins
|
|
|
2
2
|
module Invade
|
|
3
3
|
module Builder
|
|
4
4
|
|
|
5
|
+
autoload :HostManager, 'vagrant-invade/builder/hostmanager'
|
|
5
6
|
autoload :VM, 'vagrant-invade/builder/vm'
|
|
6
7
|
autoload :Network, 'vagrant-invade/builder/network'
|
|
7
8
|
autoload :SSH, 'vagrant-invade/builder/ssh'
|
|
@@ -9,7 +10,7 @@ module VagrantPlugins
|
|
|
9
10
|
autoload :Provision, 'vagrant-invade/builder/provision'
|
|
10
11
|
autoload :SyncedFolder, 'vagrant-invade/builder/synced_folder'
|
|
11
12
|
autoload :Plugin, 'vagrant-invade/builder/plugin'
|
|
12
|
-
autoload :
|
|
13
|
+
autoload :Machine, 'vagrant-invade/builder/machine'
|
|
13
14
|
autoload :Vagrantfile, 'vagrant-invade/builder/vagrantfile'
|
|
14
15
|
|
|
15
16
|
TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'template')
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Generator
|
|
4
|
+
|
|
5
|
+
class HostManager
|
|
6
|
+
|
|
7
|
+
attr_accessor :hostmanager_data
|
|
8
|
+
|
|
9
|
+
def initialize(hostmanager_data)
|
|
10
|
+
@hostmanager_data = hostmanager_data
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def generate
|
|
14
|
+
hostmanager = Builder::HostManager.new(@hostmanager_data)
|
|
15
|
+
hostmanager.build
|
|
16
|
+
|
|
17
|
+
hostmanager.result
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Generator
|
|
4
|
+
|
|
5
|
+
class Machine
|
|
6
|
+
|
|
7
|
+
attr_accessor :machine_data
|
|
8
|
+
|
|
9
|
+
def initialize(machine_name, machine_data)
|
|
10
|
+
@machine_name = machine_name
|
|
11
|
+
@machine_data = machine_data
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def generate
|
|
15
|
+
machine = Builder::Machine.new(@machine_name, @machine_data)
|
|
16
|
+
machine.build
|
|
17
|
+
|
|
18
|
+
machine.result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Generator
|
|
4
|
+
|
|
5
|
+
module MachinePart
|
|
6
|
+
|
|
7
|
+
autoload :VM, 'vagrant-invade/generator/machine_part/vm'
|
|
8
|
+
autoload :Network, 'vagrant-invade/generator/machine_part/network'
|
|
9
|
+
autoload :SSH, 'vagrant-invade/generator/machine_part/ssh'
|
|
10
|
+
autoload :Provider, 'vagrant-invade/generator/machine_part/provider'
|
|
11
|
+
autoload :SyncedFolder, 'vagrant-invade/generator/machine_part/synced_folder'
|
|
12
|
+
autoload :Provision, 'vagrant-invade/generator/machine_part/provision'
|
|
13
|
+
autoload :Plugin, 'vagrant-invade/generator/machine_part/plugin'
|
|
14
|
+
|
|
15
|
+
attr_accessor :machine_part
|
|
16
|
+
|
|
17
|
+
def initialize(machine_part)
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -4,10 +4,9 @@ module VagrantPlugins
|
|
|
4
4
|
|
|
5
5
|
class Vagrantfile
|
|
6
6
|
|
|
7
|
-
attr_accessor :
|
|
7
|
+
attr_accessor :vagrantfile_data
|
|
8
8
|
|
|
9
|
-
def initialize(
|
|
10
|
-
@env = env
|
|
9
|
+
def initialize(vagrantfile_data)
|
|
11
10
|
@vagrantfile_data = vagrantfile_data
|
|
12
11
|
end
|
|
13
12
|
|
|
@@ -2,8 +2,9 @@ module VagrantPlugins
|
|
|
2
2
|
module Invade
|
|
3
3
|
module Generator
|
|
4
4
|
|
|
5
|
-
autoload :
|
|
6
|
-
autoload :
|
|
5
|
+
autoload :HostManager, 'vagrant-invade/generator/hostmanager'
|
|
6
|
+
autoload :MachinePart, 'vagrant-invade/generator/machine_part'
|
|
7
|
+
autoload :Machine, 'vagrant-invade/generator/machine'
|
|
7
8
|
autoload :Vagrantfile, 'vagrant-invade/generator/vagrantfile'
|
|
8
9
|
|
|
9
10
|
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% if enabled =%>
|
|
2
|
+
# --- Hostmanager Settings --- #
|
|
3
|
+
config.hostmanager.enabled = <%= enabled %>
|
|
4
|
+
config.hostmanager.manage_host = <%= manage_host %>
|
|
5
|
+
config.hostmanager.manage_guest = <%= manage_guest %>
|
|
6
|
+
config.hostmanager.ignore_private_ip = <%= ignore_private_ip %>
|
|
7
|
+
config.hostmanager.include_offline = <%= include_offline %>
|
|
8
|
+
<% end %>
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
config.vm.define "<%= machine_name %>" do |<%= machine_name %>|
|
|
2
2
|
|
|
3
3
|
<% if vm %>
|
|
4
|
-
# --- VM Section ---
|
|
5
4
|
<%= vm %>
|
|
6
5
|
<% end %>
|
|
7
6
|
<% if network %>
|
|
8
|
-
# --- Network Section ---
|
|
9
7
|
<%= network %>
|
|
10
8
|
<% end %>
|
|
11
9
|
<% if ssh %>
|
|
12
|
-
# --- SSH
|
|
10
|
+
# --- SSH Part --- #
|
|
13
11
|
<%= ssh %>
|
|
14
12
|
<% end %>
|
|
15
13
|
<% if provider %>
|
|
16
|
-
# --- Provider
|
|
17
|
-
|
|
14
|
+
# --- Provider Part --- #
|
|
15
|
+
<%= provider %>
|
|
18
16
|
<% end %>
|
|
19
17
|
<% if synced_folder %>
|
|
20
|
-
# --- Synced Folder
|
|
21
|
-
|
|
18
|
+
# --- Synced Folder Part --- #
|
|
19
|
+
<%= synced_folder %>
|
|
22
20
|
<% end %>
|
|
23
21
|
<% if provision %>
|
|
24
|
-
# --- Provision
|
|
22
|
+
# --- Provision Part --- #
|
|
25
23
|
<%= provision %>
|
|
26
24
|
<% end %>
|
|
27
25
|
<% if plugin %>
|
|
28
|
-
# --- Plugin
|
|
26
|
+
# --- Plugin Part --- #
|
|
29
27
|
<%= plugin %>
|
|
30
28
|
<% end %>
|
|
31
29
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
# --- Network Part --- #
|
|
2
|
+
<%= machine_name %>.vm.network "forwarded_port"
|
|
3
|
+
<% if guest %>, guest: <%= guest %><% end %>
|
|
4
|
+
<% if guest_ip %>, guest_ip: <%= guest_ip %><% end %>
|
|
5
|
+
<% if host %>, host: <%= host %><% end %>
|
|
6
|
+
<% if host_ip %>, host_ip: <%= host_ip %><% end %>
|
|
7
|
+
<% if protocol %>, protocol: <%= protocol %><% end %>
|
|
8
|
+
<% if auto_correct %>, auto_correct: <%= auto_correct %><% end %>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
# --- Network Part --- #
|
|
2
2
|
<%= machine_name %>.vm.network "private_network"<% if ip %>, ip: "<%= ip %>"<% end %><% if dhcp %>, type: "<%= dhcp %>"<% end %><% if auto_config %>, auto_config: <%= auto_config %><% end %>
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
<%= machine_name %>.hostmanager.
|
|
3
|
-
|
|
4
|
-
<% if manage_host %>
|
|
5
|
-
<%= machine_name %>.hostmanager.manage_host = <%= manage_host %>
|
|
6
|
-
<% end %>
|
|
7
|
-
<% if ignore_private_ip %>
|
|
8
|
-
<%= machine_name %>.hostmanager.ignore_private_ip = <%= ignore_private_ip %>
|
|
9
|
-
<% end %>
|
|
10
|
-
<% if include_offline %>
|
|
11
|
-
<%= machine_name %>.hostmanager.include_offline = <%= include_offline %>
|
|
12
|
-
<% end %>
|
|
13
|
-
<% if aliases %>
|
|
14
|
-
<%= machine_name %>.hostmanager.aliases = <%= aliases %>
|
|
15
|
-
<% end %>
|
|
1
|
+
<% if aliases %>
|
|
2
|
+
<%= machine_name %>.hostmanager.aliases = <%= aliases %>
|
|
3
|
+
<% end %>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Validator
|
|
4
|
+
|
|
5
|
+
class HostManager
|
|
6
|
+
|
|
7
|
+
attr_accessor :env
|
|
8
|
+
attr_accessor :hostmanager
|
|
9
|
+
|
|
10
|
+
DEFAULT = {
|
|
11
|
+
'enabled' => true,
|
|
12
|
+
'manage_host' => true,
|
|
13
|
+
'manage_guest' => true,
|
|
14
|
+
'ignore_private_ip' => false,
|
|
15
|
+
'include_offline' => true
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def initialize(hostmanager)
|
|
19
|
+
@hostmanager = hostmanager
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def validate
|
|
23
|
+
return nil unless @hostmanager
|
|
24
|
+
|
|
25
|
+
# ENABLED
|
|
26
|
+
@hostmanager['enabled'] = Validator.validate_boolean(
|
|
27
|
+
@hostmanager['enabled'], 'enabled', DEFAULT['enabled']
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# MANAGE HOST
|
|
31
|
+
@hostmanager['manage_host'] = Validator.validate_boolean(
|
|
32
|
+
@hostmanager['manage_host'], 'manage_host', DEFAULT['manage_host']
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# MANAGE GUEST
|
|
36
|
+
@hostmanager['manage_guest'] = Validator.validate_boolean(
|
|
37
|
+
@hostmanager['manage_guest'], 'manage_guest', DEFAULT['manage_guest']
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# IGNORE PRIVATE IP
|
|
41
|
+
@hostmanager['ignore_private_ip'] = Validator.validate_boolean(
|
|
42
|
+
@hostmanager['ignore_private_ip'], 'ignore_private_ip', DEFAULT['ignore_private_ip']
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# INCLUDE OFFLINE
|
|
46
|
+
@hostmanager['include_offline'] = Validator.validate_boolean(
|
|
47
|
+
@hostmanager['include_offline'], 'include_offline', DEFAULT['include_offline']
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
@hostmanager
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -3,6 +3,7 @@ module VagrantPlugins
|
|
|
3
3
|
module Validator
|
|
4
4
|
|
|
5
5
|
autoload :Invade, 'vagrant-invade/validator/invade'
|
|
6
|
+
autoload :HostManager, 'vagrant-invade/validator/hostmanager'
|
|
6
7
|
autoload :VM, 'vagrant-invade/validator/vm'
|
|
7
8
|
autoload :Network, 'vagrant-invade/validator/network'
|
|
8
9
|
autoload :Provider, 'vagrant-invade/validator/provider'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-invade
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lennart Stein
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -70,7 +70,8 @@ files:
|
|
|
70
70
|
- lib/vagrant-invade/action/init.rb
|
|
71
71
|
- lib/vagrant-invade/action/validate.rb
|
|
72
72
|
- lib/vagrant-invade/builder.rb
|
|
73
|
-
- lib/vagrant-invade/builder/
|
|
73
|
+
- lib/vagrant-invade/builder/hostmanager.rb
|
|
74
|
+
- lib/vagrant-invade/builder/machine.rb
|
|
74
75
|
- lib/vagrant-invade/builder/network.rb
|
|
75
76
|
- lib/vagrant-invade/builder/network/forwarded_port.rb
|
|
76
77
|
- lib/vagrant-invade/builder/network/private_network.rb
|
|
@@ -99,18 +100,20 @@ files:
|
|
|
99
100
|
- lib/vagrant-invade/command/root.rb
|
|
100
101
|
- lib/vagrant-invade/command/validate.rb
|
|
101
102
|
- lib/vagrant-invade/generator.rb
|
|
102
|
-
- lib/vagrant-invade/generator/
|
|
103
|
-
- lib/vagrant-invade/generator/
|
|
104
|
-
- lib/vagrant-invade/generator/
|
|
105
|
-
- lib/vagrant-invade/generator/
|
|
106
|
-
- lib/vagrant-invade/generator/
|
|
107
|
-
- lib/vagrant-invade/generator/
|
|
108
|
-
- lib/vagrant-invade/generator/
|
|
109
|
-
- lib/vagrant-invade/generator/
|
|
110
|
-
- lib/vagrant-invade/generator/
|
|
103
|
+
- lib/vagrant-invade/generator/hostmanager.rb
|
|
104
|
+
- lib/vagrant-invade/generator/machine.rb
|
|
105
|
+
- lib/vagrant-invade/generator/machine_part.rb
|
|
106
|
+
- lib/vagrant-invade/generator/machine_part/network.rb
|
|
107
|
+
- lib/vagrant-invade/generator/machine_part/plugin.rb
|
|
108
|
+
- lib/vagrant-invade/generator/machine_part/provider.rb
|
|
109
|
+
- lib/vagrant-invade/generator/machine_part/provision.rb
|
|
110
|
+
- lib/vagrant-invade/generator/machine_part/ssh.rb
|
|
111
|
+
- lib/vagrant-invade/generator/machine_part/synced_folder.rb
|
|
112
|
+
- lib/vagrant-invade/generator/machine_part/vm.rb
|
|
111
113
|
- lib/vagrant-invade/generator/vagrantfile.rb
|
|
112
114
|
- lib/vagrant-invade/plugin.rb
|
|
113
|
-
- lib/vagrant-invade/template/
|
|
115
|
+
- lib/vagrant-invade/template/hostmanager.erb
|
|
116
|
+
- lib/vagrant-invade/template/machine.erb
|
|
114
117
|
- lib/vagrant-invade/template/network/forwarded_port.erb
|
|
115
118
|
- lib/vagrant-invade/template/network/private_network.erb
|
|
116
119
|
- lib/vagrant-invade/template/network/public_network.erb
|
|
@@ -129,6 +132,7 @@ files:
|
|
|
129
132
|
- lib/vagrant-invade/template/v2.erb
|
|
130
133
|
- lib/vagrant-invade/template/vm/vm.erb
|
|
131
134
|
- lib/vagrant-invade/validator.rb
|
|
135
|
+
- lib/vagrant-invade/validator/hostmanager.rb
|
|
132
136
|
- lib/vagrant-invade/validator/invade.rb
|
|
133
137
|
- lib/vagrant-invade/validator/network.rb
|
|
134
138
|
- lib/vagrant-invade/validator/network/forwarded_port.rb
|
|
@@ -173,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
173
177
|
version: '0'
|
|
174
178
|
requirements: []
|
|
175
179
|
rubyforge_project:
|
|
176
|
-
rubygems_version: 2.
|
|
180
|
+
rubygems_version: 2.5.1
|
|
177
181
|
signing_key:
|
|
178
182
|
specification_version: 4
|
|
179
183
|
summary: Create a Vagrantfile with a single YAML configuration file
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
module VagrantPlugins
|
|
2
|
-
module Invade
|
|
3
|
-
module Builder
|
|
4
|
-
|
|
5
|
-
require 'erubis'
|
|
6
|
-
|
|
7
|
-
class Definition
|
|
8
|
-
|
|
9
|
-
attr_reader :result
|
|
10
|
-
attr_accessor :definition_data
|
|
11
|
-
|
|
12
|
-
def initialize(machine_name, definition_data, result: nil)
|
|
13
|
-
@machine_name = machine_name
|
|
14
|
-
@definition_data = definition_data
|
|
15
|
-
@result = result
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def build
|
|
19
|
-
b = binding
|
|
20
|
-
template_file = "#{TEMPLATE_PATH}/definition.erb"
|
|
21
|
-
|
|
22
|
-
begin
|
|
23
|
-
|
|
24
|
-
# Machine name
|
|
25
|
-
machine_name = @machine_name
|
|
26
|
-
|
|
27
|
-
# Data to build definition entry
|
|
28
|
-
vm = @definition_data['vm']
|
|
29
|
-
network = @definition_data['network']
|
|
30
|
-
ssh = @definition_data['ssh']
|
|
31
|
-
provider = @definition_data['provider']
|
|
32
|
-
synced_folder = @definition_data['synced_folder']
|
|
33
|
-
plugin = @definition_data['plugin']
|
|
34
|
-
provision = @definition_data['provision']
|
|
35
|
-
|
|
36
|
-
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
37
|
-
@result = eruby.result b
|
|
38
|
-
rescue TypeError, SyntaxError, SystemCallError => e
|
|
39
|
-
raise(e)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module VagrantPlugins
|
|
2
|
-
module Invade
|
|
3
|
-
module Generator
|
|
4
|
-
|
|
5
|
-
class Definition
|
|
6
|
-
|
|
7
|
-
attr_accessor :definition_data
|
|
8
|
-
|
|
9
|
-
def initialize(machine_name, definition_data)
|
|
10
|
-
@machine_name = machine_name
|
|
11
|
-
@definition_data = definition_data
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def generate
|
|
15
|
-
definition = Builder::Definition.new(@machine_name, @definition_data)
|
|
16
|
-
definition.build
|
|
17
|
-
|
|
18
|
-
definition.result
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module VagrantPlugins
|
|
2
|
-
module Invade
|
|
3
|
-
module Generator
|
|
4
|
-
module Section
|
|
5
|
-
|
|
6
|
-
autoload :VM, 'vagrant-invade/generator/section/vm'
|
|
7
|
-
autoload :Network, 'vagrant-invade/generator/section/network'
|
|
8
|
-
autoload :SSH, 'vagrant-invade/generator/section/ssh'
|
|
9
|
-
autoload :Provider, 'vagrant-invade/generator/section/provider'
|
|
10
|
-
autoload :SyncedFolder, 'vagrant-invade/generator/section/synced_folder'
|
|
11
|
-
autoload :Provision, 'vagrant-invade/generator/section/provision'
|
|
12
|
-
autoload :Plugin, 'vagrant-invade/generator/section/plugin'
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|