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

Switch to Python 3 #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
install:
python setup.py build
python setup.py install
python3 setup.py build
python3 setup.py install
release:
python setup.py sdist
python setup.py register
python3 setup.py sdist
python3 setup.py register
python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
2 changes: 1 addition & 1 deletion automated-ebs-snapshots
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
""" Automated EBS automated_ebs_snapshots

Provides automatic scheduled snapshots of AWS EC2 EBS volumes
Expand Down
4 changes: 2 additions & 2 deletions automated_ebs_snapshots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
'backupCount': 5
}

for logger in LOG_CONFIG['loggers'].keys():
for logger in list(LOG_CONFIG['loggers'].keys()):
LOG_CONFIG['loggers'][logger]['handlers'].append('file')

logging.config.dictConfig(LOG_CONFIG)
Expand Down Expand Up @@ -138,7 +138,7 @@ def main():
daemon.run()

else:
print 'Valid options for --daemon are start, stop and restart'
print('Valid options for --daemon are start, stop and restart')
sys.exit(1)

# Connect to AWS
Expand Down
6 changes: 3 additions & 3 deletions automated_ebs_snapshots/command_line_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import argparse
import sys
import os.path
from ConfigParser import SafeConfigParser
from configparser import SafeConfigParser

from automated_ebs_snapshots.valid_intervals import VALID_INTERVALS

Expand Down Expand Up @@ -107,6 +107,6 @@
args = parser.parse_args()

if args.version:
print('Automated EBS Snapshots version {}'.format(
settings.get('general', 'version')))
print(('Automated EBS Snapshots version {}'.format(
settings.get('general', 'version'))))
sys.exit(0)
2 changes: 1 addition & 1 deletion automated_ebs_snapshots/config_file_parser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Configuration file parser """
import logging
import sys
from ConfigParser import SafeConfigParser, NoOptionError
from configparser import SafeConfigParser, NoOptionError

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions automated_ebs_snapshots/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ def stop(self):
while 1:
os.kill(pid, SIGTERM)
time.sleep(0.1)
except OSError, err:
except OSError as err:
err = str(err)
if err.find("No such process") > 0:
if os.path.exists(self.pidfile):
os.remove(self.pidfile)
else:
print str(err)
print(str(err))
sys.exit(1)

def restart(self):
Expand Down
10 changes: 5 additions & 5 deletions automated_ebs_snapshots/valid_intervals.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Configure the valid backup intervals """
VALID_INTERVALS = [
u'hourly',
u'daily',
u'weekly',
u'monthly',
u'yearly']
'hourly',
'daily',
'weekly',
'monthly',
'yearly']
4 changes: 2 additions & 2 deletions automated_ebs_snapshots/volume_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def watch_from_file(connection, file_name):
:returns: None
"""
with open(file_name, 'r') as filehandle:
for line in filehandle.xreadlines():
for line in filehandle:
volume, interval, retention = line.rstrip().split(',')
watch(
connection,
Expand All @@ -217,7 +217,7 @@ def unwatch_from_file(connection, file_name):
:returns: None
"""
with open(file_name, 'r') as filehandle:
for line in filehandle.xreadlines():
for line in filehandle:
volume, interval, retention = line.rstrip().split(',')
unwatch(connection, get_volume_id(connection, volume))

Expand Down