예제 #1
0
        res = self.main.find("ServerRoot")
        return res.value if res else "/opt/rh/jbcs-httpd24/root/etc/httpd"


def get_tree(root=None):
    """
    This is a helper function to get an httpd configuration component for your
    local machine or an archive. Use it in interactive sessions.
    """
    return run(HttpdConfTree, root=root).get(HttpdConfTree)


is_private = pred(lambda x: ip_address(six.u(x)).is_private)
"""
Predicate to check if an ip address is private.

Example:
    conf["VirtualHost", in_network("128.39.0.0/16")]
"""

in_network = pred2(lambda x, y: (ip_address(six.u(x)) in ip_network(six.u(y))))
"""
Predicate to check if an ip address is in a given network.

Example:
    conf["VirtualHost", in_network("128.39.0.0/16")]
"""

if __name__ == "__main__":
    run(HttpdConfTree, print_summary=True)
예제 #2
0
        return res.value if res else "/etc/httpd"


def get_tree(root=None):
    """
    This is a helper function to get an httpd configuration component for your
    local machine or an archive. It's for use in interactive sessions.
    """
    return run(HttpdConfTree, root=root).get(HttpdConfTree)


is_private = UnaryBool(lambda x: ip_address(six.u(x)).is_private)
"""
Predicate to check if an ip address is private.

Example:
    conf["VirtualHost", in_network("128.39.0.0/16")]
"""

in_network = BinaryBool(lambda x, y:
                        (ip_address(six.u(x)) in ip_network(six.u(y))))
"""
Predicate to check if an ip address is in a given network.

Example:
    conf["VirtualHost", in_network("128.39.0.0/16")]
"""

if __name__ == "__main__":
    run(HttpdConfTree, print_summary=True)