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
db36c41c
Commit
db36c41c
authored
Apr 14, 2014
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addresses #6908 Strip usernames and passwords from apt_repository filenames
parent
f6190015
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
library/packaging/apt_repository
+11
-0
No files found.
library/packaging/apt_repository
View file @
db36c41c
...
...
@@ -133,12 +133,22 @@ class SourcesList(object):
def
_suggest_filename
(
self
,
line
):
def
_cleanup_filename
(
s
):
return
'_'
.
join
(
re
.
sub
(
'[^a-zA-Z0-9]'
,
' '
,
s
)
.
split
())
def
_strip_username_password
(
s
):
if
'@'
in
s
:
s
=
s
.
split
(
'@'
,
1
)
s
=
s
[
-
1
]
return
s
# Drop options and protocols.
line
=
re
.
sub
(
'
\
[[^
\
]]+
\
]'
,
''
,
line
)
line
=
re
.
sub
(
'
\
w+://'
,
''
,
line
)
# split line into valid keywords
parts
=
[
part
for
part
in
line
.
split
()
if
part
not
in
VALID_SOURCE_TYPES
]
# Drop usernames and passwords
parts
[
0
]
=
_strip_username_password
(
parts
[
0
])
return
'
%
s.list'
%
_cleanup_filename
(
' '
.
join
(
parts
[:
1
]))
def
_parse
(
self
,
line
,
raise_if_invalid_or_disabled
=
False
):
...
...
@@ -358,6 +368,7 @@ def main():
install_python_apt
(
module
)
repo
=
module
.
params
[
'repo'
]
open
(
"/tmp/awx.log"
,
"a"
)
.
write
(
"repo:
%
s
\n
"
%
repo
)
state
=
module
.
params
[
'state'
]
update_cache
=
module
.
params
[
'update_cache'
]
sourceslist
=
None
...
...
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