qrexec.policy.parser_compat – Parser for legacy policy

This module is transitional and may go away any time.

qrexec.policy.parser_compat.walk_compat_files(legacy_path=PosixPath('/etc/qubes-rpc/policy'))[source]

Walks files in correct order for generating compat policy.

Parameters:

legacy_path (pathlib.Path) – base path for legacy policy

Yields:

(service, argument, filepath)

class qrexec.policy.parser_compat.Compat40Loader(*, legacy_path=None, **kwds)[source]

This parser should be used as helper for executing compatibility statement:

>>> class MyParser(qrexec.policy.parser.AbstractPolicyParser):
...     def handle_compat40(self, *, filepath, lineno):
...         subparser = Compat40Parser(master=self)
...         subparser.execute(filepath=filepath, lineno=lineno)
class qrexec.policy.parser_compat.Compat40Parser(*, master, **kwds)[source]

Abstract parser for compat policy. Needs walk_includes().

Parameters:

master (qrexec.policy.parser.AbstractPolicyParser) – the parser that will handle all the syntax parsed from the legacy policy

abstractmethod walk_includes()[source]

An iterator that walks over all files to be included via !compat-4.0 statement.

Yields:

(service, argument, filepath)

execute(*, filepath, lineno)[source]

Insert the policy into master parser.

class qrexec.policy.parser_compat.TestCompat40Loader(*, legacy_path=None, **kwds)[source]

Used for tests. See qrexec.policy.parser.StringPolicy.