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
05644686
Commit
05644686
authored
Oct 04, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in plugin path caching
Fixes #9263
parent
8cecb069
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
+20
-9
lib/ansible/utils/plugins.py
+6
-9
test/integration/non_destructive.yml
+2
-0
test/integration/roles/test_embedded_module/library/test_integration_module
+3
-0
test/integration/roles/test_embedded_module/tasks/main.yml
+9
-0
No files found.
lib/ansible/utils/plugins.py
View file @
05644686
...
...
@@ -94,10 +94,8 @@ class PluginLoader(object):
m
=
__import__
(
self
.
package
)
parts
=
self
.
package
.
split
(
'.'
)[
1
:]
self
.
package_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
m
.
__file__
),
*
parts
)
paths
.
extend
(
self
.
_all_directories
(
self
.
package_path
))
return
paths
else
:
return
[
self
.
package_path
]
paths
.
extend
(
self
.
_all_directories
(
self
.
package_path
))
return
paths
def
_get_paths
(
self
):
''' Return a list of paths to search for plugins in '''
...
...
@@ -105,8 +103,7 @@ class PluginLoader(object):
if
self
.
_paths
is
not
None
:
return
self
.
_paths
ret
=
[]
ret
+=
self
.
_extra_dirs
ret
=
self
.
_extra_dirs
[:]
for
basedir
in
_basedirs
:
fullpath
=
os
.
path
.
realpath
(
os
.
path
.
join
(
basedir
,
self
.
subdir
))
if
os
.
path
.
isdir
(
fullpath
):
...
...
@@ -139,11 +136,9 @@ class PluginLoader(object):
# look for any plugins installed in the package subtree
ret
.
extend
(
self
.
_get_package_paths
())
package_dirs
=
self
.
_get_package_paths
()
# cache and return the result
self
.
_paths
=
ret
return
ret
...
...
@@ -156,7 +151,9 @@ class PluginLoader(object):
if
with_subdir
:
directory
=
os
.
path
.
join
(
directory
,
self
.
subdir
)
if
directory
not
in
self
.
_extra_dirs
:
# append the directory and invalidate the path cache
self
.
_extra_dirs
.
append
(
directory
)
self
.
_paths
=
None
def
find_plugin
(
self
,
name
,
suffixes
=
None
,
transport
=
''
):
''' Find a plugin named name '''
...
...
test/integration/non_destructive.yml
View file @
05644686
...
...
@@ -38,3 +38,5 @@
-
{
role
:
test_script
,
tags
:
test_script
}
-
{
role
:
test_authorized_key
,
tags
:
test_authorized_key
}
-
{
role
:
test_get_url
,
tags
:
test_get_url
}
-
{
role
:
test_embedded_module
,
tags
:
test_embedded_module
}
test/integration/roles/test_embedded_module/library/test_integration_module
0 → 100644
View file @
05644686
#!/usr/bin/env python
print
'{"changed":false, "msg":"this is the embedded module"}'
test/integration/roles/test_embedded_module/tasks/main.yml
0 → 100644
View file @
05644686
-
name
:
run the embedded dummy module
test_integration_module
:
register
:
result
-
name
:
assert the embedded module ran
assert
:
that
:
-
"
'msg'
in
result"
-
result.msg == "this is the embedded module"
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