Skip to content

Commit

Permalink
fix(cluster): remove deprecated system_init property
Browse files Browse the repository at this point in the history
for long we have it inside the `Distro` class, and there's
no need for it on the cluster class
  • Loading branch information
fruch committed May 21, 2024
1 parent a7e68c8 commit ebdbf8a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 27 deletions.
22 changes: 5 additions & 17 deletions sdcm/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
S3Storage,
ScyllaCQLSession,
PageFetcher,
deprecation,
get_data_dir_path,
verify_scylla_repo_file,
normalize_ipv6_url,
Expand Down Expand Up @@ -279,7 +278,6 @@ def __init__(self, name, parent_cluster, ssh_login_info=None, base_logdir=None,
self._db_log_reader_thread = None
self._scylla_manager_journal_thread = None
self._decoding_backtraces_thread = None
self._init_system = None
self.db_init_finished = False

self._short_hostname = None
Expand Down Expand Up @@ -941,19 +939,6 @@ def start_spot_monitoring_thread(self):
target=self.spot_monitoring_thread, name='SpotMonitoringThread', daemon=True)
self._spot_monitoring_thread.start()

@property
def init_system(self):
deprecation("consider to use node.distro.uses_systemd property instead")
if self._init_system is None:
result = self.remoter.run('journalctl --version',
ignore_status=True)
if result.exit_status == 0:
self._init_system = 'systemd'
else:
self._init_system = 'sysvinit'

return self._init_system

def start_journal_thread(self):
logs_transport = self.parent_cluster.params.get("logs_transport")
self._journal_thread = get_system_logging_thread(
Expand Down Expand Up @@ -1709,10 +1694,13 @@ def config_setup(self,
elif self.distro.is_sles:
self.remoter.sudo("zypper install -y scylla-gdb", verbose=True, ignore_status=True)

if self.init_system == "systemd":
self.fix_scylla_server_systemd_config()
self.fix_scylla_server_systemd_config()

def fix_scylla_server_systemd_config(self):
if self.is_docker():
# we don't have systemd working inside docker
return

systemd_version = get_systemd_version(self.remoter.run("systemctl --version", ignore_status=True).stdout)
if systemd_version >= 240:
self.log.debug("systemd version %d >= 240: we can change FinalKillSignal", systemd_version)
Expand Down
5 changes: 0 additions & 5 deletions sdcm/cluster_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@ def restart_scylla(self, verify_up_before=False, verify_up_after=True, timeout=1
def image(self) -> str:
return self.parent_cluster.source_image

@property
def init_system(self):
"""systemd is not used in Docker"""
return "docker"

@property
def vm_region(self):
return "docker"
Expand Down
2 changes: 1 addition & 1 deletion sdcm/utils/remote_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def get_system_logging_thread(logs_transport, node, target_log_file): # pylint:
if logs_transport == 'k8s_client':
return K8sClientLogger(node, target_log_file)
if logs_transport == 'ssh':
if node.init_system == 'systemd':
if node.distro.uses_systemd:
if 'db-node' in node.name and node.is_nonroot_install and node.remoter.run(
'sudo test -e /var/log/journal', ignore_status=True).exit_status != 0:
return SSHNonRootScyllaSystemdLogger(node, target_log_file)
Expand Down
4 changes: 0 additions & 4 deletions unit_tests/test_scylla_yaml_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,6 @@ def _get_public_ip_address(self):
def process_scylla_args(self, append_scylla_args=''):
pass

@property
def init_system(self):
return 'systemd'

def fix_scylla_server_systemd_config(self):
pass

Expand Down

0 comments on commit ebdbf8a

Please sign in to comment.