Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for handling SCYLLA_EXT_OPTS correctly #541

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ccmlib/scylla_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def start(self, join_ring=True, no_wait=False, verbose=False,

MB = 1024 * 1024

def process_opts(opts):
def process_opts(opts, args_translation_map = {}):
ext_args = OrderedDict()
opts_i = 0
while opts_i < len(opts):
Expand All @@ -570,11 +570,12 @@ def process_opts(opts):
opts_i += 1
val = ' '.join(vals)
if key not in ext_args and not key.startswith("--scylla-manager"):
ext_args[key] = val
ext_args[args_translation_map.get(key, key)] = val
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd suggest normalize key even before the if key not in ext_args and not key.startswith("--scylla-manager") check, and do this unconditially. like:

key = args_translation_map.get(key, key)
if key not in ext_args and not key.startswith("--scylla-manager"):
    ext_args[key] = val

for better readaiblity.

return ext_args

scylla_params_translation_map = {"-m" : "--memory", "-c" : "--smp"}
# Lets search for default overrides in SCYLLA_EXT_OPTS
env_args = process_opts(os.getenv('SCYLLA_EXT_OPTS', "").split())
env_args = process_opts(os.getenv('SCYLLA_EXT_OPTS', "").split(), scylla_params_translation_map)

# precalculate self._mem_mb_per_cpu if --memory is given in SCYLLA_EXT_OPTS
# and it wasn't set explicitly by the test
Expand Down