Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
slapos
Commits
a6bd765f
Commit
a6bd765f
authored
Dec 12, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run bang every time ssh failed on pbs promises.
parent
aa9a04db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
slapos/recipe/pbs.py
slapos/recipe/pbs.py
+12
-6
No files found.
slapos/recipe/pbs.py
View file @
a6bd765f
...
@@ -42,6 +42,15 @@ from slapos import slap as slapmodule
...
@@ -42,6 +42,15 @@ from slapos import slap as slapmodule
def
promise
(
args
):
def
promise
(
args
):
def
failed_ssh
(
partition
,
ssh
):
# Bad python 2 syntax, looking forward python 3 to have print(file=)
print
>>
sys
.
stderr
,
"SSH Connection failed"
try
:
ssh
.
terminate
()
except
:
pass
partition
.
bang
(
"SSH Connection failed. rdiff-backup is unusable."
)
def
sigterm_handler
(
signum
,
frame
):
def
sigterm_handler
(
signum
,
frame
):
# Walk up in the stack to get promise local
# Walk up in the stack to get promise local
# variables
# variables
...
@@ -60,18 +69,13 @@ def promise(args):
...
@@ -60,18 +69,13 @@ def promise(args):
# If ever promise function wasn't found in the stack.
# If ever promise function wasn't found in the stack.
if
ssh
is
None
:
if
ssh
is
None
:
raise
SystemExit
raise
SystemExit
failed_ssh
(
partition
,
ssh
)
# Bad python 2 syntax, looking forward python 3 to have print(file=)
print
>>
sys
.
stderr
,
"SSH Connection failed"
ssh
.
terminate
()
partition
.
bang
(
"SSH Connection failed. rdiff-backup is unusable."
)
signal
.
signal
(
signal
.
SIGTERM
,
sigterm_handler
)
signal
.
signal
(
signal
.
SIGTERM
,
sigterm_handler
)
slap
=
slapmodule
.
slap
()
slap
=
slapmodule
.
slap
()
slap
.
initializeConnection
(
args
[
'server_url'
],
slap
.
initializeConnection
(
args
[
'server_url'
],
key_file
=
args
.
get
(
'key_file'
),
cert_file
=
args
.
get
(
'cert_file'
))
key_file
=
args
.
get
(
'key_file'
),
cert_file
=
args
.
get
(
'cert_file'
))
# This is used in sigterm_handler, it get it from the frame.
partition
=
slap
.
registerComputerPartition
(
args
[
'computer_id'
],
partition
=
slap
.
registerComputerPartition
(
args
[
'computer_id'
],
args
[
'partition_id'
])
args
[
'partition_id'
])
...
@@ -88,6 +92,8 @@ def promise(args):
...
@@ -88,6 +92,8 @@ def promise(args):
if
ssh
.
poll
()
is
None
:
if
ssh
.
poll
()
is
None
:
return
1
return
1
if
ssh
.
returncode
!=
0
:
failed_ssh
(
partition
,
ssh
)
return
ssh
.
returncode
return
ssh
.
returncode
...
...
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