libcloud.compute.deployment module
Provides generic deployment steps for machines post boot.
- class libcloud.compute.deployment.Deployment[source]
Bases:
object
Base class for deployment tasks.
- run(node: Node, client: BaseSSHClient) Node [source]
Runs this deployment task on node using the client provided.
- Parameters:
node (
Node
) – Node to operate oneclient (
BaseSSHClient
) – Connected SSH client to use.
- Returns:
Node
- class libcloud.compute.deployment.FileDeployment(source: str, target: str)[source]
Bases:
Deployment
Installs a file on the server.
- Parameters:
source (
str
) – Local path of file to be installedtarget (
str
) – Path to install file on node
- run(node: Node, client: BaseSSHClient) Node [source]
Upload the file, retaining permissions.
See also
Deployment.run
- class libcloud.compute.deployment.MultiStepDeployment(add: Deployment | List[Deployment] | None = None)[source]
Bases:
Deployment
Runs a chain of Deployment steps.
- Parameters:
add (
list
) – Deployment steps to add.
- add(add: Deployment | List[Deployment]) None [source]
Add a deployment to this chain.
- Parameters:
add (Single
Deployment
or alist
ofDeployment
) – Adds this deployment to the others already in this object.
- run(node: Node, client: BaseSSHClient) Node [source]
Run each deployment that has been added.
See also
Deployment.run
- class libcloud.compute.deployment.SSHKeyDeployment(key: str | IO)[source]
Bases:
Deployment
Installs a public SSH Key onto a server.
- Parameters:
key (
str
orFile
object) – Contents of the public key write or a file object which can be read.
- run(node: Node, client: BaseSSHClient) Node [source]
Installs SSH key into
.ssh/authorized_keys
See also
Deployment.run
- class libcloud.compute.deployment.ScriptDeployment(script: str, args: List[str] | None = None, name: str | None = None, delete=False, timeout: float | None = None)[source]
Bases:
Deployment
Runs an arbitrary shell script on the server.
This step works by first writing the content of the shell script (script argument) in a *.sh file on a remote server and then running that file.
If you are running a non-shell script, make sure to put the appropriate shebang to the top of the script. You are also advised to do that even if you are running a plan shell script.
- Parameters:
script (
str
) – Contents of the script to run.args (
list
) – Optional command line arguments which get passed to the deployment script file.name (
str
) – Name of the script to upload it as, if not specified, a random name will be chosen.delete (
bool
) – Whether to delete the script on completion.timeout (
float
) – Optional run timeout for this command.
- run(node: Node, client: BaseSSHClient) Node [source]
Uploads the shell script and then executes it.
See also
Deployment.run
- class libcloud.compute.deployment.ScriptFileDeployment(script_file: str, args: List[str] | None = None, name: str | None = None, delete=False, timeout: float | None = None)[source]
Bases:
ScriptDeployment
Runs an arbitrary shell script from a local file on the server. Same as ScriptDeployment, except that you can pass in a path to the file instead of the script content.
- Parameters:
script_file (
str
) – Path to a file containing the script to run.args (
list
) – Optional command line arguments which get passed to the deployment script file.name (
str
) – Name of the script to upload it as, if not specified, a random name will be chosen.delete (
bool
) – Whether to delete the script on completion.timeout (
float
) – Optional run timeout for this command.