Utils

String utilities

deployer.utils.string_utils.esc1(string)

Escape single quotes, mainly for use in shell commands. Single quotes are usually preferred above double quotes, because they never do shell expension inside. e.g.

class HelloWorld(Node):
    def run(self):
        self.hosts.run("echo '%s'" % esc1("Here's some text"))
deployer.utils.string_utils.esc2(string)

Escape double quotes

deployer.utils.string_utils.indent(string, prefix=' ')

Indent every line of this string.

Other

deployer.utils.network.parse_ifconfig_output(output, only_active_interfaces=True)

Parse the output of an ifconfig command.

Returns:A list of NetworkInterface objects.