pyinfra.api.command module

class pyinfra.api.command.FileDownloadCommand(src: str, dest: str, remote_temp_filename=None, **kwargs)

Bases: PyinfraCommand

execute(state: State, host: Host, executor_kwargs)
class pyinfra.api.command.FileUploadCommand(src: str, dest: str, remote_temp_filename=None, **kwargs)

Bases: PyinfraCommand

execute(state: State, host: Host, executor_kwargs)
class pyinfra.api.command.FunctionCommand(function, args, func_kwargs, **kwargs)

Bases: PyinfraCommand

execute(state: State, host: Host, executor_kwargs)
class pyinfra.api.command.MaskString

Bases: str

class pyinfra.api.command.PyinfraCommand(*args, **kwargs)

Bases: object

execute(state: State, host: Host, executor_kwargs)
class pyinfra.api.command.QuoteString(obj)

Bases: object

class pyinfra.api.command.RsyncCommand(src: str, dest: str, flags, **kwargs)

Bases: PyinfraCommand

execute(state: State, host: Host, executor_kwargs)
class pyinfra.api.command.StringCommand(*bits, **kwargs)

Bases: PyinfraCommand

execute(state: State, host: Host, executor_kwargs)
get_masked_value()
get_raw_value()
pyinfra.api.command.make_formatted_string_command(string: str, *args, **kwargs)

Helper function that takes a shell command or script as a string, splits it using shlex.split and then formats each bit, returning a StringCommand instance with each bit.

Useful to enable string formatted commands/scripts, for example:

curl_command = make_formatted_string_command(
    'curl -sSLf {0} -o {1}',
    QuoteString(src),
    QuoteString(dest),
)