You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/10/11 17:11:18 UTC

[trafficcontrol] 08/21: Fixed issue where config file object was treated as config file name

This is an automated email from the ASF dual-hosted git repository.

dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit c12d9fcc8dd6052d3e033c707b3ca70fbd246e9d
Author: ocket8888 <Br...@comcast.com>
AuthorDate: Wed Oct 3 15:39:14 2018 +0000

    Fixed issue where config file object was treated as config file name
---
 .../cdn-in-a-box/ort/traffic_ops_ort/main_routines.py       | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/main_routines.py b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/main_routines.py
index 1c90ad8..a8fc685 100644
--- a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/main_routines.py
+++ b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/main_routines.py
@@ -72,12 +72,24 @@ def deleteOldStatusFiles(myStatus:str):
 	from .configuration import MODE, Modes
 	from . import to_api, utils
 
+	logging.info("Deleting old status files (those that are not %s)", myStatus)
+
 	doDeleteFiles = MODE is not Modes.REPORT
 
 	for status in to_api.getStatuses():
 
+		# Only the status name matters
+		try:
+			status = status["name"]
+		except KeyError as e:
+			logging.debug("Bad status object: %r", status)
+			logging.debug("Original error: %s", e, exc_info=True, stack_info=True)
+			raise ConnectionError from e
+
 		if doDeleteFiles and status != myStatus:
 			fname = os.path.join("/opt/ORTstatus", status)
+			if not os.path.isfile(fname):
+				continue
 			logging.info("File '%s' to be deleted", fname)
 
 			# check for user confirmation before deleting files in 'INTERACTIVE' mode
@@ -182,6 +194,7 @@ def processServices() -> bool:
 
 	:returns: whether or not the service processing was completed successfully
 	"""
+	from . import services
 	from .to_api import getMyChkconfig
 
 	chkconfig = getMyChkconfig()