Skip to content

Commit ddab4f3

Browse files
authored
Merge pull request #110 from tynanford/boolean_config
Update alias, recordType, recordDesc, and iocConnectionInfo settings to be booleans
2 parents 7a627d1 + a1becb5 commit ddab4f3

File tree

5 files changed

+30
-29
lines changed

5 files changed

+30
-29
lines changed

server/demo.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@
6969
#infotags = archive foo bar blah
7070

7171
# Uncomment line below to turn off the feature to add CA/PVA port info for name server to channelfinder
72-
#iocConnectionInfo = off
72+
#iocConnectionInfo = False
7373

7474
# Uncomment line below to turn on the feature to add alias records to channelfinder
75-
#alias = on
75+
#alias = True
7676

7777
# Uncomment line below to turn on the feature to add EPICS record type to channelfinder
78-
#recordType = on
78+
#recordType = True
7979

8080
# Uncomment line below to turn on the feature to add description field to channelfinder
81-
#recordDesc = on
81+
#recordDesc = True
8282

8383
# The size limit for finding channels (ie the value of the '~size' query parameter)
8484
# If not specified then the fallback is the server default

server/docker/config/cf1.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ infotags = archive
2222
#environment_vars=ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory
2323

2424
# Turn on optional alias and recordType properties
25-
alias = on
26-
recordType = on
27-
recordDesc = on
25+
alias = True
26+
recordType = True
27+
recordDesc = True
2828

2929
# Mark all channels as 'Inactive' when processor is started (default: True)
3030
cleanOnStart = True

server/docker/config/cf2.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ loglevel=DEBUG
2020
# and defining the corresponding PropertyName
2121
#environment_vars=ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory
2222
# Turn on optional alias and recordType properties
23-
alias = on
24-
recordType = on
25-
recordDesc = on
23+
alias = True
24+
recordType = True
25+
recordDesc = True
2626

2727
# Mark all channels as 'Inactive' when processor is stopped (default: True)
2828
#cleanOnStop = True

server/recceiver/cfstore.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def _startServiceWithLock(self):
8888
RECCEIVERID_KEY,
8989
}
9090

