core: no active machines if there is no vagrant env
This commit is contained in:
parent
16a329214c
commit
d4087db7c5
|
@ -6,6 +6,8 @@ IMPROVEMENTS:
|
|||
|
||||
BUG FIXES:
|
||||
|
||||
- core: Global control works from directories that don't have a
|
||||
Vagrantfile.
|
||||
- commands/package: `--base` works without crashing for VirtualBox.
|
||||
- guests/redhat: Fix networking issues with CentOS. [GH-3649]
|
||||
|
||||
|
|
|
@ -191,6 +191,9 @@ module Vagrant
|
|||
#
|
||||
# @return [Array<String, Symbol>]
|
||||
def active_machines
|
||||
# We have no active machines if we have no data path
|
||||
return [] if !@local_data_path
|
||||
|
||||
machine_folder = @local_data_path.join("machines")
|
||||
|
||||
# If the machine folder is not a directory then we just return
|
||||
|
|
|
@ -602,6 +602,13 @@ VF
|
|||
end
|
||||
|
||||
describe "active machines" do
|
||||
it "should be empty if there is no root path" do
|
||||
Dir.mktmpdir do |temp_dir|
|
||||
instance = described_class.new(cwd: temp_dir)
|
||||
expect(instance.active_machines).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it "should be empty if the machines folder doesn't exist" do
|
||||
folder = instance.local_data_path.join("machines")
|
||||
expect(folder).not_to be_exist
|
||||
|
|
Loading…
Reference in New Issue