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
fa6a2503
Commit
fa6a2503
authored
Oct 12, 2016
by
Kevin Falcone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print error message in the case where we return empty
parent
734ce7f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
+4
-1
playbooks/active_instances_in_asg.py
+4
-1
No files found.
playbooks/active_instances_in_asg.py
View file @
fa6a2503
...
...
@@ -19,9 +19,11 @@ ansible -i $(active_instances_in_asg.py --asg stage-edx-edxapp) -m shell -a 'man
"""
from
__future__
import
print_function
import
argparse
import
botocore.session
import
botocore.exceptions
import
sys
from
collections
import
defaultdict
from
os
import
environ
...
...
@@ -57,6 +59,7 @@ class ActiveInventory():
active_groups
[
instances_to_groups
[
instance_id
]]
=
1
if
len
(
active_groups
)
>
1
:
# When we have more than a single active ASG, we need to bail out as we don't know what ASG to pick an instance from
print
(
"Multiple active ASGs - unable to choose an instance"
,
file
=
sys
.
stderr
)
return
else
:
active_groups
=
{
g
[
'AutoScalingGroupName'
]:
1
for
g
in
matching_groups
}
...
...
@@ -66,7 +69,7 @@ class ActiveInventory():
for
group_instance
in
groups_to_instances
[
group
]:
instance
=
ec2
.
describe_instances
(
InstanceIds
=
[
group_instance
])[
'Reservations'
][
0
][
'Instances'
][
0
]
if
'PrivateIpAddress'
in
instance
:
print
"{},"
.
format
(
instance
[
'PrivateIpAddress'
]
)
print
(
"{},"
.
format
(
instance
[
'PrivateIpAddress'
])
)
return
# We only want a single IP
...
...
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