Skip to content
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

Use UTC time and ISO 8601 #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions makesnapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
else:
if sys.argv[1]=='day':
run = 'day'
date_suffix = datetime.today().strftime('%a')
date_suffix = datetime.utcnow().strftime('%a')
elif sys.argv[1]=='week':
run = 'week'
date_suffix = datetime.today().strftime('%U')
date_suffix = datetime.utcnow().strftime('%U')
elif sys.argv[1]=='month':
run = 'month'
date_suffix = datetime.today().strftime('%b')
date_suffix = datetime.utcnow().strftime('%b')
else:
print('Please use the parameter day, week or month')
quit()
Expand All @@ -58,7 +58,7 @@

# Setup the logging
logging.basicConfig(filename=config['log_file'], level=logging.INFO)
start_message = 'Start making ' + run + ' snapshots at ' + datetime.today().strftime('%d-%m-%Y %H:%M:%S')
start_message = 'Start making ' + run + ' snapshots at ' + datetime.utcnow().isoformat()
message += start_message + "\n" + "\n"
logging.info(start_message)

Expand Down Expand Up @@ -120,7 +120,7 @@
count_total += 1
logging.info(vol)
print vol
description = run + '_snapshot ' + vol.id + '_' + run + '_' + date_suffix + ' by snapshot script at ' + datetime.today().strftime('%d-%m-%Y %H:%M:%S')
description = run + '_snapshot ' + vol.id + '_' + run + '_' + date_suffix + ' by snapshot script at ' + datetime.utcnow().isoformat()
if vol.create_snapshot(description):
suc_message = 'Snapshot created with description: ' + description
print ' ' + suc_message
Expand Down Expand Up @@ -173,7 +173,7 @@ def date_compare(snap1, snap2):
else:
count_succes +=1

result= '\nFinished making snapshots at ' + datetime.today().strftime('%d-%m-%Y %H:%M:%S') + ' with ' + str(count_succes) + ' snapshots of ' + str(count_total) + ' possible.'
result= '\nFinished making snapshots at ' + datetime.utcnow().isoformat() + ' with ' + str(count_succes) + ' snapshots of ' + str(count_total) + ' possible.'
message += "\n" + "\n" + result
message += "\nTotal snapshots created: " + str(total_creates)
message += "\nTotal snapshots errors: " + str(count_errors)
Expand Down