Written by

Senior Cloud Architect at InterSystems
MOD
Question Eduard Lebedyuk · Dec 4, 2019

How to check that business host is in production?

For simplicity sake let's say that we talk about active production.

I need to know if the business host is added to the production or not.

Currently I have:

do ##class(Ens.Director).IsItemEnabled("HostName", .sc)
set defined = $$$ISOK(sc)

Which looks like a workaround.

Comments

Marc Mundt · Dec 4, 2019

How about:

&sql(select count(*) into :tDefined from ENS_Config.Item where Name=:tHostName and Production=:tProductionName)
0
Marc Mundt  Dec 4, 2019 to Marc Mundt

Or something uglier...

set tDefined=$ISOBJECT(##class(Ens.Config.Production).%OpenId(##class(Ens.Director).GetActiveProductionName()).FindItemByConfigName(tHostName))
0
Eduard Lebedyuk  Dec 4, 2019 to Marc Mundt

Thanks, Marc.

Found useful index:

write ##class(Ens.Config.Item).NameExists(##class(Ens.Director).GetActiveProductionName(),"HostName")
0