vagrant-invade 0.0.1 → 0.2.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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +17 -0
  3. data/.gitignore +4 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +106 -0
  6. data/LICENSE +339 -0
  7. data/README.md +4 -0
  8. data/Rakefile +3 -0
  9. data/images/logo-128.png +0 -0
  10. data/images/logo-256.png +0 -0
  11. data/images/logo-512.png +0 -0
  12. data/invade.yml.dist +56 -0
  13. data/lib/vagrant-invade/action/config.rb +73 -0
  14. data/lib/vagrant-invade/action/create.rb +97 -0
  15. data/lib/vagrant-invade/action/generate.rb +95 -0
  16. data/lib/vagrant-invade/action/validate.rb +156 -0
  17. data/lib/vagrant-invade/action.rb +34 -0
  18. data/lib/vagrant-invade/builder/definition.rb +43 -0
  19. data/lib/vagrant-invade/builder/network/forwarded_port.rb +47 -0
  20. data/lib/vagrant-invade/builder/network/private_network.rb +41 -0
  21. data/lib/vagrant-invade/builder/network/public_network.rb +43 -0
  22. data/lib/vagrant-invade/builder/network.rb +13 -0
  23. data/lib/vagrant-invade/builder/provider/virtualbox.rb +47 -0
  24. data/lib/vagrant-invade/builder/provider/vmware.rb +44 -0
  25. data/lib/vagrant-invade/builder/provider.rb +12 -0
  26. data/lib/vagrant-invade/builder/provision/puppet.rb +47 -0
  27. data/lib/vagrant-invade/builder/provision/shell.rb +45 -0
  28. data/lib/vagrant-invade/builder/provision/shell_inline.rb +45 -0
  29. data/lib/vagrant-invade/builder/provision.rb +12 -0
  30. data/lib/vagrant-invade/builder/synced_folder/nfs.rb +48 -0
  31. data/lib/vagrant-invade/builder/synced_folder/virtualbox.rb +48 -0
  32. data/lib/vagrant-invade/builder/synced_folder.rb +12 -0
  33. data/lib/vagrant-invade/builder/vagrantfile.rb +35 -0
  34. data/lib/vagrant-invade/builder/vm.rb +41 -0
  35. data/lib/vagrant-invade/builder.rb +17 -0
  36. data/lib/vagrant-invade/command/base.rb +19 -0
  37. data/lib/vagrant-invade/command/build.rb +37 -0
  38. data/lib/vagrant-invade/command/root.rb +73 -0
  39. data/lib/vagrant-invade/command/validate.rb +37 -0
  40. data/lib/vagrant-invade/generator/definition.rb +25 -0
  41. data/lib/vagrant-invade/generator/section/network.rb +38 -0
  42. data/lib/vagrant-invade/generator/section/plugin.rb +0 -0
  43. data/lib/vagrant-invade/generator/section/provider.rb +36 -0
  44. data/lib/vagrant-invade/generator/section/provision.rb +38 -0
  45. data/lib/vagrant-invade/generator/section/synced_folder.rb +36 -0
  46. data/lib/vagrant-invade/generator/section/vm.rb +27 -0
  47. data/lib/vagrant-invade/generator/section.rb +15 -0
  48. data/lib/vagrant-invade/generator/vagrantfile.rb +24 -0
  49. data/lib/vagrant-invade/generator.rb +11 -0
  50. data/lib/vagrant-invade/plugin.rb +28 -0
  51. data/lib/vagrant-invade/template/definition.erb +19 -0
  52. data/lib/vagrant-invade/template/network/forwarded_port.erb +8 -0
  53. data/lib/vagrant-invade/template/network/private_network.erb +1 -0
  54. data/lib/vagrant-invade/template/network/public_network.erb +5 -0
  55. data/lib/vagrant-invade/template/provider/virtualbox.erb +11 -0
  56. data/lib/vagrant-invade/template/provider/vmware.erb +5 -0
  57. data/lib/vagrant-invade/template/provision/puppet.erb +0 -0
  58. data/lib/vagrant-invade/template/provision/shell.erb +2 -0
  59. data/lib/vagrant-invade/template/provision/shell_inline.erb +2 -0
  60. data/lib/vagrant-invade/template/synced_folder/nfs.erb +12 -0
  61. data/lib/vagrant-invade/template/synced_folder/virtualbox.erb +1 -0
  62. data/lib/vagrant-invade/template/v2.erb +9 -0
  63. data/lib/vagrant-invade/template/vm/vm.erb +7 -0
  64. data/lib/vagrant-invade/validator/invade.rb +39 -0
  65. data/lib/vagrant-invade/validator/network/forwarded_port.rb +68 -0
  66. data/lib/vagrant-invade/validator/network/private_network.rb +44 -0
  67. data/lib/vagrant-invade/validator/network/public_network.rb +56 -0
  68. data/lib/vagrant-invade/validator/network.rb +13 -0
  69. data/lib/vagrant-invade/validator/plugin/hostmanager.rb +57 -0
  70. data/lib/vagrant-invade/validator/plugin/winnfsd.rb +52 -0
  71. data/lib/vagrant-invade/validator/plugin.rb +12 -0
  72. data/lib/vagrant-invade/validator/provider/virtualbox.rb +46 -0
  73. data/lib/vagrant-invade/validator/provider/vmware.rb +27 -0
  74. data/lib/vagrant-invade/validator/provider.rb +39 -0
  75. data/lib/vagrant-invade/validator/provision/puppet.rb +70 -0
  76. data/lib/vagrant-invade/validator/provision/shell.rb +52 -0
  77. data/lib/vagrant-invade/validator/provision/shell_inline.rb +52 -0
  78. data/lib/vagrant-invade/validator/provision.rb +22 -0
  79. data/lib/vagrant-invade/validator/ssh.rb +38 -0
  80. data/lib/vagrant-invade/validator/synced_folder/nfs.rb +46 -0
  81. data/lib/vagrant-invade/validator/synced_folder/vb.rb +52 -0
  82. data/lib/vagrant-invade/validator/synced_folder.rb +36 -0
  83. data/lib/vagrant-invade/validator/vm.rb +45 -0
  84. data/lib/vagrant-invade/validator.rb +113 -0
  85. data/lib/vagrant-invade/version.rb +5 -0
  86. data/lib/vagrant-invade.rb +41 -0
  87. data/pkg/vagrant-invade-0.0.1.gem +0 -0
  88. data/vagrant-invade.gemspec +17 -0
  89. metadata +94 -7