91-
if self.conf.get("alias"):
91+
if self.conf.getboolean("alias"):
9292
required_properties.add("alias")
93-
if self.conf.get("recordType"):
93+
if self.conf.getboolean("recordType"):
9494
required_properties.add("recordType")
9595
env_vars_setting = self.conf.get("environment_vars")
9696
self.env_vars = {}
@@ -101,7 +101,8 @@ def _startServiceWithLock(self):
101101
required_properties.add(cf_prop_name)
102102
# Standard property names for CA/PVA name server connections. These are
103103
# environment variables from reccaster so take advantage of env_vars
104-
if self.conf.get("iocConnectionInfo"):
104+
# iocConnectionInfo enabled by default
105+
if self.conf.getboolean("iocConnectionInfo", True):
105106
self.env_vars["RSRV_SERVER_PORT"] = "caPort"
106107
self.env_vars["PVAS_SERVER_PORT"] = "pvaPort"
107108
required_properties.add("caPort")
@@ -111,7 +112,7 @@ def _startServiceWithLock(self):
111112
record_property_names_list = [s.strip(", ") for s in infotags_whitelist.split()]
112113
else:
113114
record_property_names_list = []
114-
if self.conf.get("recordDesc"):
115+
if self.conf.getboolean("recordDesc"):
115116
record_property_names_list.append("recordDesc")
116117
# Are any required properties not already present on CF?
117118
properties = required_properties - set(cf_properties)
@@ -219,7 +220,7 @@ def _commitWithThread(self, transaction):
219220
recordInfo = {}
220221
for record_id, (record_name, record_type) in transaction.records_to_add.items():
221222
recordInfo[record_id] = {"pvName": record_name}
222-
if self.conf.get("recordType"):
223+
if self.conf.getboolean("recordType"):
223224
recordInfo[record_id]["recordType"] = record_type
224225
for record_id, (record_infos_to_add) in transaction.record_infos_to_add.items():
225226
# find intersection of these sets
@@ -293,7 +294,7 @@ def _commitWithThread(self, transaction):
293294
self.channel_dict[record_name].append(iocid)
294295
self.iocs[iocid]["channelcount"] += 1
295296
"""In case, alias exists"""
296-
if self.conf.get("alias"):
297+
if self.conf.getboolean("alias"):
297298
if record_name in recordInfoByName and "aliases" in recordInfoByName[record_name]:
298299
for alias in recordInfoByName[record_name]["aliases"]:
299300
self.channel_dict[alias].append(iocid) # add iocname to pvName in dict
@@ -302,7 +303,7 @@ def _commitWithThread(self, transaction):
302303
if iocid in self.channel_dict[record_name]:
303304
self.remove_channel(record_name, iocid)
304305
"""In case, alias exists"""
305-
if self.conf.get("alias"):
306+
if self.conf.getboolean("alias"):
306307
if record_name in recordInfoByName and "aliases" in recordInfoByName[record_name]:
307308
for alias in recordInfoByName[record_name]["aliases"]:
308309
self.remove_channel(alias, iocid)
@@ -496,7 +497,7 @@ def __updateCF__(
496497
cf_channel,
497498
processor.managed_properties,
498499
)
499-
if conf.get("recordType"):
500+
if conf.getboolean("recordType"):
500501
cf_channel["properties"] = __merge_property_lists(
501502
cf_channel["properties"].append(
502503
create_recordType_property(
@@ -509,7 +510,7 @@ def __updateCF__(
509510
channels.append(cf_channel)
510511
_log.debug("Add existing channel to previous IOC: {s}".format(s=channels[-1]))
511512
"""In case alias exist, also delete them"""
512-
if conf.get("alias"):
513+
if conf.getboolean("alias"):
513514
if cf_channel["name"] in recordInfoByName and "aliases" in recordInfoByName[cf_channel["name"]]:
514515
for alias in recordInfoByName[cf_channel["name"]]["aliases"]:
515516
if alias["name"] in channels_dict:
@@ -526,7 +527,7 @@ def __updateCF__(
526527
alias,
527528
processor.managed_properties,
528529
)
529-
if conf.get("recordType"):
530+
if conf.getboolean("recordType"):
530531
cf_channel["properties"] = __merge_property_lists(
531532
cf_channel["properties"].append(
532533
create_recordType_property(
@@ -552,7 +553,7 @@ def __updateCF__(
552553
channels.append(cf_channel)
553554
_log.debug("Add orphaned channel with no IOC: {s}".format(s=channels[-1]))
554555
"""Also orphan any alias"""
555-
if conf.get("alias"):
556+
if conf.getboolean("alias"):
556557
if cf_channel["name"] in recordInfoByName and "aliases" in recordInfoByName[cf_channel["name"]]:
557558
for alias in recordInfoByName[cf_channel["name"]]["aliases"]:
558559
alias["properties"] = __merge_property_lists(
@@ -588,7 +589,7 @@ def __updateCF__(
588589
new_channels.remove(cf_channel["name"])
589590

590591
"""In case, alias exist"""
591-
if conf.get("alias"):
592+
if conf.getboolean("alias"):
592593
if cf_channel["name"] in recordInfoByName and "aliases" in recordInfoByName[cf_channel["name"]]:
593594
for alias in recordInfoByName[cf_channel["name"]]["aliases"]:
594595
if alias in old_channels:
@@ -656,7 +657,7 @@ def __updateCF__(
656657

657658
for channel_name in new_channels:
658659
newProps = create_properties(owner, iocTime, recceiverid, hostName, iocName, iocIP, iocid)
659-
if conf.get("recordType"):
660+
if conf.getboolean("recordType"):
660661
newProps.append(create_recordType_property(owner, recordInfoByName[channel_name]["recordType"]))
661662
if channel_name in recordInfoByName and "infoProperties" in recordInfoByName[channel_name]:
662663
newProps = newProps + recordInfoByName[channel_name]["infoProperties"]
@@ -675,7 +676,7 @@ def __updateCF__(
675676
channels.append(existingChannel)
676677
_log.debug("Add existing channel with different IOC: {s}".format(s=channels[-1]))
677678
"""in case, alias exists, update their properties too"""
678-
if conf.get("alias"):
679+
if conf.getboolean("alias"):
679680
if channel_name in recordInfoByName and "aliases" in recordInfoByName[channel_name]:
680681
alProps = [create_alias_property(owner, channel_name)]
681682
for p in newProps:
@@ -697,7 +698,7 @@ def __updateCF__(
697698
"""New channel"""
698699
channels.append({"name": channel_name, "owner": owner, "properties": newProps})
699700
_log.debug("Add new channel: {s}".format(s=channels[-1]))
700-
if conf.get("alias"):
701+
if conf.getboolean("alias"):
701702
if channel_name in recordInfoByName and "aliases" in recordInfoByName[channel_name]:
702703
alProps = [create_alias_property(owner, channel_name)]
703704
for p in newProps:

server/recceiver_full.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ idkey = 42
6565
infotags = archive
6666

6767
# Feature to add CA/PVA port info for name server to channelfinder
68-
iocConnectionInfo = on
68+
iocConnectionInfo = True
6969

7070
# Add alias records to channelfinder
71-
alias = on
71+
alias = True
7272

7373
# Add EPICS record type to channelfinder
74-
recordType = on
74+
recordType = True
7575

7676
# Add description field to channelfinder
77-
recordDesc = on
77+
recordDesc = True
7878

7979
# The size limit for finding channels (ie the value of the '~size' query parameter)
8080
# If not specified then the fallback is the server default

0 commit comments

Comments
 (0)