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
88e4051a
Commit
88e4051a
authored
Oct 16, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1351 from cocoy/ec2-v2
Fix check boto version bug #1280. Using try/except for AttributeError.
parents
c16572b6
8344511e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
plugins/inventory/ec2.py
+11
-5
No files found.
plugins/inventory/ec2.py
View file @
88e4051a
#!/usr/bin/
python -tt
#!/usr/bin/
env python
'''
EC2 external inventory script
...
...
@@ -108,6 +108,7 @@ Security groups are comma-separated in 'ec2_security_group_ids' and
######################################################################
import
sys
import
os
import
argparse
import
re
...
...
@@ -132,7 +133,7 @@ class Ec2Inventory(object):
# Index of hostname (address) to instance ID
self
.
index
=
{}
# Read settings and parse CLI arguments
self
.
read_settings
()
self
.
parse_cli_args
()
...
...
@@ -292,9 +293,14 @@ class Ec2Inventory(object):
self
.
push
(
self
.
inventory
,
instance
.
placement
,
dest
)
# Inventory: Group by security group
for
group
in
instance
.
groups
:
key
=
self
.
to_safe
(
"security_group_"
+
group
.
name
)
self
.
push
(
self
.
inventory
,
key
,
dest
)
try
:
for
group
in
instance
.
groups
:
key
=
self
.
to_safe
(
"security_group_"
+
group
.
name
)
self
.
push
(
self
.
inventory
,
key
,
dest
)
except
AttributeError
:
print
'Package boto seems a bit older.'
print
'Please upgrade boto >= 2.3.0.'
sys
.
exit
(
1
)
# Inventory: Group by tag keys
for
k
,
v
in
instance
.
tags
.
iteritems
():
...
...
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