-
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.
Merge pull request #663 from javacruft/feat/private-ppas
Add support for Private PPA
- Loading branch information
Showing
2 changed files
with
48 additions
and
5 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
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 |
---|---|---|
|
@@ -105,6 +105,18 @@ def get_overlay_ppas(model_alias='default_alias'): | |
overlay_ppas: | ||
- ppa:ubuntu-security-proposed/ppa | ||
alternatively more complex sources can also be used (for | ||
example when accessing a Private PPA): | ||
tests_options: | ||
model_alias: | ||
overlay_ppas: | ||
- source: "deb https://user:[email protected]" | ||
key: | | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
.... | ||
-----END PGP PUBLIC KEY BLOCK----- | ||
:param model: Name of model alias | ||
:type bundle: str | ||
:returns: List of overlay PPAs | ||
|
@@ -145,9 +157,18 @@ def get_cloudinit_userdata(model_alias='default_alias'): | |
overlay_ppas = get_overlay_ppas(model_alias) | ||
if overlay_ppas: | ||
for index, overlay_ppa in enumerate(overlay_ppas): | ||
cloud_config['apt']['sources']["overlay-ppa-{}".format(index)] = { | ||
'source': overlay_ppa | ||
} | ||
try: | ||
# NOTE: support private PPAs with source and key keys. | ||
cloud_config['apt']['sources']["overlay-ppa-{}".format(index)] = { # noqa | ||
'source': overlay_ppa['source'], | ||
'key': overlay_ppa['key'], | ||
} | ||
except (KeyError, TypeError): | ||
# NOTE: simple ppa:xxx/yyy format for backwards compatibility | ||
cloud_config['apt']['sources']["overlay-ppa-{}".format(index)] = { # noqa | ||
'source': overlay_ppa | ||
} | ||
|
||
cloudinit_userdata = "#cloud-config\n{}".format( | ||
yaml.safe_dump(cloud_config)) | ||
return cloudinit_userdata | ||
|