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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
slapos
Commits
45c226e0
Commit
45c226e0
authored
Jan 13, 2015
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resilient stack: show in takeover script if backup is in progress.
parent
9413f53b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
stack/resilient/buildout.cfg
stack/resilient/buildout.cfg
+1
-1
stack/resilient/resilient-web-takeover-cgi-script.py.in
stack/resilient/resilient-web-takeover-cgi-script.py.in
+11
-1
No files found.
stack/resilient/buildout.cfg
View file @
45c226e0
...
...
@@ -92,7 +92,7 @@ output = ${buildout:directory}/instance-frozen.cfg
[resilient-web-takeover-cgi-script-download]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/resilient-web-takeover-cgi-script.py.in
md5sum =
4e9599736dbbba9eb466cd0e4d78368d
md5sum =
5c90dae56885eeb490cc5d7f82d2dc5b
mode = 0644
destination = ${buildout:directory}/resilient-web-takeover-cgi-script.py.in
...
...
stack/resilient/resilient-web-takeover-cgi-script.py.in
View file @
45c226e0
#!${buildout:executable}
equeue_database = '${equeue:database}'
equeue_lockfile = '${equeue:lockfile}'
import cgi
import cgitb
...
...
@@ -32,6 +33,14 @@ def getLatestBackupDate():
last_backup =
timestamp
return
datetime
.
datetime
.
fromtimestamp
(
last_backup
)
def
isBackupInProgress
()
:
"""
Check
if
backup
is
in
progress
(
importer
script
is
running
)
by
checking
if
equeue
lockfile
exists
.
"""
#
XXX:
check
if
file
is
valid
return
os
.
path
.
exists
(
equeue_lockfile
)
print
"
Content-Type:
text
/
html
"
print
...
...
@@ -44,12 +53,13 @@ if "password" not in form:
<p><b>
Warning: submit the form only if you understand what you are doing.
</b></p>
<p>
Note: the password asked here can be found within the parameters of your SlapOS instance page.
</p>
<p>
Last valid backup: %s
</p>
<p>
Importer script(s) of backup in progress: %s
</p>
<form
action=
"/"
>
Password:
<input
type=
"text"
name=
"password"
>
<input
type=
"submit"
value=
"Take over"
style=
"background: red;"
>
</form>
</body>
</html>
""" %
getLatestBackupDate().strftime('%Y-%m-%d %H:%M:%S'
)
</html>
""" %
(getLatestBackupDate().strftime('%Y-%m-%d %H:%M:%S'), isBackupInProgress()
)
sys.exit(0)
if form['password'].value != '${:password}':
...
...
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