mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-11 02:21:33 +00:00
Add support for specifying the GPG fingerprint for private PPAs.
This commit is contained in:
parent
4472b83de9
commit
2de94184b3
@ -147,8 +147,10 @@ class AutopkgtestPolicy(BasePolicy):
|
|||||||
|
|
||||||
self.swift_container = 'autopkgtest-' + options.series
|
self.swift_container = 'autopkgtest-' + options.series
|
||||||
if self.options.adt_ppas:
|
if self.options.adt_ppas:
|
||||||
# private PPAs require the auth credentials given
|
# private PPAs require the auth credentials given + we allow the
|
||||||
self.swift_container += '-' + options.adt_ppas[-1].rpartition('@')[2].replace('/', '-')
|
# PPA fingerprint attached at the end
|
||||||
|
# those need to be removed before the ppa-based name can be used
|
||||||
|
self.swift_container += '-' + options.adt_ppas[-1].rpartition('@')[2].replace('/', '-').partition(':')[0]
|
||||||
|
|
||||||
# restrict adt_arches to architectures we actually run for
|
# restrict adt_arches to architectures we actually run for
|
||||||
self.adt_arches = []
|
self.adt_arches = []
|
||||||
@ -207,6 +209,18 @@ class AutopkgtestPolicy(BasePolicy):
|
|||||||
not self.options.adt_swift_tenant):
|
not self.options.adt_swift_tenant):
|
||||||
raise RuntimeError('Incomplete swift credentials given')
|
raise RuntimeError('Incomplete swift credentials given')
|
||||||
|
|
||||||
|
# once swift credentials are given, the results will be published
|
||||||
|
# to a private container
|
||||||
|
self.swift_container = 'private-' + self.swift_container
|
||||||
|
|
||||||
|
# check if all private PPAs have a fingerprint provided
|
||||||
|
# private PPAs need to follow the following pattern:
|
||||||
|
# user:token@team/name:fingerprint
|
||||||
|
for ppa in self.options.adt_ppas:
|
||||||
|
# TODO: write a test for this
|
||||||
|
if '@' in ppa and not re.match(r'^.+:.+@.+:.+$', ppa):
|
||||||
|
raise RuntimeError('Private PPA %s not following required format (user:token@team/name:fingerprint)', ppa)
|
||||||
|
|
||||||
import swiftclient
|
import swiftclient
|
||||||
|
|
||||||
if '/v2.0' in self.options.adt_swift_auth_url:
|
if '/v2.0' in self.options.adt_swift_auth_url:
|
||||||
@ -214,7 +228,7 @@ class AutopkgtestPolicy(BasePolicy):
|
|||||||
else:
|
else:
|
||||||
auth_version = '1'
|
auth_version = '1'
|
||||||
|
|
||||||
self.logger.info('Creating an authenticated swift connection for user %s', self.adt_swift_user)
|
self.logger.info('Creating an authenticated swift connection for user %s', self.options.adt_swift_user)
|
||||||
self.swift_conn = swiftclient.Connection(
|
self.swift_conn = swiftclient.Connection(
|
||||||
authurl=self.options.adt_swift_auth_url,
|
authurl=self.options.adt_swift_auth_url,
|
||||||
user=self.options.adt_swift_user,
|
user=self.options.adt_swift_user,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user