Skip to content

Commit

Permalink
AutoYaST exports unknown encryption methods as 'luks1'
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Oct 30, 2019
1 parent 7495240 commit f927909
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/y2storage/autoinst_profile/partition_section.rb
Expand Up @@ -365,11 +365,14 @@ def init_lv_fields(lv)
@btrfs_name = name_for_btrfs(lv.filesystem)
end

DEFAULT_ENCRYPTION_METHOD = Y2Storage::EncryptionMethod.find(:luks1)
private_constant :DEFAULT_ENCRYPTION_METHOD

def init_encryption_fields(partition)
return unless partition.encrypted?

method = partition.encryption.method || DEFAULT_ENCRYPTION_METHOD
@loop_fs = true
method = partition.encryption.method
@crypt_method = method.id
@crypt_key = CRYPT_KEY_VALUE if method.password_required?
end
Expand Down
21 changes: 21 additions & 0 deletions test/y2storage/autoinst_profile/partition_section_test.rb
Expand Up @@ -604,6 +604,27 @@ def section_for(name)
end
end

context "and the encryption method is unknown" do
before do
allow_any_instance_of(Y2Storage::Encryption).to receive(:method).and_return(nil)
end

it "initializes #crypt_method to 'luks1'" do
section = section_for("sdf7")
expect(section.crypt_method).to eq(:luks1)
end

it "initializes #crypt_key to a generic string" do
expect(section_for("sdf7").crypt_key).to eq("ENTER KEY HERE")
end

it "initializes #loop_fs to true" do
section = section_for("sdf7")
expect(section.loop_fs).to eq true
end

end

it "initializes #loop_fs to true" do
section = section_for("sdf7")
expect(section.loop_fs).to eq true
Expand Down

0 comments on commit f927909

Please sign in to comment.