epics-modules / iocStats

EPICS IOC Status and Control
Other
12 stars 40 forks source link

Fix issue where (potentially undefined) site-specific vars were being fetched #53

Closed simon-ess closed 1 year ago

simon-ess commented 1 year ago

In commit https://github.com/epics-modules/iocStats/commit/e320eb5888eaecda6c0977c7bca7739e40244752, several PVA-related env vars were added to the default iocAdmin database files. Unfortunately these are not defined by default in EPICS base and as such warnings were generated at IOC startup in that case.

The variables are defined in CONFIG_SITE_ENV and CONFIG_ENV; as such we just automatically parse those files for site-specific variables and add them accordingly.

simon-ess commented 1 year ago

@MarkRivers This should fix your issue. Can you please give it a quick test?

MarkRivers commented 1 year ago

@simon-ess that almost worked. The only problem is that the file siteEnvVars.db does not exist, so I got an error when starting the IOC. I think you need to create a dummy file with some comments saying what one might put in that file? Once I created a dummy file it seems to work fine.

simon-ess commented 1 year ago

@MarkRivers That's odd, I added a rule to generate that necessary substitution file, which should have generated the .db file.

MarkRivers commented 1 year ago

When I remove the siteEnvVars.db file I get this when I rebuild.

corvette:devIocStats/iocAdmin/Db>make clean
rm -rf O.linux-x86_64 O.vxWorks-ppc32 O.Common
corvette:devIocStats/iocAdmin/Db>make install.linux-x86_64
perl -CSD /corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../../..
perl -CSD /corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/makeMakefile.pl O.vxWorks-ppc32 ../../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
    T_A=linux-x86_64 install
make[1]: Entering directory `/home/epics/support/devIocStats-3-1-16/iocAdmin/Db/O.linux-x86_64'
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocAdminRTEMS.db -S../iocAdminRTEMS.substitutions  > iocAdminRTEMS.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocAdminSoft.db -S../iocAdminSoft.substitutions  > iocAdminSoft.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocAdminVxWorks.db -S../iocAdminVxWorks.substitutions  > iocAdminVxWorks.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocGeneralTime.db ../iocGeneralTime.template > iocGeneralTime.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocScanMonSum.db ../iocScanMonSum.template > iocScanMonSum.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocScanMon.db ../iocScanMon.template > iocScanMon.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocCluster.db ../iocCluster.template > iocCluster.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocEnvVar.db ../iocEnvVar.template > iocEnvVar.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocRTEMSOnly.db ../iocRTEMSOnly.template > iocRTEMSOnly.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocVxWorksOnly.db ../iocVxWorksOnly.template > iocVxWorksOnly.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocRTOS.db ../iocRTOS.template > iocRTOS.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/ioc.db ../ioc.template > ioc.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/iocAdminScanMon.db -S../iocAdminScanMon.substitutions  > iocAdminScanMon.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/epicsEnvVars.db -S../epicsEnvVars.substitutions  > epicsEnvVars.db.d
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi" -D  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ../O.Common/siteEnvVars.db -S../O.Common/siteEnvVars.substitutions  > siteEnvVars.db.d
make[1]: Leaving directory `/home/epics/support/devIocStats-3-1-16/iocAdmin/Db/O.linux-x86_64'
make[1]: Entering directory `/home/epics/support/devIocStats-3-1-16/iocAdmin/Db/O.linux-x86_64'
Inflating database from ../O.Common/siteEnvVars.substitutions
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o siteEnvVars.db -S../O.Common/siteEnvVars.substitutions
Inflating database from ../epicsEnvVars.substitutions
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o epicsEnvVars.db -S../epicsEnvVars.substitutions
Inflating database from ../iocAdminScanMon.substitutions
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocAdminScanMon.db -S../iocAdminScanMon.substitutions
Inflating database from ../ioc.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o ioc.db ../ioc.template
Inflating database from ../iocRTOS.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocRTOS.db ../iocRTOS.template
Inflating database from ../iocVxWorksOnly.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocVxWorksOnly.db ../iocVxWorksOnly.template
Inflating database from ../iocRTEMSOnly.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocRTEMSOnly.db ../iocRTEMSOnly.template
Inflating database from ../iocEnvVar.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocEnvVar.db ../iocEnvVar.template
Inflating database from ../iocCluster.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocCluster.db ../iocCluster.template
Inflating database from ../iocScanMon.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocScanMon.db ../iocScanMon.template
Inflating database from ../iocScanMonSum.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocScanMonSum.db ../iocScanMonSum.template
Inflating database from ../iocGeneralTime.template
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocGeneralTime.db ../iocGeneralTime.template
Installing created db file ../../../db/iocAdminScanMon.db
Installing created db file ../../../db/epicsEnvVars.db
Inflating database from ../iocAdminVxWorks.substitutions
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocAdminVxWorks.db -S../iocAdminVxWorks.substitutions
Installing created db file ../../../db/siteEnvVars.db
Inflating database from ../iocAdminSoft.substitutions
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocAdminSoft.db -S../iocAdminSoft.substitutions
Inflating database from ../iocAdminRTEMS.substitutions
"/corvette/usr/local/epics/base-7.0.7/bin/linux-x86_64/msi"  -M V4_ENVTYPE=epics  -I. -I.. -I../O.Common -I../../../db -I/corvette/usr/local/epics/base-7.0.7/db -o iocAdminRTEMS.db -S../iocAdminRTEMS.substitutions
Installing created db file ../../../db/ioc.db
Installing created db file ../../../db/iocRTOS.db
Installing created db file ../../../db/iocVxWorksOnly.db
Installing created db file ../../../db/iocRTEMSOnly.db
Installing created db file ../../../db/iocEnvVar.db
Installing created db file ../../../db/iocCluster.db
Installing created db file ../../../db/iocScanMon.db
Installing created db file ../../../db/iocScanMonSum.db
Installing created db file ../../../db/iocGeneralTime.db
Installing created db file ../../../db/iocAdminVxWorks.db
Installing created db file ../../../db/iocAdminSoft.db
Installing created db file ../../../db/iocAdminRTEMS.db
make[1]: Leaving directory `/home/epics/support/devIocStats-3-1-16/iocAdmin/Db/O.linux-x86_64'

Perhaps the problem is a missing setEnvVars.substitutions?

MarkRivers commented 1 year ago

Sorry, I did not notice that the above actually did install siteEnvVars.db. I don't know why it could not find the file the first time. Maybe I did not rebuild correctly.

simon-ess commented 1 year ago

Maybe I will add a printed out message when it expands it in order to make it more clear in the log...

ericonr commented 1 year ago

I believe this fixes the regression caused by 7729abbb3f4210ca28a23f718e63ceaba5fee0f6, which happened after https://github.com/epics-modules/iocStats/pull/49 , since it added the timezone records back to the expansions for Soft IOCs.