Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CassandraEnvSh(cassandra_conf.base_config.BaseConfig):
- def append_jinja_to_commented_option(self, commented_option_pattern, additional_jinja):
- compiled_pattern = re.compile(commented_option_pattern, re.MULTILINE)
- match = compiled_pattern.search(self.content)
- if match:
- replacement = match.group(0)
- replacement += additional_jinja
- self.content = compiled_pattern.sub(replacement, self.content)
- def max_heap_size_new(self):
- self.append_jinja_to_commented_option(
- commented_option_pattern=r'^#\s*MAX_HEAP_SIZE=.*\n',
- additional_jinja=('{%- if cassandra_env_sh.max_heap_size is defined %}\n'
- 'MAX_HEAP_SIZE="{{ cassandra_env_sh.max_heap_size }}"\n'
- '{%- endif %}\n'))
- def heap_newsize_new(self):
- self.append_jinja_to_commented_option(
- commented_option_pattern=r'^#\s*HEAP_NEWSIZE=.*\n',
- addtional_jinja=('{%- if cassandra_env_sh.heap_newsize is defined %}\n'
- 'HEAP_NEWSIZE="{{ cassandra_env_sh.heap_newsize }}"\n'
- '{%- endif %}\n'))
- def max_heap_size_old(self):
- pattern = re.compile(r'^#\s*MAX_HEAP_SIZE=.*\n', re.MULTILINE)
- match = pattern.search(self.content)
- if match:
- replacement = match.group(0)
- replacement += '{%- if cassandra_env_sh.max_heap_size is defined %}\n'
- replacement += 'MAX_HEAP_SIZE="{{ cassandra_env_sh.max_heap_size }}"\n'
- replacement += '{%- endif %}\n'
- self.content = pattern.sub(replacement, self.content)
- def heap_newsize_old(self):
- pattern = re.compile(r'^#\s*HEAP_NEWSIZE=.*\n', re.MULTILINE)
- match = pattern.search(self.content)
- if match:
- replacement = match.group(0)
- replacement += '{%- if cassandra_env_sh.heap_newsize is defined %}\n'
- replacement += 'HEAP_NEWSIZE="{{ cassandra_env_sh.heap_newsize }}"\n'
- replacement += '{%- endif %}\n'
- self.content = pattern.sub(replacement, self.content)
Add Comment
Please, Sign In to add comment