Forum Discussion

mnagel's avatar
Icon for Professor rankProfessor
5 years ago

need method to set properties in groovy code

I am trying to get an eventsource that reports when the firmware version has changed (this is something other tools "just do").  To do this, my "applies to" for auto.firmware_version works great, but then the script needs to use this logic:

if auto.firmware_version != auto.firmware_version.prev then
  generate event that says "firmware version has changed from old to new"
  set auto.firmware_version.prev to auto.firmware_version

I imagine I could use the API for the "set" operation, but using the API in logicmodules always makes me cringe due to lack of library support.  I detest maintaining the same code across many different modules as it is error-prone.  If there could be a hostProps.set method, that would be very helpful.  I understand this could be dangerous, so if it must have the same restrictions as propertysources, I can live with that.

20 Replies