Files
test/keywords/docker/trust/docker_trust_keywords.py
Thomas Sunil eb4d2d461f Portieris app sanity tests
- portieris app functional test with clusterimagepolicy
- portieris app functional test with imagepolicy

Change-Id: Ida25ec148ff4f28a15a28818a15d811df84b7cb5
Signed-off-by: Thomas Sunil <sunil.thomas@windriver.com>
2025-10-03 16:01:36 -04:00

30 lines
1.1 KiB
Python

from framework.ssh.ssh_connection import SSHConnection
from keywords.base_keyword import BaseKeyword
class DockerTrustKeywords(BaseKeyword):
"""Keywords for Docker trust operations."""
def __init__(self, ssh_connection: SSHConnection):
"""Initialize Docker trust keywords.
Args:
ssh_connection (SSHConnection): SSH connection to the active controller.
"""
self.ssh_connection = ssh_connection
def inspect_docker_trust(self, image_name: str, trust_server: str) -> str:
"""Inspect Docker trust signatures for an image.
Args:
image_name (str): Name of the Docker image to inspect.
trust_server (str): Docker trust server URL.
Returns:
str: Docker trust inspection output.
"""
cmd = f"DOCKER_CONTENT_TRUST=1 DOCKER_CONTENT_TRUST_SERVER={trust_server} docker trust inspect {image_name}"
output = self.ssh_connection.send_as_sudo(cmd)
self.validate_success_return_code(self.ssh_connection)
return "\n".join(output) if isinstance(output, list) else str(output)