Skip to content

Commit

Permalink
Validate TPM device
Browse files Browse the repository at this point in the history
Signed-off-by: Liran Rotenberg <[email protected]>
  • Loading branch information
liranr23 committed Nov 27, 2023
1 parent c5137ff commit 79ac6f7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions validation/policies/io/konveyor/forklift/ovirt/tpm.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.konveyor.forklift.ovirt

default has_tpm_enabled = false

has_tpm_enabled = value {
value := input.tpmEnabled
}

concerns[flag] {
has_tpm_enabled
flag := {
"category": "Warning",
"label": "VM configured with TPM device",
"assessment": "The VM is configured with TPM device. TPM data will be loss during the migration."
}
}
17 changes: 17 additions & 0 deletions validation/policies/io/konveyor/forklift/ovirt/tpm_test.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.konveyor.forklift.ovirt

test_without_tpm_enabled {
mock_vm := { "name": "test",
"tpmEnabled": false
}
results = concerns with input as mock_vm
count(results) == 0
}

test_with_tpm_enabled {
mock_vm := { "name": "test",
"tpmEnabled": true
}
results = concerns with input as mock_vm
count(results) == 1
}

0 comments on commit 79ac6f7

Please sign in to comment.