lib/vagrant-invade/action/validate.rb in vagrant-invade-0.5.4 vs lib/vagrant-invade/action/validate.rb in vagrant-invade-0.5.5

- old
+ new

@@ -25,29 +25,30 @@ # INVADE config['invade'] = Validator::Invade.new(config['invade']).validate # Hostmanager Plugin unless config['hostmanager'] == nil + @env[:ui].info("\n[Invade]: Validating HOSTMANAGER part ...") unless quiet config['hostmanager'] = Validator::HostManager.new( config['hostmanager']).validate end # Iterate over each machine configuration machines = config['machines'] unless machines == nil - machines.each_with_index do |(machine, sections), index| + machines.each_with_index do |(machine, part), index| # VM - unless sections['vm'] == nil - @env[:ui].info("\n[Invade] #{machine.upcase}: Validating VM section...") unless quiet - sections['vm'] = Validator::VM.new(env, sections['vm']).validate + unless part['vm'] == nil + @env[:ui].info("\n[Invade][#{machine.upcase}]: Validating VM part...") unless quiet + part['vm'] = Validator::VM.new(env, part['vm']).validate end # NETWORK - unless sections['network'] == nil - @env[:ui].info("\n[Invade] #{machine.upcase}: Validating NETWORK section...") unless quiet + unless part['network'] == nil + @env[:ui].info("\n[Invade][#{machine.upcase}]: Validating NETWORK section...") unless quiet - sections['network'].each do |type, network| + part['network'].each do |type, network| @env[:ui].info("\tNetwork: #{type}") unless quiet case type when 'private', 'private_network', 'privatenetwork', 'private-network' network = Validator::Network::PrivateNetwork.new(env, network).validate when 'forwarded', 'forwarded_port', 'forwarded-port', 'forwardedport', 'port' @@ -59,14 +60,14 @@ end end end # PROVIDER - unless sections['provider'] == nil - @env[:ui].info("\n[Invade] #{machine.upcase}: Validating PROVIDER section...") unless quiet + unless part['provider'] == nil + @env[:ui].info("\n[Invade][#{machine.upcase}]: Validating PROVIDER section...") unless quiet - sections['provider'].each do |type, provider| + part['provider'].each do |type, provider| @env[:ui].info(" Provider: #{type}") unless quiet case type when 'virtualbox' provider = Validator::Provider::VirtualBox.new(env, provider).validate when 'vmware' @@ -76,14 +77,14 @@ end end end # SYNCED FOLDER - unless sections['synced_folder'] == nil - @env[:ui].info("\n[Invade] #{machine.upcase}: Validating SYNCED FOLDER section...") unless quiet + unless part['synced_folder'] == nil + @env[:ui].info("\n[Invade][#{machine.upcase}]: Validating SYNCED FOLDER section...") unless quiet - sections['synced_folder'].each do |name, sf| + part['synced_folder'].each do |name, sf| @env[:ui].info(" Synced Folder: #{name}") unless quiet case sf['type'] when 'nfs' sf = Validator::SyncedFolder::NFS.new(env, sf).validate when 'vb' @@ -93,14 +94,14 @@ end end end # PROVISION - unless sections['provision'] == nil - @env[:ui].info("\n[Invade] #{machine.upcase}: Validating PROVISION section...") unless quiet + unless part['provision'] == nil + @env[:ui].info("\n[Invade][#{machine.upcase}]: Validating PROVISION section...") unless quiet - sections['provision'].each do |name, provision| + part['provision'].each do |name, provision| @env[:ui].info(" Provision: #{name}") unless quiet case provision['type'] when 'shell' provision = Validator::Provision::Shell.new(env, provision).validate when 'shellinline', 'shell-inline' @@ -114,21 +115,21 @@ end end end # SSH - unless sections['ssh'] == nil - @env[:ui].info("\n[Invade] #{machine.upcase}: Validating SSH section...") unless quiet + unless part['ssh'] == nil + @env[:ui].info("\n[Invade][#{machine.upcase}]: Validating SSH section...") unless quiet - sections['ssh'] = Validator::SSH.new(env, sections['ssh']).validate + part['ssh'] = Validator::SSH.new(env, part['ssh']).validate end # PLUGINS - unless sections['plugin'] == nil - @env[:ui].info("\n[Invade] #{machine.upcase}: Validating PLUGIN section...") unless quiet + unless part['plugin'] == nil + @env[:ui].info("\n[Invade][#{machine.upcase}]: Validating PLUGIN section...") unless quiet - sections['plugin'].each do |type, plugin| + part['plugin'].each do |type, plugin| @env[:ui].info(" Plugin: #{type}") unless quiet case type when 'hostmanager' plugin = Validator::Plugin::HostManager.new(env, plugin).validate when 'winnfsd' @@ -146,10 +147,10 @@ if Validator.get_validation_errors > 0 @env[:ui].warn('[Invade] Configuration has validation errors. Run \'vagrant invade validate\' to see details.') exit else - @env[:ui].success('[Invade] Configuration validated successfully.') + @env[:ui].success("\n[Invade] Configuration validated successfully.") end @app.call(env) end