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
10a0f03c
Commit
10a0f03c
authored
Aug 13, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up of apt_repository module and removing wget parts
parent
de404eac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
32 deletions
+9
-32
library/packaging/apt_repository
+9
-32
No files found.
library/packaging/apt_repository
View file @
10a0f03c
...
...
@@ -30,7 +30,6 @@ notes:
- This module works on Debian and Ubuntu and requires only C(python-apt) package.
- This module supports Debian Squeeze (version 6) as well as its successors.
- This module treats Debian and Ubuntu distributions separately. So PPA could be installed only on Ubuntu machines.
- For PPA support you either need python-pycurl or wget on the client.
options:
repo:
required: true
...
...
@@ -45,7 +44,7 @@ options:
- A source string state.
author: Alexander Saltanov
version_added: "0.7"
requirements: [ python-apt ]
requirements: [ python-apt
, python-pycurl
]
'''
EXAMPLES
=
'''
...
...
@@ -67,7 +66,6 @@ import glob
import
json
import
os
import
re
import
subprocess
import
tempfile
try
:
...
...
@@ -78,6 +76,11 @@ try:
except
ImportError
:
HAVE_PYTHON_APT
=
False
try
:
import
pycurl
HAVE_PYCURL
=
True
except
ImportError
:
HAVE_PYCURL
=
False
VALID_SOURCE_TYPES
=
(
'deb'
,
'deb-src'
)
...
...
@@ -94,15 +97,6 @@ class InvalidSource(Exception):
pass
def
get_executable_from_path
(
cmd
):
full_path
=
[
os
.
path
.
join
(
p
,
cmd
)
for
p
in
os
.
environ
.
get
(
"PATH"
,
""
)
.
split
(
":"
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
p
,
cmd
))]
if
full_path
:
return
full_path
[
0
]
return
None
# Simple version of aptsources.sourceslist.SourcesList.
# No advanced logic and no backups inside.
class
SourcesList
(
object
):
...
...
@@ -272,20 +266,9 @@ class UbuntuSourcesList(SourcesList):
def
_get_ppa_info
(
self
,
owner_name
,
ppa_name
):
# we can not use urllib2 here as it does not do cert verification
lp_api
=
self
.
LP_API
%
(
owner_name
,
ppa_name
)
try
:
return
self
.
_get_ppa_info_curl
(
lp_api
)
except
ImportError
:
return
self
.
_get_ppa_info_wget
(
lp_api
)
def
_get_ppa_info_wget
(
self
,
lp_api
):
wget
=
get_executable_from_path
(
"wget"
)
p
=
subprocess
.
Popen
([
wget
,
"-q"
,
"-O"
,
"-"
,
"--header=Accept: application/json"
,
lp_api
],
stdout
=
subprocess
.
PIPE
)
return
json
.
loads
(
p
.
communicate
()[
0
])
return
self
.
_get_ppa_info_curl
(
lp_api
)
def
_get_ppa_info_curl
(
self
,
lp_api
):
import
pycurl
callback
=
CurlCallback
()
curl
=
pycurl
.
Curl
()
curl
.
setopt
(
pycurl
.
SSL_VERIFYPEER
,
1
)
...
...
@@ -351,14 +334,8 @@ def main():
if
not
HAVE_PYTHON_APT
:
module
.
fail_json
(
msg
=
'Could not import python modules: apt_pkg. Please install python-apt package.'
)
# see if we have something that can download from https with cert
# checking
try
:
import
pycurl
except
ImportError
:
wget
=
get_executable_from_path
(
"wget"
)
if
not
wget
:
module
.
fail_json
(
msg
=
"Need the python-pycurl or wget package"
)
if
not
HAVE_PYCURL
:
module
.
fail_json
(
msg
=
'Could not import python modules: pycurl. Please install python-pycurl package.'
)
repo
=
module
.
params
[
'repo'
]
state
=
module
.
params
[
'state'
]
...
...
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