Skip to content

Commit

Permalink
Merge 42b8c68 into cb106f8
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Sep 4, 2018
2 parents cb106f8 + 42b8c68 commit c828ae8
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 4 deletions.
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Sep 4 11:45:19 UTC 2018 - jreidinger@suse.com

- Add asterisk to mount points that is not active and also write it
to description (FATE#318196)
- 4.1.13

-------------------------------------------------------------------
Thu Aug 30 07:41:35 UTC 2018 - jlopez@suse.com

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

Name: yast2-storage-ng
Version: 4.1.12
Version: 4.1.13
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
16 changes: 15 additions & 1 deletion src/lib/y2partitioner/widgets/blk_device_attributes.rb
Expand Up @@ -168,7 +168,21 @@ def device_filesystem
# @return [String]
def device_filesystem_mount_point
# TRANSLATORS: Mount point information, where %s is replaced by a mount point
format(_("Mount Point: %s"), blk_device.filesystem_mountpoint || "")
res = format(_("Mount Point: %s"), blk_device.filesystem_mountpoint || "")
# TRANSLATORS: note appended to mount point if mount point is not now mounted
res += _(" (not mounted)") if mount_point_inactive?

res
end

def mount_point_inactive?
fs = blk_device.blk_filesystem
return false unless fs

mp = fs.mount_point
return false unless mp

!mp.active?
end

# Information about the filesystem label
Expand Down
7 changes: 6 additions & 1 deletion src/lib/y2partitioner/widgets/blk_devices_table.rb
Expand Up @@ -200,7 +200,12 @@ def filesystem_label_value(device)

def mount_point_value(device)
fs = filesystem(device)
fs.nil? ? "" : fs.mount_path
return "" if fs.nil?

res = fs.mount_path
res += " *" if fs.mount_point && !fs.mount_point.active?

res
end

def start_value(device)
Expand Down
12 changes: 12 additions & 0 deletions test/y2partitioner/widgets/configurable_blk_devices_table_test.rb
Expand Up @@ -27,10 +27,22 @@
end

describe "#items" do
let(:devices) { device_graph.partitions }

it "returns array of arrays" do
expect(subject.items).to be_a(::Array)
expect(subject.items.first).to be_a(::Array)
end

it "adds asterisk to mount point when not mounted" do
allow_any_instance_of(Y2Storage::MountPoint).to receive(:active?).and_return(false)

items = subject.items
puts items.inspect
expect(subject.items.any? { |i| i.any? { |inner| inner =~ / */ } }).to(
eq(true), "Missing items with asterisk: #{items.inspect}"
)
end
end

describe "#init" do
Expand Down
17 changes: 16 additions & 1 deletion test/y2partitioner/widgets/partition_description_test.rb
Expand Up @@ -30,7 +30,7 @@

let(:current_graph) { Y2Partitioner::DeviceGraphs.instance.current }

let(:partition) { current_graph.partitions.first }
let(:partition) { current_graph.partitions.find { |p| p.name == "/dev/sdb2" } }

subject { described_class.new(partition) }

Expand All @@ -41,4 +41,19 @@
expect { subject.init }.to_not raise_error
end
end

describe "#value" do
it "contains (not mounted) beside mount point if it is not mounted" do
allow(partition).to receive(:blk_filesystem)
.and_return(double(
type: Y2Storage::Filesystems::Type::EXT4,
mount_point: double(active?: false),
mount_path: "/"
).as_null_object)

expect(subject).to receive(:value=).with(/\(not mounted\)/)

subject.init
end
end
end

0 comments on commit c828ae8

Please sign in to comment.