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
Nicolas Wavrant
slapos
Commits
57c302b7
Commit
57c302b7
authored
Oct 11, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resilient: adds cleanup for the takeover cgi script
parent
4fadb21e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
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
+3
-2
No files found.
stack/resilient/buildout.cfg
View file @
57c302b7
...
...
@@ -96,7 +96,7 @@ output = ${buildout:directory}/instance-frozen.cfg
[resilient-web-takeover-cgi-script-download]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/resilient-web-takeover-cgi-script.py.in
md5sum =
c46c8e3e4ce4376c98ad2fc0e2ff0fe4
md5sum =
56bfa23b31196743a19c4f0b008cd2f6
mode = 0644
destination = ${buildout:directory}/resilient-web-takeover-cgi-script.py.in
...
...
stack/resilient/resilient-web-takeover-cgi-script.py.in
View file @
57c302b7
...
...
@@ -25,8 +25,10 @@ def getLatestBackupDate():
"""
Get the date of the latest successful backup.
"""
# Clean previous runs which may have possibly fail
[shutil.rmtree(file) for file in os.listdir('.') if file.endswith('.tmp')]
# Create a copy of the db (locked by equeue process)
temporary_directory = tempfile.mkdtemp()
temporary_directory = tempfile.mkdtemp(
prefix="cgi-script-data", suffix=".tmp", dir='.'
)
equeue_database_copy = os.path.join(temporary_directory, 'equeue.db')
shutil.copyfile(equeue_database, equeue_database_copy)
db = gdbm.open(equeue_database_copy)
...
...
@@ -42,7 +44,6 @@ def getLatestBackupDate():
if timestamp
<
last
_backup:
last_backup =
timestamp
result =
datetime.datetime.fromtimestamp(last_backup)
db
.
close
()
shutil
.
rmtree
(
temporary_directory
)
return
result
...
...
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