-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test config grammar for per app overlay ppa.
In some circumstances we want to install packages from overlay PPA on specific applications and not across the whole model. Add configuration grammar, actual implementation of generic setup step will follow in subsequent patch. Signed-off-by: Frode Nordahl <[email protected]>
- Loading branch information
Showing
1 changed file
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ def parse_option_list_string(option_list, delimiter=None): | |
return settings | ||
|
||
|
||
def get_overlay_ppas(model_alias='default_alias'): | ||
def get_overlay_ppas(model_alias='default_alias', application=None): | ||
"""Get overlay_ppas from global_config. | ||
In the config file for the tests, the tests_options.overlay_ppa option | ||
|
@@ -97,17 +97,25 @@ def get_overlay_ppas(model_alias='default_alias'): | |
:param model_alias: Name of model alias, defaults to 'default_alias'. | ||
:type model_alias: Option[str] | ||
:param application: Name of application to retrieve config for. | ||
:type application: Option[str] | ||
:returns: List of overlay PPAs. | ||
:rtype: Option[List[Any]] | ||
""" | ||
config = zaza.global_options.get_options() | ||
config_overlay_ppas = None | ||
try: | ||
return config[model_alias].overlay_ppas | ||
config_overlay_ppas = config[model_alias].overlay_ppas | ||
except KeyError: | ||
try: | ||
return config.overlay_ppas | ||
config_overlay_ppas = config.overlay_ppas | ||
except KeyError: | ||
pass | ||
if config_overlay_ppas and application: | ||
return [overlay_ppa | ||
for overlay_ppa in config_overlay_ppas | ||
if (isinstance(overlay_ppa, dict) and | ||
application in overlay_ppa)] or None | ||
return None | ||
|
||
|
||
|
@@ -144,6 +152,26 @@ def _parse_overlay_ppa_v2(overlay_ppa): | |
'key': overlay_ppa['key']} | ||
|
||
|
||
def _parse_overlay_ppa_v3(overlay_ppa): | ||
"""Parse per application overlay_ppa config. | ||
Example YAML excerpt: | ||
overlay_ppas: | ||
application_name: | ||
- ppa:ubuntu-security-proposed/ppa | ||
other_application_name: | ||
- source: "deb https://user:[email protected]" | ||
key: | | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
.... | ||
-----END PGP PUBLIC KEY BLOCK----- | ||
:param overlay_ppa: Element of overlay_ppas configuration. | ||
:type overlay_ppa: Dict[str,List[Any]] | ||
:returns | ||
""" | ||
# {'application': ['plain', {'source': 'fakesource', 'key': 'fakekey'}]} | ||
|
||
|
||
def parse_overlay_ppa(overlay_ppa): | ||
"""Parse multiple versions of overlay_ppas elements. | ||
|