What parameters are passed to a ruby expression when checking a condition in a compliance policy?


#1

I’m implementing a compliance policy where I check the names of VM disks.

I create a condition policy where the check expression is: “FIND VM and Instance.Hardware.Disks : Device Name RUBY CHECK ALL Present = ‘true’”.

I’d like to know how the “device_name” is passed to the ruby expression I’m writing.

I’d like to known too if I can retrieve the vm from $evm.root at that point.

To make things more clear, the naming policy i want to check is something like: "every disks of a VM are named according to the pattern: _


#2

Sorry, some mistyping of my own.

To make things more clear, the naming policy i want to check is something like: "every disks of a VM are named according to the pattern: vm-name_some-suffix


#3

Just to mention … some monthes later !

In the ruby code, a variable named ‘context’ is set with the value to test.

It was not useful for me, as I wanted to implement a filter that checks that the value of a field depends in some way of the value of another field of the current resource… but $evm is not accessible from this ruby code, so that what can be done (simply ) is very limited.