Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tftp deployment on BareMetal platform #3422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

paulli2017
Copy link
Contributor

@paulli2017 paulli2017 commented Sep 18, 2024

Added SOC support on BareMetal platform


def __post_init__(self, *args: Any, **kwargs: Any) -> None:
if self.connection:
add_secret(self.connection.username, PATTERN_HEADTAIL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

username is not a secret.

else:
self._log.debug("no copied source path specified, skip copy")

def _process_cluster_elements(self, environment: Environment, log: Logger) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call it like _predeploy_environment. It should be clearer than "process".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change is done, thanks

@@ -24,6 +26,28 @@ def __init__(self, runbook: BuildSchema) -> None:
def type_schema(cls) -> Type[schema.TypedSchema]:
return BuildSchema

@classmethod
def find_matched_files(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it to a private function in this file.

def copy(self, sources_path: List[Path], files_map: List[FileSchema]) -> None:
assert self.pxe_runbook.connection, "The build server is not specified"

server_address = self.pxe_runbook.connection.address
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a lisa remotenode, and use the remote_copy tool to copy.

return match_files

try:
sftp.close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above comment, it should use remote_copy tool. But the close pattern should like below to avoid leak resource.

try:
      try:
            transport = paramiko.Transport((server_address, server_port))
            transport.connect(
                username=server_username,
                password=server_password,
            )
        except Exception as ex:
            self._log.exception(
                "failed to connect to {server_address}:{server_port}",
                exc_info=ex,
            )
    ...
final:
    try:
        if sftp:
            sftp.close()
        if transport:
            transport.close()
    except Exception as ex:
        self._log.exception(
            "failed to close the connection",
            exc_info=ex,
        )

@paulli2017 paulli2017 changed the title Support overlake SOC on BareMetal Add tftp deployment on BareMetal platform Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants