vagrant-invade 0.3.4 → 0.4.0.pre.alpha
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.lock +1 -1
- data/invade.yml.dist +11 -3
- data/lib/vagrant-invade/action/generate.rb +10 -0
- data/lib/vagrant-invade/action/validate.rb +4 -0
- data/lib/vagrant-invade/builder/definition.rb +2 -1
- data/lib/vagrant-invade/builder/plugin/hostmanager.rb +53 -0
- data/lib/vagrant-invade/builder/plugin/r10k.rb +172 -0
- data/lib/vagrant-invade/builder/plugin/winnfsd.rb +52 -0
- data/lib/vagrant-invade/builder/plugin.rb +13 -0
- data/lib/vagrant-invade/builder/provision/puppet.rb +8 -9
- data/lib/vagrant-invade/builder/synced_folder/nfs.rb +1 -1
- data/lib/vagrant-invade/builder.rb +1 -0
- data/lib/vagrant-invade/generator/section/plugin.rb +39 -0
- data/lib/vagrant-invade/generator/section.rb +1 -0
- data/lib/vagrant-invade/template/definition.erb +8 -0
- data/lib/vagrant-invade/template/plugin/hostmanager.erb +15 -0
- data/lib/vagrant-invade/template/plugin/r10k.erb +5 -0
- data/lib/vagrant-invade/template/plugin/winnfsd.erb +13 -0
- data/lib/vagrant-invade/template/provision/puppet.erb +17 -0
- data/lib/vagrant-invade/template/synced_folder/nfs.erb +1 -1
- data/lib/vagrant-invade/validator/plugin/r10k.rb +53 -0
- data/lib/vagrant-invade/validator/plugin/winnfsd.rb +4 -10
- data/lib/vagrant-invade/validator/plugin.rb +1 -0
- data/lib/vagrant-invade/validator/provision/puppet.rb +7 -16
- data/lib/vagrant-invade/version.rb +1 -1
- metadata +11 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bff9b6146d4b3ea022bd4ced0e2f12d108e5746a
|
|
4
|
+
data.tar.gz: 6228d34f409db94f205d250828c88875bc138fd0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52934d5f816f5405d4ac3f858ac0b1de5ea61d1fe12dccd7271fadbf36abc9ba09ebd8363005f0829998a8bcd8e041949c47cf8f6ba35df5210200a34e31c141
|
|
7
|
+
data.tar.gz: 9db271d24d4b4c531ddc5fd008dc9ae276a0b9f057d15266b0f87acffce9798652be6631f33980a096e1d799e77996bcb64a8f993ca31fec071d9868dd8be474
|
data/Gemfile.lock
CHANGED
data/invade.yml.dist
CHANGED
|
@@ -35,7 +35,6 @@ machines:
|
|
|
35
35
|
# source: '../..'
|
|
36
36
|
# mount_options:
|
|
37
37
|
# - nolock
|
|
38
|
-
# - udp
|
|
39
38
|
|
|
40
39
|
# provision:
|
|
41
40
|
# shell:
|
|
@@ -44,11 +43,20 @@ machines:
|
|
|
44
43
|
# shell:
|
|
45
44
|
# name: 'run-composer'
|
|
46
45
|
# path: '/home/vagrant/provision/shell/run-composer.sh'
|
|
46
|
+
# puppet:
|
|
47
|
+
# manifests_path: './puppet/manifests'
|
|
48
|
+
# manifest_file: 'init.pp'
|
|
49
|
+
# module_path: ['./puppet/modules', './puppet/vendor']
|
|
50
|
+
# facter: []
|
|
47
51
|
|
|
48
52
|
plugin:
|
|
49
53
|
hostmanager:
|
|
50
54
|
enabled: true
|
|
51
55
|
aliases:
|
|
52
56
|
- my-1337-project.local
|
|
53
|
-
winnfsd:
|
|
54
|
-
|
|
57
|
+
# winnfsd:
|
|
58
|
+
# enabled: true
|
|
59
|
+
# r10k:
|
|
60
|
+
# puppet_dir: './puppet'
|
|
61
|
+
# puppetfile_path: './puppet/Puppetfile'
|
|
62
|
+
# module_path: './puppet/vendor'
|
|
@@ -61,6 +61,7 @@ module VagrantPlugins
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
# SYNCED FOLDER
|
|
64
65
|
unless section['provision'] == nil
|
|
65
66
|
part['provision'] = ''
|
|
66
67
|
|
|
@@ -70,6 +71,15 @@ module VagrantPlugins
|
|
|
70
71
|
end
|
|
71
72
|
end
|
|
72
73
|
|
|
74
|
+
unless section['plugin'] == nil
|
|
75
|
+
part['plugin'] = ''
|
|
76
|
+
|
|
77
|
+
section['plugin'].each do |type, data|
|
|
78
|
+
parts = Generator::Section::Plugin.new(machine, @env[:ui], type, data).generate
|
|
79
|
+
part['plugin'].concat(parts)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
73
83
|
# # SSH
|
|
74
84
|
# unless section['ssh'] == nil
|
|
75
85
|
# part['ssh'] = Generator::Section::SSH.new(machine, section['ssh']).generate
|
|
@@ -99,6 +99,8 @@ module VagrantPlugins
|
|
|
99
99
|
case type
|
|
100
100
|
when 'shell'
|
|
101
101
|
provision = Validator::Provision::Shell.new(env, provision).validate
|
|
102
|
+
when 'shellinline', 'shell-inline'
|
|
103
|
+
provision = Validator::Provision::ShellInline.new(env, provision).validate
|
|
102
104
|
when 'puppet'
|
|
103
105
|
provision = Validator::Provision::Puppet.new(env, provision).validate
|
|
104
106
|
else
|
|
@@ -124,6 +126,8 @@ module VagrantPlugins
|
|
|
124
126
|
plugin = Validator::Plugin::HostManager.new(env, plugin).validate
|
|
125
127
|
when 'winnfsd'
|
|
126
128
|
plugin = Validator::Plugin::WinNFSd.new(env, plugin).validate
|
|
129
|
+
when 'r10k'
|
|
130
|
+
plugin = Validator::Plugin::R10k.new(env, plugin).validate
|
|
127
131
|
else
|
|
128
132
|
raise StandardError, "Plugin type unknown or not set. Please check configuration file."
|
|
129
133
|
end
|
|
@@ -29,7 +29,8 @@ module VagrantPlugins
|
|
|
29
29
|
network = @definition_data['network']
|
|
30
30
|
provider = @definition_data['provider']
|
|
31
31
|
synced_folder = @definition_data['synced_folder']
|
|
32
|
-
|
|
32
|
+
plugin = @definition_data['plugin']
|
|
33
|
+
provision = @definition_data['provision']
|
|
33
34
|
|
|
34
35
|
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
35
36
|
@result = eruby.result b
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Builder
|
|
4
|
+
module Plugin
|
|
5
|
+
|
|
6
|
+
require 'erubis'
|
|
7
|
+
|
|
8
|
+
class HostManager
|
|
9
|
+
|
|
10
|
+
attr_reader :result
|
|
11
|
+
attr_accessor :machine_name, :ui, :hostmanager_data
|
|
12
|
+
|
|
13
|
+
def initialize(machine_name, ui, hostmanager_data, result: nil)
|
|
14
|
+
@machine_name = machine_name
|
|
15
|
+
@hostmanager_data = hostmanager_data
|
|
16
|
+
@ui = ui
|
|
17
|
+
@result = result
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def build
|
|
21
|
+
|
|
22
|
+
unless Vagrant.has_plugin?('vagrant-hostmanager')
|
|
23
|
+
@ui.error("[Invade] Plugin 'vagrant-hostmanager' not installed but defined. Use 'vagrant plugin install vagrant-hostmanager' to install it.")
|
|
24
|
+
@result = ""
|
|
25
|
+
else
|
|
26
|
+
|
|
27
|
+
b = binding
|
|
28
|
+
template_file = "#{TEMPLATE_PATH}/plugin/hostmanager.erb"
|
|
29
|
+
|
|
30
|
+
begin
|
|
31
|
+
|
|
32
|
+
# Get machine name
|
|
33
|
+
machine_name = @machine_name
|
|
34
|
+
|
|
35
|
+
# Values for hostmanager section
|
|
36
|
+
enabled = @hostmanager_data['enabled']
|
|
37
|
+
manage_host = @hostmanager_data['manage_host']
|
|
38
|
+
ignore_private_ip = @hostmanager_data['ignore_private_ip']
|
|
39
|
+
include_offline =@hostmanager_data['include_offline']
|
|
40
|
+
aliases = @hostmanager_data['aliases']
|
|
41
|
+
|
|
42
|
+
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
43
|
+
@result = eruby.result b
|
|
44
|
+
rescue TypeError, SyntaxError, SystemCallError => e
|
|
45
|
+
raise(e)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
require 'uri'
|
|
2
|
+
|
|
3
|
+
module VagrantPlugins
|
|
4
|
+
module Invade
|
|
5
|
+
module Builder
|
|
6
|
+
module Plugin
|
|
7
|
+
|
|
8
|
+
require 'erubis'
|
|
9
|
+
|
|
10
|
+
class R10k
|
|
11
|
+
|
|
12
|
+
attr_reader :result
|
|
13
|
+
attr_accessor :machine_name, :ui, :r10k_data
|
|
14
|
+
|
|
15
|
+
def initialize(machine_name, ui, r10k_data, result: nil)
|
|
16
|
+
@machine_name = machine_name
|
|
17
|
+
@ui = ui
|
|
18
|
+
@r10k_data = r10k_data
|
|
19
|
+
@result = result
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def build
|
|
23
|
+
|
|
24
|
+
unless Vagrant.has_plugin?('vagrant-r10k')
|
|
25
|
+
@ui.error("[Invade] Plugin 'vagrant-r10k' not installed but defined. Use 'vagrant plugin install vagrant-r10k' to install it.")
|
|
26
|
+
@result = ""
|
|
27
|
+
else
|
|
28
|
+
|
|
29
|
+
b = binding
|
|
30
|
+
template_file = "#{TEMPLATE_PATH}/plugin/r10k.erb"
|
|
31
|
+
|
|
32
|
+
begin
|
|
33
|
+
|
|
34
|
+
# Only generate puppetfile if modules are given in configuration file
|
|
35
|
+
if @r10k_data['enabled'] && @r10k_data['modules']
|
|
36
|
+
|
|
37
|
+
basic_modules = [
|
|
38
|
+
%w(https://github.com/puppetlabs/puppetlabs-stdlib.git),
|
|
39
|
+
%w(https://github.com/puppetlabs/puppetlabs-apt.git),
|
|
40
|
+
%w(https://github.com/example42/puppi.git)
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
puppetfile_path = File.expand_path(@r10k_data['puppetfile_path'])
|
|
44
|
+
|
|
45
|
+
# Generate Puppetfile
|
|
46
|
+
merged_modules = concat_module_array(basic_modules, @r10k_data['modules'])
|
|
47
|
+
build_puppetfile(merged_modules, puppetfile_path)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Get machine name
|
|
51
|
+
machine_name = @machine_name
|
|
52
|
+
|
|
53
|
+
# Values for r10k section
|
|
54
|
+
enabled = @r10k_data['enabled']
|
|
55
|
+
puppet_dir = @r10k_data['puppet_dir']
|
|
56
|
+
puppetfile_path = @r10k_data['puppetfile_path']
|
|
57
|
+
module_path = @r10k_data['module_path']
|
|
58
|
+
|
|
59
|
+
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
60
|
+
@result = eruby.result b
|
|
61
|
+
rescue TypeError, SyntaxError, SystemCallError => e
|
|
62
|
+
raise(e)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
def build_puppetfile(modules, puppetfile)
|
|
70
|
+
|
|
71
|
+
begin
|
|
72
|
+
if File.exist?(puppetfile)
|
|
73
|
+
File.delete(puppetfile)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
File.open(puppetfile, 'w+') {|f| f.write("#Modules\n") }
|
|
77
|
+
|
|
78
|
+
modules.each_with_index do |moduleScript, index|
|
|
79
|
+
File.open(puppetfile, 'a+') do |f|
|
|
80
|
+
f.puts generate_puppetfile_data(
|
|
81
|
+
modules[index][0],
|
|
82
|
+
module_version: modules[index][1],
|
|
83
|
+
module_name: modules[index][2]
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
rescue StandardError => error
|
|
88
|
+
print "\nIO failed: #{error}"
|
|
89
|
+
raise
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Concats an given Array with an other Array with data
|
|
94
|
+
def concat_module_array(base_array, ext_array)
|
|
95
|
+
unless ext_array.to_a.empty? || ext_array.to_a.nil?
|
|
96
|
+
ext_array.each do |modules|
|
|
97
|
+
base_array.push(modules.flatten)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
base_array
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Generates the Puppetfile needed by r10k plugin to download puppet modules
|
|
105
|
+
def generate_puppetfile_data(module_url, module_version: nil, module_name: nil)
|
|
106
|
+
|
|
107
|
+
# build name part
|
|
108
|
+
if module_name.nil? || module_name.empty?
|
|
109
|
+
module_name = get_module_name_from_repo_url(module_url)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
definition = "mod '#{module_name}',"
|
|
113
|
+
definition.concat("\n :git => '#{module_url}'")
|
|
114
|
+
|
|
115
|
+
# build version part
|
|
116
|
+
unless module_version.nil? || module_version.empty?
|
|
117
|
+
definition.concat(",\n :ref => '#{module_version}'")
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
definition.concat("\n")
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Gets module name from a repository URL
|
|
124
|
+
def get_module_name_from_repo_url(repository_url)
|
|
125
|
+
|
|
126
|
+
# URL must include '/'
|
|
127
|
+
unless repository_url.include? '/'
|
|
128
|
+
self.add_invade_text(
|
|
129
|
+
MESSAGE_EXIT,
|
|
130
|
+
sprintf(
|
|
131
|
+
"Invalid repository path: '%s'. Path must include username and repository name. Example: 'magneton/xmen-protocol'.",
|
|
132
|
+
repository_url
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Get last part of the URI
|
|
138
|
+
repository_name = URI(repository_url).path.split('/').last
|
|
139
|
+
|
|
140
|
+
# Removes .git from name
|
|
141
|
+
repository_name = repository_name.partition('.').first
|
|
142
|
+
|
|
143
|
+
# Dashs in combination with lower dashs in a path are not allowed
|
|
144
|
+
dash_count = repository_name.count('-')
|
|
145
|
+
lower_dash_count = repository_name.count('_')
|
|
146
|
+
|
|
147
|
+
if dash_count > 0 && lower_dash_count > 0
|
|
148
|
+
self.add_invade_text(MESSAGE_EXIT,
|
|
149
|
+
sprintf(
|
|
150
|
+
"Invalid repository path: '%s'. It includes at least one dash and one lower dash. Can't generate a repository name. Please use the optional module_name paramater to manually define a name for this module.",
|
|
151
|
+
repository_name
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
else
|
|
155
|
+
if dash_count > 0
|
|
156
|
+
cut_character = '-'
|
|
157
|
+
repository_name = repository_name.partition(cut_character).last
|
|
158
|
+
elsif lower_dash_count > 0
|
|
159
|
+
cut_character = '_'
|
|
160
|
+
repository_name = repository_name.partition(cut_character).last
|
|
161
|
+
else
|
|
162
|
+
return repository_name
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
repository_name
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Builder
|
|
4
|
+
module Plugin
|
|
5
|
+
|
|
6
|
+
require 'erubis'
|
|
7
|
+
|
|
8
|
+
class WinNFSd
|
|
9
|
+
|
|
10
|
+
attr_reader :result
|
|
11
|
+
attr_accessor :machine_name, :ui, :winnfsd_data
|
|
12
|
+
|
|
13
|
+
def initialize(machine_name, ui, winnfsd_data, result: nil)
|
|
14
|
+
@machine_name = machine_name
|
|
15
|
+
@ui = ui
|
|
16
|
+
@winnfsd_data = winnfsd_data
|
|
17
|
+
@result = result
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def build
|
|
21
|
+
|
|
22
|
+
unless Vagrant.has_plugin?('vagrant-winnfsd')
|
|
23
|
+
@ui.error("[Invade] Plugin 'vagrant-winnfsd' not installed but defined. Use 'vagrant plugin install vagrant-winnfsd' to install it.")
|
|
24
|
+
@result = ""
|
|
25
|
+
else
|
|
26
|
+
|
|
27
|
+
b = binding
|
|
28
|
+
template_file = "#{TEMPLATE_PATH}/plugin/winnfsd.erb"
|
|
29
|
+
|
|
30
|
+
begin
|
|
31
|
+
|
|
32
|
+
# Get machine name
|
|
33
|
+
machine_name = @machine_name
|
|
34
|
+
|
|
35
|
+
# Values for winnfsd section
|
|
36
|
+
logging = @winnfsd_data['logging']
|
|
37
|
+
uid = @winnfsd_data['uid']
|
|
38
|
+
gid = @winnfsd_data['gid']
|
|
39
|
+
|
|
40
|
+
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
41
|
+
@result = eruby.result b
|
|
42
|
+
rescue TypeError, SyntaxError, SystemCallError => e
|
|
43
|
+
raise(e)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Builder
|
|
4
|
+
module Plugin
|
|
5
|
+
|
|
6
|
+
autoload :HostManager, 'vagrant-invade/builder/plugin/hostmanager.rb'
|
|
7
|
+
autoload :WinNFSd, 'vagrant-invade/builder/plugin/winnfsd.rb'
|
|
8
|
+
autoload :R10k, 'vagrant-invade/builder/plugin/r10k.rb'
|
|
9
|
+
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -12,8 +12,8 @@ module VagrantPlugins
|
|
|
12
12
|
|
|
13
13
|
def initialize(machine_name, puppet_data, result: nil)
|
|
14
14
|
@machine_name = machine_name
|
|
15
|
-
@puppet_data
|
|
16
|
-
@result
|
|
15
|
+
@puppet_data = puppet_data
|
|
16
|
+
@result = result
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def build
|
|
@@ -25,13 +25,12 @@ module VagrantPlugins
|
|
|
25
25
|
# Get machine name
|
|
26
26
|
machine_name = @machine_name
|
|
27
27
|
|
|
28
|
-
# Values for provider section
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
natdns = @puppet_data['natdns']
|
|
28
|
+
# Values for provider puppet section
|
|
29
|
+
module_path = @puppet_data['module_path']
|
|
30
|
+
manifests_path = @puppet_data['manifests_path']
|
|
31
|
+
manifest_file = @puppet_data['manifest_file']
|
|
32
|
+
hiera_config_path = @puppet_data['hiera_config_path']
|
|
33
|
+
facter = @puppet_data['facter']
|
|
35
34
|
|
|
36
35
|
eruby = Erubis::Eruby.new(File.read(template_file))
|
|
37
36
|
@result = eruby.result b
|
|
@@ -26,7 +26,7 @@ module VagrantPlugins
|
|
|
26
26
|
machine_name = @machine_name
|
|
27
27
|
|
|
28
28
|
# Values for provider sections
|
|
29
|
-
enabled =
|
|
29
|
+
enabled = @nfs_data['enabled']
|
|
30
30
|
uid = @nfs_data['uid']
|
|
31
31
|
gid = @nfs_data['gid']
|
|
32
32
|
source = @nfs_data['source']
|
|
@@ -7,6 +7,7 @@ module VagrantPlugins
|
|
|
7
7
|
autoload :Provider, 'vagrant-invade/builder/provider'
|
|
8
8
|
autoload :Provision, 'vagrant-invade/builder/provision'
|
|
9
9
|
autoload :SyncedFolder, 'vagrant-invade/builder/synced_folder'
|
|
10
|
+
autoload :Plugin, 'vagrant-invade/builder/plugin'
|
|
10
11
|
autoload :Definition, 'vagrant-invade/builder/definition'
|
|
11
12
|
autoload :Vagrantfile, 'vagrant-invade/builder/vagrantfile'
|
|
12
13
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Generator
|
|
4
|
+
module Section
|
|
5
|
+
|
|
6
|
+
class Plugin
|
|
7
|
+
|
|
8
|
+
attr_accessor :machine_name, :ui, :type, :plugin_data
|
|
9
|
+
|
|
10
|
+
def initialize(machine_name, ui, type, plugin_data)
|
|
11
|
+
@machine_name = machine_name
|
|
12
|
+
@ui = ui
|
|
13
|
+
@type = type
|
|
14
|
+
@plugin_data = plugin_data
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def generate
|
|
18
|
+
case @type
|
|
19
|
+
when 'hostmanager'
|
|
20
|
+
plugin = Builder::Plugin::HostManager.new(@machine_name, @ui, @plugin_data)
|
|
21
|
+
when 'winnfsd'
|
|
22
|
+
plugin = Builder::Plugin::WinNFSd.new(@machine_name, @ui, @plugin_data)
|
|
23
|
+
when 'r10k'
|
|
24
|
+
plugin = Builder::Plugin::R10k.new(@machine_name, @ui, @plugin_data)
|
|
25
|
+
else
|
|
26
|
+
raise StandardError, "Plugin unknown or not set. Please check the plugin configuration."
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
plugin.build
|
|
30
|
+
|
|
31
|
+
plugin.result
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -8,6 +8,7 @@ module VagrantPlugins
|
|
|
8
8
|
autoload :Provider, 'vagrant-invade/generator/section/provider'
|
|
9
9
|
autoload :SyncedFolder, 'vagrant-invade/generator/section/synced_folder'
|
|
10
10
|
autoload :Provision, 'vagrant-invade/generator/section/provision'
|
|
11
|
+
autoload :Plugin, 'vagrant-invade/generator/section/plugin'
|
|
11
12
|
|
|
12
13
|
end
|
|
13
14
|
end
|
|
@@ -16,4 +16,12 @@ config.vm.define "<%= machine_name %>" do |<%= machine_name %>|
|
|
|
16
16
|
# Synced folder configuration
|
|
17
17
|
<%= synced_folder %>
|
|
18
18
|
<% end %>
|
|
19
|
+
<% if provision %>
|
|
20
|
+
# Provision configuration
|
|
21
|
+
<%= provision %>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% if plugin %>
|
|
24
|
+
# Plugin configuration
|
|
25
|
+
<%= plugin %>
|
|
26
|
+
<% end %>
|
|
19
27
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% if enabled %>
|
|
2
|
+
<%= machine_name %>.hostmanager.enabled = <%= enabled %>
|
|
3
|
+
<% end %>
|
|
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 %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% if uid %>
|
|
2
|
+
<%= machine_name %>.winnfsd.uid = <%= uid %>
|
|
3
|
+
<% else %>
|
|
4
|
+
<%= machine_name %>.winnfsd.uid = Process.uid
|
|
5
|
+
<% end %>
|
|
6
|
+
<% if gid %>
|
|
7
|
+
<%= machine_name %>.winnfsd.gid = <%= gid %>
|
|
8
|
+
<% else %>
|
|
9
|
+
<%= machine_name %>.winnfsd.gid = Process.gid
|
|
10
|
+
<% end %>
|
|
11
|
+
<% if logging %>
|
|
12
|
+
<%= machine_name %>.winnfsd.logging = <%= logging %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= machine_name %>.vm.provision :puppet do |puppet|
|
|
2
|
+
<% if manifests_path %>
|
|
3
|
+
puppet.manifests_path = '<%= manifests_path %>'
|
|
4
|
+
<% end %>
|
|
5
|
+
<% if manifest_file %>
|
|
6
|
+
puppet.manifest_file = '<%= manifest_file %>'
|
|
7
|
+
<% end %>
|
|
8
|
+
<% if module_path %>
|
|
9
|
+
puppet.module_path = '<%= module_path %>'
|
|
10
|
+
<% end %>
|
|
11
|
+
<% if hiera_config_path %>
|
|
12
|
+
puppet.hiera_config_path = '<%= hiera_config_path %>'
|
|
13
|
+
<% end %>
|
|
14
|
+
<% if facter %>
|
|
15
|
+
puppet.facter = <%= facter %>
|
|
16
|
+
<% end %>
|
|
17
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%= machine_name %>.vm.synced_folder '<%= source %>', '<%= path %>',
|
|
2
|
-
type: 'nfs'
|
|
2
|
+
type: 'nfs'<% if mount_options %>, mount_options: <%= mount_options %><% end %><% if enabled %>, disabled: true<% end %>
|
|
3
3
|
<% if uid %>
|
|
4
4
|
<%= machine_name %>.nfs.map_uid = <%= uid %>
|
|
5
5
|
<% else %>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module Invade
|
|
3
|
+
module Validator
|
|
4
|
+
module Plugin
|
|
5
|
+
|
|
6
|
+
class R10k
|
|
7
|
+
|
|
8
|
+
attr_accessor :env
|
|
9
|
+
attr_accessor :r10k
|
|
10
|
+
|
|
11
|
+
DEFAULT = {
|
|
12
|
+
'enabled' => false,
|
|
13
|
+
'puppet_dir' => nil,
|
|
14
|
+
'puppetfile_path' => nil,
|
|
15
|
+
'module_path' => nil,
|
|
16
|
+
'modules' => nil
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
def initialize(env, r10k)
|
|
20
|
+
@env = env
|
|
21
|
+
@r10k = r10k
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def validate
|
|
25
|
+
return nil unless @r10k
|
|
26
|
+
|
|
27
|
+
@r10k['enabled'] = Validator.validate_boolean(
|
|
28
|
+
@r10k['enabled'], 'enabled', DEFAULT['enabled']
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
@r10k['puppet_dir'] = Validator.validate_string(
|
|
32
|
+
@r10k['puppet_dir'], 'puppet_dir', DEFAULT['puppet_dir']
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
@r10k['puppetfile_path'] = Validator.validate_string(
|
|
36
|
+
@r10k['puppetfile_path'], 'puppetfile_path', DEFAULT['puppetfile_path']
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
@r10k['module_path'] = Validator.validate_string(
|
|
40
|
+
@r10k['module_path'], 'module_path', DEFAULT['module_path']
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
@r10k['modules'] = Validator.validate_array(
|
|
44
|
+
@r10k['modules'], 'modules', DEFAULT['modules']
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
@r10k
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -9,10 +9,9 @@ module VagrantPlugins
|
|
|
9
9
|
attr_accessor :winnfsd
|
|
10
10
|
|
|
11
11
|
DEFAULT = {
|
|
12
|
-
'enabled' => true,
|
|
13
12
|
'logging' => false,
|
|
14
|
-
'uid' =>
|
|
15
|
-
'guid' =>
|
|
13
|
+
'uid' => nil,
|
|
14
|
+
'guid' => nil
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
def initialize(env, winnfsd)
|
|
@@ -23,11 +22,6 @@ module VagrantPlugins
|
|
|
23
22
|
def validate
|
|
24
23
|
return nil unless @winnfsd
|
|
25
24
|
|
|
26
|
-
# ENABLED
|
|
27
|
-
@winnfsd['enabled'] = Validator.validate_boolean(
|
|
28
|
-
@winnfsd['enabled'], 'enabled', DEFAULT['enabled']
|
|
29
|
-
)
|
|
30
|
-
|
|
31
25
|
# LOGGING (activate the logging of the NFS daemon which will show the daemon window in the foreground)
|
|
32
26
|
@winnfsd['logging'] = Validator.validate_boolean(
|
|
33
27
|
@winnfsd['logging'], 'logging', DEFAULT['logging']
|
|
@@ -39,8 +33,8 @@ module VagrantPlugins
|
|
|
39
33
|
)
|
|
40
34
|
|
|
41
35
|
# Group ID
|
|
42
|
-
@winnfsd['
|
|
43
|
-
@winnfsd['
|
|
36
|
+
@winnfsd['gid'] = Validator.validate_integer(
|
|
37
|
+
@winnfsd['gid'], 'gid', DEFAULT['gid']
|
|
44
38
|
)
|
|
45
39
|
|
|
46
40
|
@winnfsd
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'rbconfig'
|
|
2
|
+
|
|
1
3
|
module VagrantPlugins
|
|
2
4
|
module Invade
|
|
3
5
|
module Validator
|
|
@@ -9,29 +11,24 @@ module VagrantPlugins
|
|
|
9
11
|
attr_accessor :puppet
|
|
10
12
|
|
|
11
13
|
DEFAULT = {
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'manifests' => 'manifests',
|
|
14
|
+
'modules_path' => '.puppet/modules',
|
|
15
|
+
'manifests_path' => './puppet/manifests',
|
|
15
16
|
'manifest_file' => 'init.pp',
|
|
16
17
|
'hiera_config_path' => nil,
|
|
17
|
-
'facter' =>
|
|
18
|
+
'facter' => {}
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
def initialize(env, puppet)
|
|
21
22
|
@env = env
|
|
22
23
|
@puppet = Provision.validate_base(env, puppet)
|
|
24
|
+
@invade = env[:invade]
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
def validate
|
|
26
28
|
return nil unless @puppet
|
|
27
29
|
|
|
28
|
-
# FOLDER
|
|
29
|
-
@puppet['folder'] = Validator.validate_string(
|
|
30
|
-
@puppet['folder'], 'folder', DEFAULT['folder']
|
|
31
|
-
)
|
|
32
|
-
|
|
33
30
|
# MODULES PATH
|
|
34
|
-
@puppet['modules_path'] = Validator.
|
|
31
|
+
@puppet['modules_path'] = Validator.validate_array(
|
|
35
32
|
@puppet['modules_path'], 'modules_path', DEFAULT['modules_path']
|
|
36
33
|
)
|
|
37
34
|
|
|
@@ -57,12 +54,6 @@ module VagrantPlugins
|
|
|
57
54
|
|
|
58
55
|
@puppet
|
|
59
56
|
end
|
|
60
|
-
|
|
61
|
-
def self.default(params)
|
|
62
|
-
@folder = params[:folder]
|
|
63
|
-
@modules_path = params[:modules_path]
|
|
64
|
-
@manifests_path = params[:manifests_path]
|
|
65
|
-
end
|
|
66
57
|
end
|
|
67
58
|
end
|
|
68
59
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-invade
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0.pre.alpha
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lennart Stein
|
|
@@ -75,6 +75,10 @@ files:
|
|
|
75
75
|
- lib/vagrant-invade/builder/network/forwarded_port.rb
|
|
76
76
|
- lib/vagrant-invade/builder/network/private_network.rb
|
|
77
77
|
- lib/vagrant-invade/builder/network/public_network.rb
|
|
78
|
+
- lib/vagrant-invade/builder/plugin.rb
|
|
79
|
+
- lib/vagrant-invade/builder/plugin/hostmanager.rb
|
|
80
|
+
- lib/vagrant-invade/builder/plugin/r10k.rb
|
|
81
|
+
- lib/vagrant-invade/builder/plugin/winnfsd.rb
|
|
78
82
|
- lib/vagrant-invade/builder/provider.rb
|
|
79
83
|
- lib/vagrant-invade/builder/provider/virtualbox.rb
|
|
80
84
|
- lib/vagrant-invade/builder/provider/vmware.rb
|
|
@@ -107,6 +111,9 @@ files:
|
|
|
107
111
|
- lib/vagrant-invade/template/network/forwarded_port.erb
|
|
108
112
|
- lib/vagrant-invade/template/network/private_network.erb
|
|
109
113
|
- lib/vagrant-invade/template/network/public_network.erb
|
|
114
|
+
- lib/vagrant-invade/template/plugin/hostmanager.erb
|
|
115
|
+
- lib/vagrant-invade/template/plugin/r10k.erb
|
|
116
|
+
- lib/vagrant-invade/template/plugin/winnfsd.erb
|
|
110
117
|
- lib/vagrant-invade/template/provider/virtualbox.erb
|
|
111
118
|
- lib/vagrant-invade/template/provider/vmware.erb
|
|
112
119
|
- lib/vagrant-invade/template/provision/puppet.erb
|
|
@@ -124,6 +131,7 @@ files:
|
|
|
124
131
|
- lib/vagrant-invade/validator/network/public_network.rb
|
|
125
132
|
- lib/vagrant-invade/validator/plugin.rb
|
|
126
133
|
- lib/vagrant-invade/validator/plugin/hostmanager.rb
|
|
134
|
+
- lib/vagrant-invade/validator/plugin/r10k.rb
|
|
127
135
|
- lib/vagrant-invade/validator/plugin/winnfsd.rb
|
|
128
136
|
- lib/vagrant-invade/validator/provider.rb
|
|
129
137
|
- lib/vagrant-invade/validator/provider/virtualbox.rb
|
|
@@ -154,9 +162,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
154
162
|
version: 2.0.0
|
|
155
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
164
|
requirements:
|
|
157
|
-
- - '
|
|
165
|
+
- - '>'
|
|
158
166
|
- !ruby/object:Gem::Version
|
|
159
|
-
version:
|
|
167
|
+
version: 1.3.1
|
|
160
168
|
requirements: []
|
|
161
169
|
rubyforge_project:
|
|
162
170
|
rubygems_version: 2.4.8
|