ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class FTPImpl.FTPImpl(system, config)

This calss is the public interface by which a <no title> can access the ftp client. This class abstracts away the actual client being used.

Parameters:

  • system: a <no title> object to communicate with the target system

  • config: a <no title> object hold all our configuration

connect(site, user, passwd)

Connect the ftp client to the desired server.

Parameters:

  • site: the name or address of the ftp server to connect to

  • user: the username to authenticate with

  • passwd: the password to authenticate with

exit(save=False)

Exit the current instance of the application.

Parameters:

  • save: not used here, just accepted to provide a common prototype

get(name)

Download a given file fromt he remote system.

Parameters:

  • name: the name of the file to download

ls()

Run ls on the remote system.

open()

Open an instance of the FTP Client to use.

put(path)

Upload the given file to the remote system.

Parameters:

  • path: the file to copy up to the server

run_cmd(cmd)

General function to run other commands, e.g., bin or prompt.

Parameters:

  • cmd: the command to run

FTPImpl.get_ftp_client(system, config, ftp_type=None)

This is Factory function for FTP clients.

Parameters:

  • system: the <no title> object to communicate with the remote system

  • config: the <no title> object defining this user

  • ftpType: optionally the string type to create, overriding whatever is specified in the config object

Return: a concrete instance of FTPImpl or None if no matching type can be found