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
d75b4cd1
Commit
d75b4cd1
authored
Jul 28, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11006 from alexlo03/ec2_inventory_clear_errors
explain source of EC2 inventory error
parents
7a019d93
7092021d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
contrib/inventory/ec2.py
+10
-7
No files found.
contrib/inventory/ec2.py
View file @
d75b4cd1
...
...
@@ -406,7 +406,7 @@ class Ec2Inventory(object):
else
:
backend
=
'Eucalyptus'
if
self
.
eucalyptus
else
'AWS'
error
=
"Error connecting to
%
s backend.
\n
%
s"
%
(
backend
,
e
.
message
)
self
.
fail_with_error
(
error
)
self
.
fail_with_error
(
error
,
'getting EC2 instances'
)
def
get_rds_instances_by_region
(
self
,
region
):
''' Makes an AWS API call to the list of RDS instances in a particular
...
...
@@ -425,7 +425,7 @@ class Ec2Inventory(object):
error
=
self
.
get_auth_error_message
()
if
not
e
.
reason
==
"Forbidden"
:
error
=
"Looks like AWS RDS is down:
\n
%
s"
%
e
.
message
self
.
fail_with_error
(
error
)
self
.
fail_with_error
(
error
,
'getting RDS instances'
)
def
get_elasticache_clusters_by_region
(
self
,
region
):
''' Makes an AWS API call to the list of ElastiCache clusters (with
...
...
@@ -448,7 +448,7 @@ class Ec2Inventory(object):
error
=
self
.
get_auth_error_message
()
if
not
e
.
reason
==
"Forbidden"
:
error
=
"Looks like AWS ElastiCache is down:
\n
%
s"
%
e
.
message
self
.
fail_with_error
(
error
)
self
.
fail_with_error
(
error
,
'getting ElastiCache clusters'
)
try
:
# Boto also doesn't provide wrapper classes to CacheClusters or
...
...
@@ -458,7 +458,7 @@ class Ec2Inventory(object):
except
KeyError
as
e
:
error
=
"ElastiCache query to AWS failed (unexpected format)."
self
.
fail_with_error
(
error
)
self
.
fail_with_error
(
error
,
'getting ElastiCache clusters'
)
for
cluster
in
clusters
:
self
.
add_elasticache_cluster
(
cluster
,
region
)
...
...
@@ -482,7 +482,7 @@ class Ec2Inventory(object):
error
=
self
.
get_auth_error_message
()
if
not
e
.
reason
==
"Forbidden"
:
error
=
"Looks like AWS ElastiCache [Replication Groups] is down:
\n
%
s"
%
e
.
message
self
.
fail_with_error
(
error
)
self
.
fail_with_error
(
error
,
'getting ElastiCache clusters'
)
try
:
# Boto also doesn't provide wrapper classes to ReplicationGroups
...
...
@@ -492,7 +492,7 @@ class Ec2Inventory(object):
except
KeyError
as
e
:
error
=
"ElastiCache [Replication Groups] query to AWS failed (unexpected format)."
self
.
fail_with_error
(
error
)
self
.
fail_with_error
(
error
,
'getting ElastiCache clusters'
)
for
replication_group
in
replication_groups
:
self
.
add_elasticache_replication_group
(
replication_group
,
region
)
...
...
@@ -514,8 +514,11 @@ class Ec2Inventory(object):
return
'
\n
'
.
join
(
errors
)
def
fail_with_error
(
self
,
err_msg
):
def
fail_with_error
(
self
,
err_msg
,
err_operation
=
None
):
'''log an error to std err for ansible-playbook to consume and exit'''
if
err_operation
:
err_msg
=
'ERROR: "{err_msg}", while: {err_operation}'
.
format
(
err_msg
=
err_msg
,
err_operation
=
err_operation
)
sys
.
stderr
.
write
(
err_msg
)
sys
.
exit
(
1
)
...
...
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