Skip to content

Commit

Permalink
Code modified based on review comments.
Browse files Browse the repository at this point in the history
Features: control telemetry

Required-githooks: true

Signed-off-by: Samir Raval <[email protected]>
  • Loading branch information
ravalsam committed Oct 1, 2024
1 parent d9860a4 commit 3c3bbc3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 41 deletions.
4 changes: 2 additions & 2 deletions src/tests/ftest/util/agent_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ def start(self):
# Copy certificates
self.manager.job.copy_certificates(
get_log_file("daosCA/certs"), self._hosts)
self.manager.job.copy_telemetry_certificates(
self.manager.job.copy_telemetry_root_certificates(
get_log_file("daosTelemetryCA"), self._hosts)
self.manager.job.generate_telemetry_certificates(self._hosts, "daos_agent")
self.manager.job.generate_telemetry_server_certificates(self._hosts, "daos_agent")

# Verify the socket directory exists when using a non-systemctl manager
if self.verify_socket_dir:
Expand Down
14 changes: 0 additions & 14 deletions src/tests/ftest/util/agent_utils_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,6 @@ def __init__(self, log_dir=os.path.join(os.sep, "tmp")):
self.server_cert = LogParameter(self._log_dir, None, "telemetryserver.crt")
self.server_key = LogParameter(self._log_dir, None, "telemetryserver.key")

def get_certificate_data(self, name_list):
"""Get certificate data.
Args:
name_list (list): list of certificate attribute names.
Returns:
data (dict): a dictionary of parameter directory name keys and
value.
"""
data = super().get_certificate_data(name_list)
return data

def _get_new(self):
"""Get a new object based upon this one.
Expand Down
10 changes: 5 additions & 5 deletions src/tests/ftest/util/command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from exception_utils import CommandFailure
from file_utils import change_file_owner, create_directory, distribute_files
from general_utils import (DaosTestError, check_file_exists, get_file_listing,
get_job_manager_class, get_subprocess_stdout, run_command, run_pcmd)
get_job_manager_class, get_subprocess_stdout, run_command)
from run_utils import command_as_user, run_remote
from user_utils import get_primary_group
from yaml_utils import get_yaml_data
Expand Down Expand Up @@ -1038,7 +1038,7 @@ def copy_certificates(self, source, hosts):
self._command, ", ".join(names))
get_file_listing(hosts, names, self.run_user).log_output(self.log)

def copy_telemetry_certificates(self, source, hosts):
def copy_telemetry_root_certificates(self, source, hosts):
"""Copy telemetry certificates files from the source to the destination hosts.
Args:
Expand All @@ -1061,7 +1061,7 @@ def copy_telemetry_certificates(self, source, hosts):
self.log.info(" WARNING: %s copy telemetry cert failed on %s",
dst_file, result.failed_hosts)

def generate_telemetry_certificates(self, hosts, user):
def generate_telemetry_server_certificates(self, hosts, user):
"""Generate the telemetry certificates for the test on server/client.
Args:
Expand All @@ -1080,8 +1080,8 @@ def generate_telemetry_certificates(self, hosts, user):
command = os.path.join(certgen_dir, "gen_telemetry_server_certificate.sh ")
command = "sudo " + command + user + " " + destination
self.log.debug("Generating the telemetry certificate command %s:", command)
result = run_pcmd(hosts, command, 30)
if result[0]['exit_status'] != 0:
result = run_remote(self.log, hosts, command, 30)
if not result.passed:
self.log.info(" WARNING: command %s failed", command)

def copy_configuration(self, hosts):
Expand Down
6 changes: 3 additions & 3 deletions src/tests/ftest/util/command_utils_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,12 +803,12 @@ class TelemetryCredentials(YamlParameters):
"""Telemetry credentials listing certificates for secure communication."""

def __init__(self, namespace, title, log_dir):
"""Initialize a TelemetryConfig object.
"""Initialize a TelemetryCredentials object.
Args:
namespace (str): yaml namespace (path to parameters)
title (str, optional): namespace under which to place the
parameters when creating the yaml file. Defaults to None.
title (str): namespace under which to place the
parameters when creating the yaml file.
log_dir (str): location of the certificate files
"""
super().__init__(namespace, None, title)
Expand Down
6 changes: 4 additions & 2 deletions src/tests/ftest/util/server_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ def prepare(self, storage=True):

# Copy certificates
self.manager.job.copy_certificates(get_log_file("daosCA/certs"), self._hosts)
self.manager.job.copy_telemetry_certificates(get_log_file("daosTelemetryCA"), self._hosts)
self.manager.job.generate_telemetry_certificates(self._hosts, "daos_server")
self.manager.job.copy_telemetry_root_certificates(get_log_file("daosTelemetryCA"),
self._hosts)
self.manager.job.generate_telemetry_server_certificates(self._hosts,
"daos_server")
self._prepare_dmg_certificates()

# Prepare dmg for running storage format on all server hosts
Expand Down
16 changes: 1 addition & 15 deletions src/tests/ftest/util/server_utils_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DaosServerTelemetryCredentials(TelemetryCredentials):
"""Telemetry credentials listing certificates for secure communication."""

def __init__(self, log_dir=os.path.join(os.sep, "tmp")):
"""Initialize a TelemetryConfig object."""
"""Initialize a DaosServerTelemetryCredentials object."""
super().__init__("/run/server_config/telemetry_config/*", None, log_dir)

# Additional daos_server telemetry credential parameters:
Expand All @@ -74,20 +74,6 @@ def __init__(self, log_dir=os.path.join(os.sep, "tmp")):
self.server_cert = LogParameter(self._log_dir, None, "telemetryserver.crt")
self.server_key = LogParameter(self._log_dir, None, "telemetryserver.key")

def get_certificate_data(self, name_list):
"""Get certificate data.
Args:
name_list (list): list of certificate attribute names.
Returns:
data (dict): a dictionary of parameter directory name keys and
value.
"""
data = super().get_certificate_data(name_list)
return data

def _get_new(self):
"""Get a new object based upon this one.
Expand Down

0 comments on commit 3c3bbc3

Please sign in to comment.