Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
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
edx
configuration
Commits
1f401432
Commit
1f401432
authored
Sep 16, 2014
by
e0d
Committed by
Feanil Patel
May 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing camel case
parent
21832855
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
playbooks/library/util_map
+6
-6
No files found.
playbooks/library/util_map
View file @
1f401432
...
...
@@ -11,7 +11,7 @@ author: Edward Zarecor
options:
function:
description:
- The function to apply, currently ['zip
ToD
ict','flatten']
- The function to apply, currently ['zip
_to_d
ict','flatten']
required: true
input:
description:
...
...
@@ -25,7 +25,7 @@ options:
EXAMPLES
=
'''
- name: Apply function to results from ec2_scaling_policies
util_map:
function: 'zip
ToD
ict'
function: 'zip
_to_d
ict'
input: "{{ created_policies.results }}"
args:
- "name"
...
...
@@ -74,7 +74,7 @@ def flatten(module, input):
module
.
exit_json
(
function_output
=
flat
)
def
zip
ToD
ict
(
module
,
input
,
key_key
,
value_key
):
def
zip
_to_d
ict
(
module
,
input
,
key_key
,
value_key
):
"""
Takes an array of dicts and flattens it to a single dict by extracting the values
of a provided key as the keys in the new dict and the values of the second
...
...
@@ -106,7 +106,7 @@ def zipToDict(module, input, key_key, value_key):
def
main
():
arg_spec
=
dict
(
function
=
dict
(
required
=
True
,
choices
=
[
'zip
ToD
ict'
,
'flatten'
]),
function
=
dict
(
required
=
True
,
choices
=
[
'zip
_to_d
ict'
,
'flatten'
]),
input
=
dict
(
required
=
True
,
type
=
'str'
),
args
=
dict
(
required
=
False
,
type
=
'list'
),
)
...
...
@@ -118,8 +118,8 @@ def main():
input
=
ast
.
literal_eval
(
module
.
params
.
get
(
'input'
))
args
=
module
.
params
.
get
(
'args'
)
if
target
==
'zip
ToD
ict'
:
zip
ToD
ict
(
module
,
input
,
*
args
)
if
target
==
'zip
_to_d
ict'
:
zip
_to_d
ict
(
module
,
input
,
*
args
)
elif
target
==
'flatten'
:
flatten
(
module
,
input
)
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