Add validate command for validating Vagrantfile
This commit is contained in:
parent
fbad6c370a
commit
cbda9f0906
|
@ -0,0 +1,31 @@
|
|||
require 'optparse'
|
||||
|
||||
module VagrantPlugins
|
||||
module CommandValidate
|
||||
class Command < Vagrant.plugin("2", :command)
|
||||
def self.synopsis
|
||||
"validates the Vagrantfile"
|
||||
end
|
||||
|
||||
def execute
|
||||
opts = OptionParser.new do |o|
|
||||
o.banner = "Usage: vagrant validate"
|
||||
end
|
||||
|
||||
# Parse the options
|
||||
argv = parse_options(opts)
|
||||
return if !argv
|
||||
|
||||
# Validate the configuration
|
||||
@env.machine(@env.machine_names.first, @env.default_provider).action_raw(
|
||||
:config_validate,
|
||||
Vagrant::Action::Builtin::ConfigValidate)
|
||||
|
||||
@env.ui.info(I18n.t("vagrant.commands.validate.success"))
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
require "vagrant"
|
||||
|
||||
module VagrantPlugins
|
||||
module CommandValidate
|
||||
class Plugin < Vagrant.plugin("2")
|
||||
name "validate command"
|
||||
description <<-DESC
|
||||
The `validate` command validates the Vagrantfile.
|
||||
DESC
|
||||
|
||||
command("validate") do
|
||||
require File.expand_path("../command", __FILE__)
|
||||
Command
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1726,6 +1726,9 @@ en:
|
|||
up:
|
||||
upping: |-
|
||||
Bringing machine '%{name}' up with '%{provider}' provider...
|
||||
validate:
|
||||
success: |-
|
||||
Vagrantfile validated successfully.
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Translations for Vagrant middleware actions
|
||||
|
|
Loading…
Reference in New Issue