Merge pull request #11184 from briancain/fixup/cleanup-cloud-publish-cmd
Fixes #11137: Fixup how cloud publish handles its arguments
This commit is contained in:
commit
403fece5ac
|
@ -55,7 +55,7 @@ module VagrantPlugins
|
||||||
argv = parse_options(opts)
|
argv = parse_options(opts)
|
||||||
return if !argv
|
return if !argv
|
||||||
|
|
||||||
if argv.empty? || argv.length > 4 || argv.length < 3
|
if argv.empty? || argv.length > 4 || argv.length < 3 || (argv.length == 3 && !options[:url])
|
||||||
raise Vagrant::Errors::CLIInvalidUsage,
|
raise Vagrant::Errors::CLIInvalidUsage,
|
||||||
help: opts.help.chomp
|
help: opts.help.chomp
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,6 +52,15 @@ describe VagrantPlugins::CloudCommand::Command::Publish do
|
||||||
let(:argv) { ["vagrant/box", "1.0.0", "virtualbox"] }
|
let(:argv) { ["vagrant/box", "1.0.0", "virtualbox"] }
|
||||||
|
|
||||||
it "shows help" do
|
it "shows help" do
|
||||||
|
expect { subject.execute }.
|
||||||
|
to raise_error(Vagrant::Errors::CLIInvalidUsage)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "missing box file" do
|
||||||
|
let(:argv) { ["vagrant/box", "1.0.0", "virtualbox", "/notreal/file.box"] }
|
||||||
|
|
||||||
|
it "raises an exception" do
|
||||||
allow(File).to receive(:file?).and_return(false)
|
allow(File).to receive(:file?).and_return(false)
|
||||||
expect { subject.execute }.
|
expect { subject.execute }.
|
||||||
to raise_error(Vagrant::Errors::BoxFileNotExist)
|
to raise_error(Vagrant::Errors::BoxFileNotExist)
|
||||||
|
|
Loading…
Reference in New Issue