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
570f9db6
Commit
570f9db6
authored
Apr 14, 2015
by
Michael Scherer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add/correct missing imports for AnsibleError in v2 lookup plugins
parent
f25f2d96
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
v2/ansible/plugins/lookup/cartesian.py
+2
-2
v2/ansible/plugins/lookup/dict.py
+2
-1
v2/ansible/plugins/lookup/indexed_items.py
+2
-1
No files found.
v2/ansible/plugins/lookup/cartesian.py
View file @
570f9db6
...
@@ -19,7 +19,7 @@ __metaclass__ = type
...
@@ -19,7 +19,7 @@ __metaclass__ = type
from
itertools
import
product
from
itertools
import
product
from
ansible.errors
import
*
from
ansible.errors
import
AnsibleError
from
ansible.plugins.lookup
import
LookupBase
from
ansible.plugins.lookup
import
LookupBase
from
ansible.utils.listify
import
listify_lookup_plugin_terms
from
ansible.utils.listify
import
listify_lookup_plugin_terms
...
@@ -42,7 +42,7 @@ class LookupModule(LookupBase):
...
@@ -42,7 +42,7 @@ class LookupModule(LookupBase):
my_list
=
terms
[:]
my_list
=
terms
[:]
if
len
(
my_list
)
==
0
:
if
len
(
my_list
)
==
0
:
raise
errors
.
AnsibleError
(
"with_cartesian requires at least one element in each list"
)
raise
AnsibleError
(
"with_cartesian requires at least one element in each list"
)
return
[
self
.
_flatten
(
x
)
for
x
in
product
(
*
my_list
,
fillvalue
=
None
)]
return
[
self
.
_flatten
(
x
)
for
x
in
product
(
*
my_list
,
fillvalue
=
None
)]
v2/ansible/plugins/lookup/dict.py
View file @
570f9db6
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
__metaclass__
=
type
from
ansible.errors
import
AnsibleError
from
ansible.plugins.lookup
import
LookupBase
from
ansible.plugins.lookup
import
LookupBase
class
LookupModule
(
LookupBase
):
class
LookupModule
(
LookupBase
):
...
@@ -24,6 +25,6 @@ class LookupModule(LookupBase):
...
@@ -24,6 +25,6 @@ class LookupModule(LookupBase):
def
run
(
self
,
terms
,
varibles
=
None
,
**
kwargs
):
def
run
(
self
,
terms
,
varibles
=
None
,
**
kwargs
):
if
not
isinstance
(
terms
,
dict
):
if
not
isinstance
(
terms
,
dict
):
raise
errors
.
AnsibleError
(
"with_dict expects a dict"
)
raise
AnsibleError
(
"with_dict expects a dict"
)
return
self
.
_flatten_hash_to_list
(
terms
)
return
self
.
_flatten_hash_to_list
(
terms
)
v2/ansible/plugins/lookup/indexed_items.py
View file @
570f9db6
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
__metaclass__
=
type
from
ansible.errors
import
AnsibleError
from
ansible.plugins.lookup
import
LookupBase
from
ansible.plugins.lookup
import
LookupBase
class
LookupModule
(
LookupBase
):
class
LookupModule
(
LookupBase
):
...
@@ -27,7 +28,7 @@ class LookupModule(LookupBase):
...
@@ -27,7 +28,7 @@ class LookupModule(LookupBase):
def
run
(
self
,
terms
,
variables
,
**
kwargs
):
def
run
(
self
,
terms
,
variables
,
**
kwargs
):
if
not
isinstance
(
terms
,
list
):
if
not
isinstance
(
terms
,
list
):
raise
errors
.
AnsibleError
(
"with_indexed_items expects a list"
)
raise
AnsibleError
(
"with_indexed_items expects a list"
)
items
=
self
.
_flatten
(
terms
)
items
=
self
.
_flatten
(
terms
)
return
zip
(
range
(
len
(
items
)),
items
)
return
zip
(
range
(
len
(
items
)),
items
)
...
...
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