Skip to content

Commit

Permalink
Check the root filesystem instead of the destdir
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 9, 2018
1 parent 3410e27 commit 023b87d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/lib/network/clients/save_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@ def adjust_for_network_disks(file)
# storage-ng
# Check if installation is targeted to a remote destination.
devicegraph = Y2Storage::StorageManager.instance.staging
is_disk_in_network = devicegraph.filesystem_in_network?(
Installation.destdir
)
is_disk_in_network = devicegraph.filesystem_in_network?("/")

if !is_disk_in_network
log.info("Directory \"#{Installation.destdir}\" is not on a network based device")
log.info("Root filesystem is not on a network based device")
return
end

log.info("Directory \"#{Installation.destdir}\" is on a network based device")
log.info("Root filesystem is on a network based device")

# tune ifcfg file for remote filesystem
SCR.Execute(
Expand Down
6 changes: 3 additions & 3 deletions test/save_network_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
Y2Storage::StorageManager.create_test_instance

staging = Y2Storage::StorageManager.instance.staging
allow(staging).to receive(:filesystem_in_network?).and_return(in_network)
allow(staging).to receive(:filesystem_in_network?).with("/").and_return(in_network)
allow(subject).to receive(:save_network)
# Mainly for import
subject.main
end

context "when installation directory is in a network device" do
context "when the root filesystem of the target system is in a network device" do
let(:in_network) { true }

it "tunes ifcfg file for remote filesystem" do
Expand All @@ -38,7 +38,7 @@
end
end

context "when installation directory is in a local device" do
context "when the root filesystem of the target system is in a local device" do
let(:in_network) { false }

it "does not touch any configuration file" do
Expand Down

0 comments on commit 023b87d

Please sign in to comment.