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
f3093cbb
Commit
f3093cbb
authored
Jun 26, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixup previous apt_key patch to enable file based modes to work.
parent
d9eca918
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
library/packaging/apt_key
+13
-6
No files found.
library/packaging/apt_key
View file @
f3093cbb
...
...
@@ -129,9 +129,13 @@ def download_key(module, url):
module
.
fail_json
(
msg
=
"error getting key id from url"
,
traceback
=
format_exc
())
def
add_key
(
module
,
key
):
cmd
=
"apt-key add -"
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
,
data
=
key
,
check_rc
=
True
,
binary_data
=
True
)
def
add_key
(
module
,
keyfile
,
data
=
None
):
if
data
is
not
None
:
cmd
=
"apt-key add -"
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
,
data
=
data
,
check_rc
=
True
,
binary_data
=
True
)
else
:
cmd
=
"apt-key add
%
s"
%
(
keyfile
)
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
,
check_rc
=
True
)
return
True
def
remove_key
(
module
,
key_id
):
...
...
@@ -156,7 +160,7 @@ def main():
key_id
=
module
.
params
[
'id'
]
url
=
module
.
params
[
'url'
]
data
=
module
.
params
[
'data'
]
file
=
module
.
params
[
'file'
]
file
name
=
module
.
params
[
'file'
]
state
=
module
.
params
[
'state'
]
changed
=
False
...
...
@@ -170,14 +174,17 @@ def main():
if
key_id
and
key_id
in
keys
:
module
.
exit_json
(
changed
=
False
)
else
:
if
not
file
and
not
data
:
if
not
file
name
and
not
data
:
data
=
download_key
(
module
,
url
)
if
key_id
and
key_id
in
keys
:
module
.
exit_json
(
changed
=
False
)
else
:
if
module
.
check_mode
:
module
.
exit_json
(
changed
=
True
)
add_key
(
module
,
(
file
if
file
else
"-"
),
data
)
if
filename
:
add_key
(
module
,
filename
)
else
:
add_key
(
module
,
"-"
,
data
)
changed
=
False
keys2
=
all_keys
(
module
)
if
len
(
keys
)
!=
len
(
keys2
):
...
...
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