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:22 UTC

[trafficcontrol] 12/21: Fixed new files not having terminating newlines

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 f8c9fca52633187522c10e2250e6198ab243bb7c
Author: ocket8888 <Br...@comcast.com>
AuthorDate: Wed Oct 3 15:54:29 2018 +0000

    Fixed new files not having terminating newlines
---
 infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py
index 06c69d8..fd82c23 100644
--- a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py
+++ b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py
@@ -172,6 +172,9 @@ class ConfigFile():
 		from .services import NEEDED_RELOADS, FILES_THAT_REQUIRE_RELOADS
 
 		finalContents = sanitizeContents(str(self))
+		# Ensure POSIX-compliant files
+		if not finalContents.endswith('\n'):
+			finalContents += '\n'
 		logging.info("Sanitized output: \n%s", finalContents)
 
 		if not os.path.isdir(self.location):
@@ -212,9 +215,6 @@ class ConfigFile():
 					fp.seek(0)
 					fp.truncate()
 
-					# Ensure POSIX-compliant files
-					if not finalContents.endswith('\n'):
-						finalContents += '\n'
 
 					fp.write(finalContents)
 					if self.fname in FILES_THAT_REQUIRE_RELOADS: