
- portieris app functional test with clusterimagepolicy - portieris app functional test with imagepolicy Change-Id: Ida25ec148ff4f28a15a28818a15d811df84b7cb5 Signed-off-by: Thomas Sunil <sunil.thomas@windriver.com>
31 lines
912 B
Python
31 lines
912 B
Python
from framework.ssh.ssh_connection import SSHConnection
|
|
from keywords.base_keyword import BaseKeyword
|
|
|
|
|
|
class LsKeywords(BaseKeyword):
|
|
"""Keywords for ls command operations."""
|
|
|
|
def __init__(self, ssh_connection: SSHConnection):
|
|
"""Initialize ls keywords.
|
|
|
|
Args:
|
|
ssh_connection (SSHConnection): SSH connection to the active controller.
|
|
"""
|
|
self.ssh_connection = ssh_connection
|
|
|
|
def get_first_matching_file(self, pattern: str) -> str:
|
|
"""Get the first file matching the given pattern.
|
|
|
|
Args:
|
|
pattern (str): File pattern to match.
|
|
|
|
Returns:
|
|
str: First matching file path.
|
|
"""
|
|
output = self.ssh_connection.send(f"ls {pattern}")
|
|
self.validate_success_return_code(self.ssh_connection)
|
|
|
|
if isinstance(output, list):
|
|
return output[0].strip()
|
|
return output.strip()
|