pyinfra.api.command module

class pyinfra.api.command.FileDownloadCommand(src, dest, **kwargs)

Bases: pyinfra.api.command.PyinfraCommand

execute(state, host, executor_kwargs)
class pyinfra.api.command.FileUploadCommand(src, dest, **kwargs)

Bases: pyinfra.api.command.PyinfraCommand

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

Bases: pyinfra.api.command.PyinfraCommand

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

Bases: str

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

Bases: object

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

Bases: object

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

Bases: pyinfra.api.command.PyinfraCommand

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

Bases: pyinfra.api.command.PyinfraCommand

execute(state, host, executor_kwargs)
get_masked_value()
get_raw_value()
pyinfra.api.command.make_formatted_string_command(string, *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),
)