@@ -0,0 +1,47 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+ module Provision
5
+
6
+ require 'erubis'
7
+
8
+ class Puppet
9
+
10
+ attr_reader :result
11
+ attr_accessor :machine_name, :puppet_data
12
+
13
+ def initialize(machine_name, puppet_data, result: nil)
14
+ @machine_name = machine_name
15
+ @puppet_data = puppet_data
16
+ @result = result
17
+ end
18
+
19
+ def build
20
+ b = binding
21
+ template_file = "#{TEMPLATE_PATH}/provision/puppet.erb"
22
+
23
+ begin
24
+
25
+ # Get machine name
26
+ machine_name = @machine_name
27
+
28
+ # Values for provider section
29
+ name = @puppet_data['name']
30
+ type = @puppet_data['type']
31
+ cpus = @puppet_data['cores']
32
+ memory = @puppet_data['memory']
33
+ nicspeed = @puppet_data['nicspeed']
34
+ natdns = @puppet_data['natdns']
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
+
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,45 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+ module Provision
5
+
6
+ require 'erubis'
7
+
8
+ class Shell
9
+
10
+ attr_reader :result
11
+ attr_accessor :machine_name, :shell_data
12
+
13
+ def initialize(machine_name, shell_data, result: nil)
14
+ @machine_name = machine_name
15
+ @shell_data = shell_data
16
+ @result = result
17
+ end
18
+
19
+ def build
20
+ b = binding
21
+ template_file = "#{TEMPLATE_PATH}/provision/shell.erb"
22
+
23
+ begin
24
+
25
+ # Get machine name
26
+ machine_name = @machine_name
27
+
28
+ # Values for shell provision section
29
+ name = @shell_data['name']
30
+ path = @shell_data['path']
31
+ binary = @shell_data['binary']
32
+ privileged = @shell_data['privileged']
33
+
34
+ eruby = Erubis::Eruby.new(File.read(template_file))
35
+ @result = eruby.result b
36
+ rescue TypeError, SyntaxError, SystemCallError => e
37
+ raise(e)
38
+ end
39
+ end
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+ module Provision
5
+
6
+ require 'erubis'
7
+
8
+ class Shell
9
+
10
+ attr_reader :result
11
+ attr_accessor :machine_name, :shell_inline_data
12
+
13
+ def initialize(machine_name, shell_inline_data, result: nil)
14
+ @machine_name = machine_name
15
+ @shell_inline_data = shell_inline_data
16
+ @result = result
17
+ end
18
+
19
+ def build
20
+ b = binding
21
+ template_file = "#{TEMPLATE_PATH}/provision/shell_inline.erb"
22
+
23
+ begin
24
+
25
+ # Get machine name
26
+ machine_name = @machine_name
27
+
28
+ # Values for shell provision section
29
+ name = @shell_inline_data['name']
30
+ inline = @shell_inline_data['inline']
31
+ binary = @shell_inline_data['binary']
32
+ privileged = @shell_inline_data['privileged']
33
+
34
+ eruby = Erubis::Eruby.new(File.read(template_file))
35
+ @result = eruby.result b
36
+ rescue TypeError, SyntaxError, SystemCallError => e
37
+ raise(e)
38
+ end
39
+ end
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,12 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+ module Provision
5
+
6
+ autoload :Shell, 'vagrant-invade/builder/provision/shell.rb'
7
+ autoload :Puppet, 'vagrant-invade/builder/provision/puppet.rb'
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,48 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+ module SyncedFolder
5
+
6
+ require 'erubis'
7
+
8
+ class NFS
9
+
10
+ attr_reader :result
11
+ attr_accessor :machine_name, :nfs_data
12
+
13
+ def initialize(machine_name, nfs_data, result: nil)
14
+ @machine_name = machine_name
15
+ @nfs_data = nfs_data
16
+ @result = result
17
+ end
18
+
19
+ def build
20
+ b = binding
21
+ template_file = "#{TEMPLATE_PATH}/synced_folder/nfs.erb"
22
+
23
+ begin
24
+
25
+ # Get machine name
26
+ machine_name = @machine_name
27
+
28
+ # Values for provider sections
29
+ enabled = !@nfs_data['enabled'] # negated because Vagrant asks if it is disabled
30
+ uid = @nfs_data['uid']
31
+ gid = @nfs_data['gid']
32
+ source = @nfs_data['source']
33
+ path = @nfs_data['path']
34
+ mount_options = @nfs_data['mount_options']
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
+
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+ module SyncedFolder
5
+
6
+ require 'erubis'
7
+
8
+ class VirtualBox
9
+
10
+ attr_reader :result
11
+ attr_accessor :machine_name, :virtualbox_data
12
+
13
+ def initialize(machine_name, virtualbox_data, result: nil)
14
+ @machine_name = machine_name
15
+ @virtualbox_data = virtualbox_data
16
+ @result = result
17
+ end
18
+
19
+ def build
20
+ b = binding
21
+ template_file = "#{TEMPLATE_PATH}/synced_folder/virtualbox.erb"
22
+
23
+ begin
24
+
25
+ # Get machine name
26
+ machine_name = @machine_name
27
+
28
+ # Values for provider section
29
+ name = @virtualbox_data['name']
30
+ type = @virtualbox_data['type']
31
+ cpus = @virtualbox_data['cpus']
32
+ memory = @virtualbox_data['memory']
33
+ nicspeed = @virtualbox_data['nicspeed']
34
+ natdns = @virtualbox_data['natdns']
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
+
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,12 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+ module SyncedFolder
5
+
6
+ autoload :VirtualBox, 'vagrant-invade/builder/synced_folder/virtualbox.rb'
7
+ autoload :NFS, 'vagrant-invade/builder/synced_folder/nfs.rb'
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,35 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+
5
+ require 'erubis'
6
+
7
+ class Vagrantfile
8
+
9
+ attr_reader :result
10
+ attr_accessor :definitions
11
+
12
+ def initialize(definitions, result: nil)
13
+ @definitions = definitions
14
+ @result = result
15
+ end
16
+
17
+ def build
18
+ b = binding
19
+ template_file = "#{TEMPLATE_PATH}/v2.erb"
20
+
21
+ begin
22
+
23
+ # definitions for vagrantfile to build
24
+ definitions = @definitions
25
+
26
+ eruby = Erubis::Eruby.new(File.read(template_file))
27
+ @result = eruby.result b
28
+ rescue TypeError, SyntaxError, SystemCallError => e
29
+ raise(e)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,41 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+
5
+ require 'erubis'
6
+
7
+ class VM
8
+
9
+ attr_reader :result
10
+ attr_accessor :machine_name, :vm_data
11
+
12
+ def initialize(machine_name, vm_data, result: nil)
13
+ @machine_name = machine_name
14
+ @vm_data = vm_data
15
+ @result = result
16
+ end
17
+
18
+ def build
19
+ b = binding
20
+ template_file = "#{TEMPLATE_PATH}/vm/vm.erb"
21
+
22
+ begin
23
+
24
+ # Get machine name
25
+ machine_name = @machine_name
26
+
27
+ # Values for vm section
28
+ box = @vm_data['box']
29
+ url = @vm_data['url']
30
+ hostname = @vm_data['hostname']
31
+
32
+ eruby = Erubis::Eruby.new(File.read(template_file))
33
+ @result = eruby.result b
34
+ rescue TypeError, SyntaxError, SystemCallError => e
35
+ raise(e)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,17 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Builder
4
+
5
+ autoload :VM, 'vagrant-invade/builder/vm'
6
+ autoload :Network, 'vagrant-invade/builder/network'
7
+ autoload :Provider, 'vagrant-invade/builder/provider'
8
+ autoload :Provision, 'vagrant-invade/builder/provision'
9
+ autoload :SyncedFolder, 'vagrant-invade/builder/synced_folder'
10
+ autoload :Definition, 'vagrant-invade/builder/definition'
11
+ autoload :Vagrantfile, 'vagrant-invade/builder/vagrantfile'
12
+
13
+ TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'template')
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ require "vagrant/plugin/state_file"
2
+
3
+ module VagrantPlugins
4
+ module Invade
5
+ module Command
6
+ class Base < Vagrant.plugin('2', :command)
7
+ # This is a helper for executing an action sequence with the proper
8
+ # environment hash setup so that the plugin specific helpers are
9
+ # in.
10
+ #
11
+ # @param [Object] callable the Middleware callable
12
+ # @param [Hash] env Extra environment hash that is merged in.
13
+ def action(callable, env=nil)
14
+ @env.action_runner.run(callable, env)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,37 @@
1
+ require 'optparse'
2
+ require_relative 'base'
3
+
4
+ module VagrantPlugins
5
+ module Invade
6
+ module Command
7
+ class Build < Base
8
+ def execute
9
+ options = {}
10
+ opts = OptionParser.new do |o|
11
+ o.banner = "Usage: vagrant invade build [-f|--force] [-q|--quiet] [-h]"
12
+ o.separator ""
13
+ o.on("-f", "--force", "Overwrite existing Vagrantfile") do |f|
14
+ options[:force] = f
15
+ end
16
+ o.on("-q", "--quiet", "No verbose output.") do |q|
17
+ options[:quiet] = q
18
+ end
19
+ end
20
+
21
+ # Parse the options
22
+ argv = parse_options(opts)
23
+ return if !argv
24
+
25
+ # Validates InVaDE configuration
26
+ action(Action.build, {
27
+ :invade_command_force => options[:force],
28
+ :invade_command_quiet => options[:quiet]
29
+ })
30
+
31
+ # Success, exit status 0
32
+ 0
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,73 @@
1
+ require 'optparse'
2
+
3
+ module VagrantPlugins
4
+ module Invade
5
+ module Command
6
+ class Root < Vagrant.plugin('2', :command)
7
+ def self.synopsis
8
+ 'manages invade: validate, build, etc.'
9
+ end
10
+
11
+ def initialize(argv, env)
12
+ super
13
+
14
+ @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
15
+ @subcommands = Vagrant::Registry.new
16
+
17
+ # VALIDATE COMMAND ("vagrant invade validate")
18
+ @subcommands.register(:validate) do
19
+ require_relative "validate"
20
+ Validate
21
+ end
22
+
23
+ # BUILD COMMAND ("vagrant invade build")
24
+ @subcommands.register(:build) do
25
+ require_relative "build"
26
+ Build
27
+ end
28
+ end
29
+
30
+ def execute
31
+ if @main_args.include?("-h") || @main_args.include?("--help")
32
+ # Print the help for all the sub-commands.
33
+ return help
34
+ end
35
+
36
+ # If we reached this far then we must have a subcommand. If not,
37
+ # then we also just print the help and exit.
38
+ command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
39
+ return help if !command_class || !@sub_command
40
+ @logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
41
+
42
+ # Initialize and execute the command class
43
+ command_class.new(@sub_args, @env).execute
44
+ end
45
+
46
+ # Prints the help out for this command
47
+ def help
48
+ opts = OptionParser.new do |o|
49
+ o.banner = "Usage: vagrant invade <command> [<args>]"
50
+ o.separator ""
51
+ o.separator "Available subcommands:"
52
+
53
+ # Add the available subcommands as separators in order to print them
54
+ # out as well.
55
+ keys = []
56
+ @subcommands.each { |key, value| keys << key.to_s }
57
+
58
+ keys.sort.each do |key|
59
+ o.separator " #{key}"
60
+ end
61
+
62
+ o.separator ""
63
+ o.separator "For help on any individual command run `vagrant invade COMMAND -h`"
64
+ end
65
+
66
+ @env.ui.info(opts.help, prefix: false)
67
+ end
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+ end
@@ -0,0 +1,37 @@
1
+ require 'optparse'
2
+ require_relative 'base'
3
+
4
+ module VagrantPlugins
5
+ module Invade
6
+ module Command
7
+ class Validate < Base
8
+ def execute
9
+ options = {}
10
+ opts = OptionParser.new do |o|
11
+ o.banner = "Usage: vagrant invade validate [-f|--force] [-q|--quiet] [-h]"
12
+ o.separator ""
13
+ o.on("-f", "--force", "Overwrite existing Vagrantfile") do |f|
14
+ options[:force] = f
15
+ end
16
+ o.on("-q", "--quiet", "No verbose output.") do |q|
17
+ options[:quiet] = q
18
+ end
19
+ end
20
+
21
+ # Parse the options
22
+ argv = parse_options(opts)
23
+ return if !argv
24
+
25
+ # Validates InVaDE configuration
26
+ action(Action.validate, {
27
+ :invade_command_force => options[:force],
28
+ :invade_command_quiet => options[:quiet]
29
+ })
30
+
31
+ # Success, exit status 0
32
+ 0
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,25 @@
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
@@ -0,0 +1,38 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Generator
4
+ module Section
5
+
6
+ class Network
7
+
8
+ attr_accessor :machine_name, :type, :network_data
9
+
10
+ def initialize(machine_name, type, network_data)
11
+ @machine_name = machine_name
12
+ @type = type
13
+ @network_data = network_data
14
+ end
15
+
16
+ def generate
17
+
18
+ case @type
19
+ when 'private', 'private_network', 'privatenetwork', 'private-network'
20
+ network = Builder::Network::PrivateNetwork.new(@machine_name, @network_data)
21
+ when 'forwarded', 'forwarded_port', 'forwarded-port', 'forwardedport', 'port'
22
+ network = Builder::Network::ForwardedPort.new(@machine_name, @network_data)
23
+ when 'public', 'puplic_network', 'publicnetwork', 'public-network'
24
+ network = Builder::Network::PublicNetwork.new(@machine_name, @network_data)
25
+ else
26
+ raise StandardError, "Network type unknown or not set. Please check the network configuration."
27
+ end
28
+
29
+ network.build
30
+
31
+ network.result
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
File without changes
@@ -0,0 +1,36 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Generator
4
+ module Section
5
+
6
+ class Provider
7
+
8
+ attr_accessor :machine_name, :type, :provider_data
9
+
10
+ def initialize(machine_name, type, provider_data)
11
+ @machine_name = machine_name
12
+ @type = type
13
+ @provider_data = provider_data
14
+ end
15
+
16
+ def generate
17
+ case @type
18
+ when 'virtualbox'
19
+ provider = Builder::Provider::VirtualBox.new(@machine_name, @provider_data)
20
+ when 'vmware'
21
+ provider = Builder::Provider::VMware.new(@machine_name, @provider_data)
22
+ else
23
+ raise StandardError, "Provider unknown or not set. Please check the provider configuration."
24
+ end
25
+
26
+ provider.build
27
+
28
+ provider.result
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,38 @@
1
+ module VagrantPlugins
2
+ module Invade
3
+ module Generator
4
+ module Section
5
+
6
+ class Provision
7
+
8
+ attr_accessor :machine_name, :type, :provision_data
9
+
10
+ def initialize(machine_name, type, provision_data)
11
+ @machine_name = machine_name
12
+ @type = type
13
+ @provision_data = provision_data
14
+ end
15
+
16
+ def generate
17
+ case @type
18
+ when 'shell'
19
+ provision = Builder::Provision::Shell.new(@machine_name, @provision_data)
20
+ when 'shell_inline', 'inline', 'shellinline'
21
+ provision = Builder::Provision::ShellInline.new(@machine_name, @provision_data)
22
+ when 'puppet'
23
+ provision = Builder::Provision::Puppet.new(@machine_name, @provision_data)
24
+ else
25
+ raise StandardError, "Provisioner unknown or not set. Please check the provision configuration."
26
+ end
27
+
28
+ provision.build
29
+
30
+ provision.result
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end