How to use the certbot-apache.certbot_apache._internal.augeasparser.AugeasBlockNode function in certbot-apache

To help you get started, we’ve selected a few certbot-apache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github certbot / certbot / certbot-apache / certbot_apache / _internal / augeasparser.py View on Github external
elif position == 0:
            # Insert as the first child, before the current first one.
            insert_path = all_children[0]
            before = True
        else:
            insert_path = "{}/*[{}]".format(
                self.metadata["augeaspath"],
                position
            )

        return (insert_path, resulting_path, before)


interfaces.CommentNode.register(AugeasCommentNode)
interfaces.DirectiveNode.register(AugeasDirectiveNode)
interfaces.BlockNode.register(AugeasBlockNode)
github certbot / certbot / certbot-apache / certbot_apache / _internal / augeasparser.py View on Github external
def _create_blocknode(self, path):
        """Helper function to create a BlockNode from Augeas path"""

        name = self._aug_get_name(path)
        metadata = {"augeasparser": self.parser, "augeaspath": path}

        # Because of the dynamic nature, and the fact that we're not populating
        # the complete ParserNode tree, we use the search parent as ancestor
        return AugeasBlockNode(name=name,
                               ancestor=assertions.PASS,
                               filepath=apache_util.get_file_path(path),
                               metadata=metadata)
github certbot / certbot / certbot-apache / certbot_apache / _internal / augeasparser.py View on Github external
def add_child_block(self, name, parameters=None, position=None):  # pragma: no cover
        """Adds a new BlockNode to the sequence of children"""

        insertpath, realpath, before = self._aug_resolve_child_position(
            name,
            position
        )
        new_metadata = {"augeasparser": self.parser, "augeaspath": realpath}

        # Create the new block
        self.parser.aug.insert(insertpath, name, before)

        # Parameters will be set at the initialization of the new object
        new_block = AugeasBlockNode(name=name,
                                    parameters=parameters,
                                    ancestor=assertions.PASS,
                                    filepath=apache_util.get_file_path(realpath),
                                    metadata=new_metadata)
        return new_block
github certbot / certbot / certbot-apache / certbot_apache / _internal / augeasparser.py View on Github external
def __init__(self, **kwargs):
        super(AugeasBlockNode, self).__init__(**kwargs)
        self.children = ()