Skip to content

Commit 335ac3b

Browse files
committed
old to old_channels, new to new_channels
1 parent fdd3ed8 commit 335ac3b

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

server/recceiver/cfstore.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def __updateCF__(
420420
iocs = processor.iocs
421421
conf = processor.conf
422422
recceiverid = conf.get(RECCEIVERID_KEY, RECCEIVERID_DEFAULT)
423-
new = set(recordInfoByName.keys())
423+
new_channels = set(recordInfoByName.keys())
424424

425425
if iocid in iocs:
426426
hostName = iocs[iocid]["hostname"]
@@ -440,14 +440,14 @@ def __updateCF__(
440440
channels = []
441441
"""A list of channels in channelfinder with the associated hostName and iocName"""
442442
_log.debug("Find existing channels by IOCID: {iocid}".format(iocid=iocid))
443-
old = client.findByArgs(prepareFindArgs(conf, [("iocid", iocid)]))
443+
old_channels = client.findByArgs(prepareFindArgs(conf, [("iocid", iocid)]))
444444
if processor.cancelled:
445445
raise defer.CancelledError()
446446

447-
if old is not None:
448-
for cf_channel in old:
447+
if old_channels is not None:
448+
for cf_channel in old_channels:
449449
if (
450-
len(new) == 0 or cf_channel["name"] in records_to_delete
450+
len(new_channels) == 0 or cf_channel["name"] in records_to_delete
451451
): # case: empty commit/del, remove all reference to ioc
452452
if cf_channel["name"] in channels_dict:
453453
cf_channel["owner"] = iocs[channels_dict[cf_channel["name"]][-1]]["owner"]
@@ -532,7 +532,7 @@ def __updateCF__(
532532
channels.append(alias)
533533
_log.debug("Add orphaned alias with no IOC: {s}".format(s=channels[-1]))
534534
else:
535-
if cf_channel["name"] in new: # case: channel in old and new
535+
if cf_channel["name"] in new_channels: # case: channel in old and new
536536
"""
537537
Channel exists in Channelfinder with same hostname and iocname.
538538
Update the status to ensure it is marked active and update the time.
@@ -546,13 +546,13 @@ def __updateCF__(
546546
)
547547
channels.append(cf_channel)
548548
_log.debug("Add existing channel with same IOC: {s}".format(s=channels[-1]))
549-
new.remove(cf_channel["name"])
549+
new_channels.remove(cf_channel["name"])
550550

551551
"""In case, alias exist"""
552552
if conf.get("alias", "default") == "on":
553553
if cf_channel["name"] in recordInfoByName and "aliases" in recordInfoByName[cf_channel["name"]]:
554554
for alias in recordInfoByName[cf_channel["name"]]["aliases"]:
555-
if alias in old:
555+
if alias in old_channels:
556556
"""alias exists in old list"""
557557
alias["properties"] = __merge_property_lists(
558558
[
@@ -570,7 +570,7 @@ def __updateCF__(
570570
alias["properties"],
571571
)
572572
channels.append(alias)
573-
new.remove(alias["name"])
573+
new_channels.remove(alias["name"])
574574
else:
575575
"""alias exists but not part of old list"""
576576
aprops = __merge_property_lists(
@@ -600,7 +600,7 @@ def __updateCF__(
600600
"properties": aprops,
601601
}
602602
)
603-
new.remove(alias["name"])
603+
new_channels.remove(alias["name"])
604604
_log.debug("Add existing alias with same IOC: {s}".format(s=channels[-1]))
605605
# now pvNames contains a list of pv's new on this host/ioc
606606
"""A dictionary representing the current channelfinder information associated with the pvNames"""
@@ -612,7 +612,7 @@ def __updateCF__(
612612
"""
613613
searchStrings = []
614614
searchString = ""
615-
for record_name in new:
615+
for record_name in new_channels:
616616
if not searchString:
617617
searchString = record_name
618618
elif len(searchString) + len(record_name) < 600:
@@ -630,7 +630,7 @@ def __updateCF__(
630630
if processor.cancelled:
631631
raise defer.CancelledError()
632632

633-
for record_name in new:
633+
for record_name in new_channels:
634634
newProps = create_properties(owner, iocTime, recceiverid, hostName, iocName, iocIP, iocid)
635635
if conf.get("recordType", "default") == "on":
636636
newProps.append(
@@ -680,7 +680,7 @@ def __updateCF__(
680680
if len(channels) != 0:
681681
client.set(channels=channels)
682682
else:
683-
if old and len(old) != 0:
683+
if old_channels and len(old_channels) != 0:
684684
client.set(channels=channels)
685685
if processor.cancelled:
686686
raise defer.CancelledError()

0 commit comments

Comments
 (0)