Skip to content

Commit

Permalink
Merge pull request #485 from yast/persistent_mount
Browse files Browse the repository at this point in the history
Added Mountable#persistent? (needed for bsc#1073696)
  • Loading branch information
ancorgs committed Jan 9, 2018
2 parents a8fa85e + 7186ccd commit 3fcd97e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jan 9 15:36:15 UTC 2018 - lslezak@suse.cz

- Added Mountable#persistent? (needed for bsc#1073696)
- 4.0.68

-------------------------------------------------------------------
Mon Jan 8 22:16:30 UTC 2018 - ancor@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 4.0.67
Version: 4.0.68
Release: 0
BuildArch: noarch

Expand Down
10 changes: 10 additions & 0 deletions src/lib/y2storage/mountable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ def mountpoint=(path)

alias_method :mount_point=, :mountpoint=

# Is the mount persistent?
#
# @return [Boolean] true if the mount point is saved to /etc/fstab
# (and will be mounted at boot again), false otherwise
def persistent?
# TODO: this implementation needs to be adapted after adding the Y2Storage
# wrapper for Storage::MountPoint
to_storage_value.has_mount_point && to_storage_value.mount_point.in_etc_fstab?
end

# Sets the options to use in /etc/fstab for a newly created filesystem.
#
# @param new_options [Array<String>]
Expand Down
18 changes: 18 additions & 0 deletions test/y2storage/filesystems/blk_filesystem_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@
end
end

describe "#persistent?" do
context "for not mounted filesystem" do
let(:dev_name) { "/dev/sdb3" }

it "returns false" do
expect(filesystem.persistent?).to eq false
end

context "after adding a mount point" do
before { filesystem.mount_point = "/mnt/test" }

it "returns true" do
expect(filesystem.persistent?).to eq true
end
end
end
end

describe "#in_network?" do
let(:disk) { Y2Storage::BlkDevice.find_by_name(fake_devicegraph, "/dev/sda") }

Expand Down

0 comments on commit 3fcd97e

Please sign in to comment.