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
07fcb50b
Commit
07fcb50b
authored
Aug 07, 2015
by
Yannig Perré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Porting ini lookup plugin against ansible v2.
parent
09d257e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
lib/ansible/plugins/lookup/ini.py
+11
-9
No files found.
lib/ansible/plugins/lookup/ini.py
View file @
07fcb50b
...
...
@@ -14,19 +14,19 @@
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
from
ansible
import
utils
,
errors
import
StringIO
import
os
import
codecs
import
ConfigParser
import
re
class
LookupModule
(
object
):
from
ansible.errors
import
*
from
ansible.plugins.lookup
import
LookupBase
def
__init__
(
self
,
basedir
=
None
,
**
kwargs
):
self
.
basedir
=
basedir
self
.
cp
=
ConfigParser
.
ConfigParser
()
class
LookupModule
(
LookupBase
):
def
read_properties
(
self
,
filename
,
key
,
dflt
,
is_regexp
):
config
=
StringIO
.
StringIO
()
...
...
@@ -51,13 +51,15 @@ class LookupModule(object):
return
dflt
return
value
def
run
(
self
,
terms
,
inject
=
None
,
**
kwargs
):
terms
=
utils
.
listify_lookup_plugin_terms
(
terms
,
self
.
basedir
,
inject
)
def
run
(
self
,
terms
,
variables
=
None
,
**
kwargs
):
if
isinstance
(
terms
,
basestring
):
terms
=
[
terms
]
basedir
=
self
.
get_basedir
(
variables
)
self
.
basedir
=
basedir
self
.
cp
=
ConfigParser
.
ConfigParser
()
ret
=
[]
for
term
in
terms
:
params
=
term
.
split
()
...
...
@@ -80,7 +82,7 @@ class LookupModule(object):
except
(
ValueError
,
AssertionError
),
e
:
raise
errors
.
AnsibleError
(
e
)
path
=
utils
.
path_dwim
(
self
.
basedir
,
paramvals
[
'file'
])
path
=
self
.
_loader
.
path_dwim_relative
(
basedir
,
'files'
,
paramvals
[
'file'
])
if
paramvals
[
'type'
]
==
"properties"
:
var
=
self
.
read_properties
(
path
,
key
,
paramvals
[
'default'
],
paramvals
[
're'
])
else
:
...
...
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