Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
b811df38
Commit
b811df38
authored
Aug 11, 2014
by
Jeppe Toustrup
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apt_repository: Check if key already exists before trying to add it for a speed increase
parent
e90d2573
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
library/packaging/apt_repository
+7
-2
No files found.
library/packaging/apt_repository
View file @
b811df38
...
...
@@ -335,14 +335,19 @@ class UbuntuSourcesList(SourcesList):
line
=
'deb http://ppa.launchpad.net/
%
s/
%
s/ubuntu
%
s main'
%
(
ppa_owner
,
ppa_name
,
distro
.
codename
)
return
line
,
ppa_owner
,
ppa_name
def
_key_already_exists
(
self
,
key_fingerprint
):
rc
,
out
,
err
=
self
.
module
.
run_command
(
'apt-key export
%
s'
%
key_fingerprint
,
check_rc
=
True
)
return
len
(
err
)
==
0
def
add_source
(
self
,
line
,
comment
=
''
,
file
=
None
):
if
line
.
startswith
(
'ppa:'
):
source
,
ppa_owner
,
ppa_name
=
self
.
_expand_ppa
(
line
)
if
self
.
add_ppa_signing_keys_callback
is
not
None
:
info
=
self
.
_get_ppa_info
(
ppa_owner
,
ppa_name
)
command
=
[
'apt-key'
,
'adv'
,
'--recv-keys'
,
'--keyserver'
,
'hkp://keyserver.ubuntu.com:80'
,
info
[
'signing_key_fingerprint'
]]
self
.
add_ppa_signing_keys_callback
(
command
)
if
not
self
.
_key_already_exists
(
info
[
'signing_key_fingerprint'
]):
command
=
[
'apt-key'
,
'adv'
,
'--recv-keys'
,
'--keyserver'
,
'hkp://keyserver.ubuntu.com:80'
,
info
[
'signing_key_fingerprint'
]]
self
.
add_ppa_signing_keys_callback
(
command
)
file
=
file
or
self
.
_suggest_filename
(
'
%
s_
%
s'
%
(
line
,
distro
.
codename
))
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment