Skip to content

Commit

Permalink
Merge 878cbab into 035addb
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Jan 16, 2020
2 parents 035addb + 878cbab commit 13a3e66
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 25 deletions.
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jan 15 22:07:30 CET 2020 - aschnell@suse.com

- treat partitions with BitLocker as Windows (related to
bsc#1159318)
- 4.2.72

-------------------------------------------------------------------
Tue Jan 14 20:52:30 CET 2020 - aschnell@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.2.71
Version: 4.2.72
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
6 changes: 5 additions & 1 deletion src/lib/y2storage/filesystems/base.rb
@@ -1,4 +1,4 @@
# Copyright (c) [2017-2019] SUSE LLC
# Copyright (c) [2017-2020] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -162,6 +162,10 @@ def windows_suitable?
def windows_system?
return false unless windows_suitable?

# For BitLocker assume it is Windows without looking further
# at the file system (it cannot be mounted anyway).
return true if type.to_sym == :bitlocker

!!fs_attribute(:windows)
end

Expand Down
4 changes: 2 additions & 2 deletions src/lib/y2storage/filesystems/type.rb
@@ -1,4 +1,4 @@
# Copyright (c) [2017-2019] SUSE LLC
# Copyright (c) [2017-2020] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -170,7 +170,7 @@ class Type
# filesystems that can embed grub
GRUB_FILESYSTEMS = [:ext2, :ext3, :ext4, :btrfs]

WINDOWS_FILESYSTEMS = [:ntfs, :vfat]
WINDOWS_FILESYSTEMS = [:ntfs, :vfat, :bitlocker]

private_constant :PROPERTIES, :ROOT_FILESYSTEMS, :HOME_FILESYSTEMS,
:COMMON_FSTAB_OPTIONS, :EXT_FSTAB_OPTIONS, :LEGACY_ROOT_FILESYSTEMS,
Expand Down
47 changes: 30 additions & 17 deletions test/y2storage/filesystems/base_test.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env rspec
# Copyright (c) [2017-2019] SUSE LLC
# Copyright (c) [2017-2020] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -115,30 +115,30 @@
it "returns false" do
expect(subject.windows_suitable?).to eq(false)
end
end

context "when the type is suitable for Windows" do
let(:type_suitable) { true }
context "when the type is suitable for Windows" do
let(:type_suitable) { true }

before do
allow(subject).to receive(:blk_devices).and_return([blk_device])
before do
allow(subject).to receive(:blk_devices).and_return([blk_device])

allow(blk_device).to receive(:windows_suitable?).and_return(device_suitable)
end
allow(blk_device).to receive(:windows_suitable?).and_return(device_suitable)
end

context "but its device is not suitable for Windows" do
let(:device_suitable) { false }
context "but its device is not suitable for Windows" do
let(:device_suitable) { false }

it "returns false" do
expect(subject.windows_suitable?).to eq(false)
end
it "returns false" do
expect(subject.windows_suitable?).to eq(false)
end
end

context "and its device is suitable for Windows" do
let(:device_suitable) { true }
context "and its device is suitable for Windows" do
let(:device_suitable) { true }

it "returns true" do
expect(subject.windows_suitable?).to eq(true)
end
it "returns true" do
expect(subject.windows_suitable?).to eq(true)
end
end
end
Expand Down Expand Up @@ -196,6 +196,19 @@
end
end
end

context "when the filesystem is BitLocker" do
before do
allow(subject).to receive(:type).and_return(type)
end

let(:suitable) { true }
let(:type) { instance_double(Y2Storage::Filesystems::Type, to_sym: :bitlocker) }

it "returns true" do
expect(subject.windows_system?).to eq(true)
end
end
end

context "#linux_system?" do
Expand Down
13 changes: 9 additions & 4 deletions test/y2storage/filesystems/type_test.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env rspec
# Copyright (c) [2017-2019] SUSE LLC
# Copyright (c) [2017-2020] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -260,8 +260,9 @@
expect(described_class.windows_filesystems).to be_a(Array)
end

it "only includes ntfs and vfat" do
expect(described_class.windows_filesystems.map(&:to_sym)).to contain_exactly(:ntfs, :vfat)
it "only includes ntfs, vfat and bitlocker" do
expect(described_class.windows_filesystems.map(&:to_sym)).to contain_exactly(:ntfs, :vfat,
:bitlocker)
end
end

Expand All @@ -274,8 +275,12 @@
expect(described_class::VFAT.windows_ok?).to eq(true)
end

it "returns true for bitlocker" do
expect(described_class::BITLOCKER.windows_ok?).to eq(true)
end

it "returns false otherwise" do
types = described_class.all.reject { |t| t.is?(:ntfs, :vfat) }
types = described_class.all.reject { |t| t.is?(:ntfs, :vfat, :bitlocker) }

expect(types.map(&:windows_ok?)).to all(be(false))
end
Expand Down

0 comments on commit 13a3e66

Please sign in to comment.