Skip to content

Commit

Permalink
doc: fix formating of policy-related documentation
Browse files Browse the repository at this point in the history
Fix Sphinx warnings and errors in both doc/ and docstrings.
  • Loading branch information
marmarek committed Jul 4, 2017
1 parent e8e30c8 commit e7f717e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions doc/qubes-policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ Policy consists of a file, which is parsed line-by-line. First matching line
is used as an action.

Each line consist of three values separated by white characters (space(s), tab(s)):

1. Source specification, which is one of:

- domain name
- `$anyvm` - any domain
- `$tag:some-tag` - VM having tag `some-tag`
- `$type:vm-type` - VM of `vm-type` type, available types:
AppVM, TemplateVM, StandaloneVM, DispVM
AppVM, TemplateVM, StandaloneVM, DispVM

2. Target specification, one of:

- domain name
- `$anyvm` - any domain, excluding dom0
- `$tag:some-tag` - domain having tag `some-tag`
- `$type:vm-type` - domain of `vm-type` type, available types:
AppVM, TemplateVM, StandaloneVM, DispVM
AppVM, TemplateVM, StandaloneVM, DispVM
- `$default` - used when caller did not specified any VM
- `$dispvm:vm-name` - _new_ Disposable VM created from AppVM `vm-name`
- `$dispvm` - _new_ Disposable VM created from AppVM pointed by caller
Expand All @@ -38,13 +39,15 @@ Each line consist of three values separated by white characters (space(s), tab(s
3. Action and optional action parameters, one of:

- `allow` - allow the call, without further questions; optional parameters:

- `target=` - override caller provided call target -
possible values are: domain name, `$dispvm` or `$dispvm:vm-name`
- `user=` - call the service using this user, instead of the user
pointed by target VM's `default_user` property
- `deny` - deny the call, without further questions; no optional
parameters are supported
- `ask` - ask the user for confirmation; optional parameters:

- `target=` - override user provided call target
- `user=` - call the service using this user, instead of the user
pointed by target VM's `default_user` property
Expand Down
24 changes: 12 additions & 12 deletions qubespolicy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def verify_special_value(value, for_target=True):
:param value: value to verify
:param for_target: should classify target-only values as valid (
'$default', '$dispvm')
'$default', '$dispvm')
:return: True or False
'''
# pylint: disable=too-many-return-statements
Expand Down Expand Up @@ -202,7 +202,7 @@ def is_match_single(system_info, policy_value, value):
:param system_info: information about the system
:param policy_value: value from qrexec policy (either self.source or
self.target)
self.target)
:param value: value to be compared (source or target)
:return: True or False
'''
Expand Down Expand Up @@ -265,8 +265,8 @@ def is_match(self, system_info, source, target):
Check if given (source, target) matches this policy line.
:param system_info: information about the system - available VMs,
their types, labels, tags etc. as returned by
:py:func:`app_to_system_info`
their types, labels, tags etc. as returned by
:py:func:`app_to_system_info`
:param source: name of the source VM
:param target: name of the target VM, or None if not specified
:return: True or False
Expand Down Expand Up @@ -392,8 +392,8 @@ def handle_user_response(self, response, target=None):
def execute(self, caller_ident):
''' Execute allowed service call
:param caller_ident: Service caller ident (`process_ident,source_name,
source_id`)
:param caller_ident: Service caller ident
(`process_ident,source_name, source_id`)
'''
assert self.action == Action.allow
assert self.target is not None
Expand Down Expand Up @@ -473,7 +473,7 @@ class Policy(object):
>>> policy = Policy('some-service')
>>> action = policy.evaluate(system_info, 'source-name', 'target-name')
>>> if action.action == Action.ask:
(... ask the user, see action.targets_for_ask ...)
>>> # ... ask the user, see action.targets_for_ask ...
>>> action.handle_user_response(response, target_chosen_by_user)
>>> action.execute('process-ident')
Expand Down Expand Up @@ -668,11 +668,11 @@ def get_system_info():
data is nested dict structure with this structure:
- domains:
- <domain name>:
- tags: list of tags
- type: domain type
- dispvm_allowed: should DispVM based on this VM be allowed
- default_dispvm: name of default AppVM for DispVMs started from here
- `<domain name>`:
- tags: list of tags
- type: domain type
- dispvm_allowed: should DispVM based on this VM be allowed
- default_dispvm: name of default AppVM for DispVMs started from here
'''

Expand Down

0 comments on commit e7f717e

Please sign in to comment.