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
OpenEdx
configuration
Commits
e7805146
Commit
e7805146
authored
Sep 12, 2014
by
e0d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
method arg bug
parent
2fa7cf63
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
util/vpc-tools/asg_lifcycle_watcher.py
+9
-10
No files found.
util/vpc-tools/asg_lifcycle_watcher.py
View file @
e7805146
...
@@ -83,11 +83,7 @@ class LifecycleHandler:
...
@@ -83,11 +83,7 @@ class LifecycleHandler:
self
.
continue_lifecycle
(
asg
,
token
,
self
.
hook
)
self
.
continue_lifecycle
(
asg
,
token
,
self
.
hook
)
if
not
self
.
dry_run
:
self
.
delete_sqs_message
(
queue
,
sqs_message
,
as_message
,
self
.
dry_run
)
logging
.
info
(
"Deleting message with body {message}"
.
format
(
message
=
as_message
))
self
.
sqs_con
.
delete_message
(
queue
,
sqs_message
)
else
:
logging
.
info
(
"Would have deleted message with body {message}"
.
format
(
message
=
as_message
))
else
:
else
:
logging
.
info
(
"Recording lifecycle heartbeat for instance {instance}"
.
format
(
logging
.
info
(
"Recording lifecycle heartbeat for instance {instance}"
.
format
(
...
@@ -98,18 +94,18 @@ class LifecycleHandler:
...
@@ -98,18 +94,18 @@ class LifecycleHandler:
logging
.
exception
(
mhe
)
logging
.
exception
(
mhe
)
# There is nothing we can do to recover from this, so we
# There is nothing we can do to recover from this, so we
# still delete the message
# still delete the message
self
.
delete_sqs_message
(
self
,
queue
,
sqs_message
,
as_message
)
self
.
delete_sqs_message
(
queue
,
sqs_message
,
as_message
,
self
.
dry_run
)
# These notifications are sent when configuring a new lifecycle hook, they can be
# These notifications are sent when configuring a new lifecycle hook, they can be
# deleted safely
# deleted safely
elif
as_message
[
'Event'
]
==
LifecycleHandler
.
TEST_NOTIFICATION
:
elif
as_message
[
'Event'
]
==
LifecycleHandler
.
TEST_NOTIFICATION
:
self
.
delete_sqs_message
(
self
,
queue
,
sqs_message
,
as_message
)
self
.
delete_sqs_message
(
queue
,
sqs_message
,
as_message
,
self
.
dry_run
)
else
:
else
:
raise
NotImplemented
(
"Encountered message, {message_id}, of unexpected type."
.
format
(
raise
NotImplemented
(
"Encountered message, {message_id}, of unexpected type."
.
format
(
message_id
=
as_message
[
'MessageId'
]))
message_id
=
as_message
[
'MessageId'
]))
def
delete_sqs_message
(
self
,
queue
,
sqs_message
,
as_message
,
dry_run
):
def
delete_sqs_message
(
self
,
queue
,
sqs_message
,
as_message
,
dry_run
):
if
not
self
.
dry_run
:
if
not
dry_run
:
logging
.
info
(
"Deleting message with body {message}"
.
format
(
message
=
as_message
))
logging
.
info
(
"Deleting message with body {message}"
.
format
(
message
=
as_message
))
self
.
sqs_con
.
delete_message
(
queue
,
sqs_message
)
self
.
sqs_con
.
delete_message
(
queue
,
sqs_message
)
else
:
else
:
...
@@ -135,15 +131,18 @@ class LifecycleHandler:
...
@@ -135,15 +131,18 @@ class LifecycleHandler:
def
run_subprocess_command
(
self
,
command
,
dry_run
):
def
run_subprocess_command
(
self
,
command
,
dry_run
):
logging
.
info
(
"Running command {command}."
.
format
(
command
=
command
)
)
message
=
"Running command {command}."
.
format
(
command
=
command
)
if
not
dry_run
:
if
not
dry_run
:
logging
.
info
(
message
)
try
:
try
:
output
=
subprocess
.
check_output
(
command
.
split
(
' '
))
output
=
subprocess
.
check_output
(
command
.
split
(
' '
))
logging
.
info
(
"Output was {output}"
.
format
(
output
=
output
))
logging
.
info
(
"Output was {output}"
.
format
(
output
=
output
))
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
exception
(
e
)
logging
.
exception
(
e
)
raise
e
raise
e
else
:
logging
.
info
(
"Dry run: {message}"
.
format
(
message
=
message
))
def
get_ec2_instance_by_id
(
self
,
instance_id
):
def
get_ec2_instance_by_id
(
self
,
instance_id
):
"""
"""
...
...
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