This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a commit to branch DLAB-1594-2
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-1594-2 by this push:
new a4c606f [DLAB-1594]: changed how lines are replaced
a4c606f is described below
commit a4c606f503c3a8c675a9435914ac8a7da4fd1a9c
Author: leonidfrolov <[email protected]>
AuthorDate: Tue Aug 4 13:39:22 2020 +0300
[DLAB-1594]: changed how lines are replaced
---
infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py
b/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py
index 573a976..7bd5766 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py
@@ -155,10 +155,10 @@ def find_replace_line(file_path, searched_str,
replacement_line):
try:
lines = sudo('cat {}'.format(file_path)).split('\r\n')
sudo('echo "" > {}'.format(file_path))
- for line in lines:
+ for n, line in enumerate(lines):
if searched_str in line:
- line = replacement_line
- sudo('echo "{}" >> {}'.format(line, file_path)
+ lines[n] = replacement_line
+ sudo('echo "{}" >> {}'.format(lines[n], file_path)
except Exception as err:
traceback.print_exc()
print('Failed to replace string: ' + str(err))
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]