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
dbb0304c
Commit
dbb0304c
authored
Jun 14, 2015
by
Victor Schröder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds uncammelize helper method to put the labels in the expected output format
parent
c6f2b08a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
plugins/inventory/ec2.py
+8
-5
No files found.
plugins/inventory/ec2.py
View file @
dbb0304c
...
...
@@ -880,19 +880,19 @@ class Ec2Inventory(object):
host_info
=
{}
for
key
in
describe_dict
:
value
=
describe_dict
[
key
]
key
=
self
.
to_safe
(
'ec2_'
+
key
)
key
=
self
.
to_safe
(
'ec2_'
+
self
.
uncammelize
(
key
)
)
# Handle complex types
if
key
==
'ec2_
ConfigurationE
ndpoint'
and
value
:
if
key
==
'ec2_
configuration_e
ndpoint'
and
value
:
host_info
[
'ec2_configuration_endpoint_address'
]
=
value
[
'Address'
]
host_info
[
'ec2_configuration_endpoint_port'
]
=
value
[
'Port'
]
if
key
==
'ec2_
E
ndpoint'
and
value
:
if
key
==
'ec2_
e
ndpoint'
and
value
:
host_info
[
'ec2_endpoint_address'
]
=
value
[
'Address'
]
host_info
[
'ec2_endpoint_port'
]
=
value
[
'Port'
]
elif
key
==
'ec2_
CacheParameterG
roup'
:
elif
key
==
'ec2_
cache_parameter_g
roup'
:
host_info
[
'ec2_cache_parameter_group_name'
]
=
value
[
'CacheParameterGroupName'
]
host_info
[
'ec2_cache_parameter_apply_status'
]
=
value
[
'ParameterApplyStatus'
]
elif
key
==
'ec2_
SecurityG
roups'
:
elif
key
==
'ec2_
security_g
roups'
:
sg_ids
=
[]
for
sg
in
value
:
sg_ids
.
append
(
sg
[
'SecurityGroupId'
])
...
...
@@ -972,6 +972,9 @@ class Ec2Inventory(object):
cache
.
write
(
json_data
)
cache
.
close
()
def
uncammelize
(
self
,
key
):
temp
=
re
.
sub
(
'(.)([A-Z][a-z]+)'
,
r'\1_\2'
,
key
)
return
re
.
sub
(
'([a-z0-9])([A-Z])'
,
r'\1_\2'
,
temp
)
.
lower
()
def
to_safe
(
self
,
word
):
''' Converts 'bad' characters in a string to underscores so they can be
...
...
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