-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #1145 - Move issues.db to backup location configured in secrets.py #1157
Conversation
r? @miketaylr |
@@ -12,6 +12,10 @@ uploads/ | |||
.idea/ | |||
config/secrets.py | |||
|
|||
# backup folder contains the issues.db backup file with issues dump | |||
#for the previous version of schema |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Note to self: it shouldn't be possible to download this backup over the web. Double check on staging that this is the case (it should be, according to https://github.com/webcompat/webcompat.com/blob/master/CONTRIBUTING.md#production-server-setup) |
elif STAGING: | ||
BACKUP_DEFAULT_DEST = '' | ||
BACKUP_DEFAULT_URL = '' | ||
elif LOCALHOST: |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Can we squash the "fixing merge conflicts" commit into the first one? Thanks! |
71a8587
to
1e6f8c3
Compare
…shell commands
try: | ||
os.remove(os.path.join(os.getcwd(), 'issues.db')) | ||
except OSError: | ||
print 'Backup issues.db complete' |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
else: | ||
print 'Backup db folder exists' | ||
current_ts = time.time() | ||
time_stamp = datetime.datetime.fromtimestamp(current_ts).strftime('%Y-%m-%d-%H:%M:%S') |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
print idx | ||
if idx < no_of_backup_files - 3: | ||
os.remove(app.config['BACKUP_DEFAULT_DEST'] + val) | ||
backup_files = os.listdir(app.config['BACKUP_DEFAULT_DEST']) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
bind=issue_engine) | ||
issue_db = scoped_session(issue_session_maker) | ||
# Take a backup if issues.db has data dump. | ||
if issue_db().execute('select count(*) from webcompat_issues').fetchall()[0][0] > 0: |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
d672da7
to
90f8ad2
Compare
r? @karlcow |
bind=issue_engine) | ||
issue_db = scoped_session(issue_session_maker) | ||
# Take a backup if issues.db has data dump. | ||
# TODO: write code for creating issues dump in the issues.db with updated schema |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
it's in a lot better shape. Thanks @deepthivenkat |
@@ -12,6 +12,10 @@ uploads/ | |||
.idea/ | |||
config/secrets.py | |||
|
|||
# backup folder contains the issues.db backup file with issues dump | |||
# for the previous version of schema |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
LGTM, just need to update some comments and tweak the print stuff! |
90f8ad2
to
b2d0c38
Compare
Trying to run this locally with |
@miketaylr The backup folder will get created only if the issues.db has a data dump. I have also made the comment change in secrets.py.example and have run pep8. Ready for merging :) |
b2d0c38
to
7ea106f
Compare
Ah, OK! I think we should add some print statements so it's less confusing like: "Not doing a backup because there's nothing to back up!" (or whatever). But let's file a follow-up issue for that. |
We can ignore travis failures here, seems good to merge. 👍 |
Oops, forgot that we should have had a "Fixes #1145" in the PR title. Something to remember for the future @deepthivenkat :) |
Follow-up of issue webcompat#1157, print message if there is nothing to backup to BACKUP_DEFAULT_DEST Issue webcompat#1294 - Check BAKCUP_DEFAULT_DEST before backup Also fix the syntax, no warning using PEP8 check.
Follow-up of issue webcompat#1157, print message if there is nothing to backup to BACKUP_DEFAULT_DEST Issue webcompat#1294 - Check BAKCUP_DEFAULT_DEST before backup Also fix the syntax, no warning using PEP8 check.
Follow-up of issue webcompat#1157, print message if there is nothing to backup to BACKUP_DEFAULT_DEST Issue webcompat#1294 - Check BAKCUP_DEFAULT_DEST before backup Also fix the syntax, no warning using PEP8 check.
Follow-up of issue webcompat#1157, print message if there is nothing to backup to BACKUP_DEFAULT_DEST Issue webcompat#1294 - Check BAKCUP_DEFAULT_DEST before backup Also fix the syntax, no warning using PEP8 check.
No description provided.