Skip to content

Commit

Permalink
[PLAT-14435]Fix args parsing in failure detection py script
Browse files Browse the repository at this point in the history
Summary:
Key value parsing fails for values which contain `=`
Eg: For `--ysql_pg_conf_csv="shared_preload_libraries=passwordcheck"`
the script fails with
```
Traceback (most recent call last):
  File "/home/yugabyte/disk_io_failure_detection_py3.py", line 157, in <module>
    config_dict = parse_config_file(DEFAULT_HOME_DIR + process + CONF_PATH)
  File "/home/yugabyte/disk_io_failure_detection_py3.py", line 121, in parse_config_file
    key, value = line[2:].split('=')
ValueError: too many values to unpack (expected 2)
```
Update the script to split after the first `=`.

Test Plan: This fix was tested in fidelity's env.

Reviewers: vpatibandla

Reviewed By: vpatibandla

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D38213
  • Loading branch information
asharma-yb committed Sep 20, 2024
1 parent 90d4e93 commit 294b7bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def parse_config_file(config_path):
with open(config_path, 'r') as file:
for line in file:
line = line.strip()
key, value = line[2:].split('=')
key, value = line[2:].split('=', 1)
if key == PROCESS_NAMES_ARG:
args[key] = value.split()
elif key == TIME_LIMIT_ARG:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def parse_config_file(config_path):
for line in file:
line = line.strip()
if line.startswith(DOUBLE_HYPHEN):
key, value = line[2:].split('=')
key, value = line[2:].split('=', 1)
if key == PROCESS_NAMES_ARG:
args[key] = value.split()
elif key == TIME_LIMIT_ARG:
Expand Down

0 comments on commit 294b7bb

Please sign in to comment.