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

Metadata and Pylint updates #374

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
build/
.ropeproject/
.vscode/
dist/
8 changes: 0 additions & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ confidence=HIGH,
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
useless-object-inheritance,
consider-using-dict-items,
broad-except,
consider-using-with,
Expand Down
8 changes: 4 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Please see their documentation for details on how to install and use these conta
### Install base
** Requires Python Setuptool
```
# python setup.py install
# python3 -m pip install .
```

### Create documentation
Expand All @@ -81,20 +81,20 @@ Please see their documentation for details on how to install and use these conta
### Install common plugins
```
# cd ${TARGET}/holland/plugins/holland.lib.common/
# python setup.py install
# python3 -m pip install .
```

### Most plugins require the holland.lib.mysql plugin
** The MySQldb connector requires gcc, mysql-devel, and python-devel
```
# cd ${TARGET}/holland/plugins/holland.lib.mysql/
# python setup.py install
# python3 -m pip install .
```

### Install other plugins
```
# cd ../holland.backup.{plugin name}
# python setup.py install
# python3 -m pip install .
```

### Setup configuration files
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
default: pylint
.PHONY: pylint_base pylint_plugins pylint
PROJDIR := $(realpath $(CURDIR))
PLUGINS = ${shell find $(PROJDIR)/plugins/ -maxdepth 1 -name "holland.*" -print}


pylint_base:
pylint holland || exit 1

pylint_plugins:
for dir in $(PLUGINS) ; do echo $$dir; pylint $$dir/holland || exit 1; done

pylint: pylint_base pylint_plugins

2 changes: 1 addition & 1 deletion holland/commands/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def call_hooks(event, entry):
return 0


class PurgeManager(object):
class PurgeManager:
"""
Find and clean up old backups
"""
Expand Down
4 changes: 2 additions & 2 deletions holland/core/backup/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BackupError(Exception):
"""Error during a backup"""


class BackupPlugin(object):
class BackupPlugin:
"""
Define a backup plugin
"""
Expand Down Expand Up @@ -81,7 +81,7 @@ def load_plugin(name, config, path, dry_run):
)


class BackupRunner(object):
class BackupRunner:
"""
Run backup
"""
Expand Down
5 changes: 2 additions & 3 deletions holland/core/command/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
LOG = logging.getLogger(__name__)
HOLLAND_VERSION = get_distribution("holland").version
HOLLAND_BANNER = f"""
Holland Backup v%s
Holland Backup v{HOLLAND_VERSION}
Copyright (c) 2008-2018 Rackspace US, Inc.
More info available at http://hollandbackup.org

Expand All @@ -21,7 +21,6 @@
[[[[[[[]]]]]]] [[[[[[[]]]]]]]
[[[[[[[]]]]]]] [[[[[[[]]]]]]]

{HOLLAND_VERSION}
"""

HOLLAND_CONF = "/etc/holland/holland.conf"
Expand Down Expand Up @@ -63,7 +62,7 @@
SUBPARSER = PARSER.add_subparsers(dest="command")


class Command(object):
class Command:
"""Base Command class for implementing pluggable
commmands.

Expand Down
6 changes: 3 additions & 3 deletions holland/core/spool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def timestamp_dir(when=None):
return time.strftime("%Y%m%d_%H%M%S", time.localtime(when))


class Spool(object):
class Spool:
"""
A directory spool where backups are saved
"""
Expand Down Expand Up @@ -132,7 +132,7 @@ def __iter__(self):
return iter(self.list_backupsets())


class Backupset(object):
class Backupset:
"""
Define backupset
"""
Expand Down Expand Up @@ -276,7 +276,7 @@ def _cmp(value1, value2):
""".splitlines()


class Backup(object):
class Backup:
"""
Representation of a backup instance.
"""
Expand Down
2 changes: 1 addition & 1 deletion holland/core/util/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, message, exc=None):
self.exc = exc


class Lock(object):
class Lock:
"""A simple flock based file lock implementation"""

def __init__(self, path):
Expand Down
2 changes: 1 addition & 1 deletion plugins/holland.backup.example/holland/backup/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
""".splitlines()


class ExamplePlugin(object):
class ExamplePlugin:
"""An example backup plugin for holland"""

def __init__(self, name, config, target_directory, dry_run=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class MariabackupPlugin(object):
class MariabackupPlugin:
"""control connection to mysql server"""

mysql = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class MongoDump(object):
class MongoDump:
"MongoDB backup plugin for holland"

def __init__(self, name, config, target_directory, dry_run=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
LOG = logging.getLogger(__name__)


class DirArchiveAction(object):
class DirArchiveAction:
"""Copy datadir"""

def __init__(self, snap_datadir, backup_datadir, config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def locate_mysqld_exe(config):
raise BackupError("Failed to find mysqld binary")


class MySQLServer(object):
class MySQLServer:
"""Manage New MySQL Server"""

def __init__(self, mysqld_exe, defaults_file):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
LOG = logging.getLogger(__name__)


class InnodbRecoveryAction(object):
class InnodbRecoveryAction:
"""Perform InnoDB recovery against a MySQL data directory """

def __init__(self, mysqld_config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
LOG = logging.getLogger(__name__)


class FlushAndLockMySQLAction(object):
class FlushAndLockMySQLAction:
"""Lock Database"""

def __init__(self, client, extra_flush=True):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
LOG = logging.getLogger(__name__)


class MySQLDumpDispatchAction(object):
class MySQLDumpDispatchAction:
"""Setup environment for mysqldump"""

def __init__(self, mysqldump_plugin, mysqld_config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
LOG = logging.getLogger(__name__)


class RecordMySQLReplicationAction(object):
class RecordMySQLReplicationAction:
"""Connect to MySQL"""

def __init__(self, client, config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
LOG = logging.getLogger(__name__)


class TarArchiveAction(object):
class TarArchiveAction:
"""Create tar file"""

def __init__(self, snap_datadir, archive_stream, config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
)


class MysqlDumpLVMBackup(object):
class MysqlDumpLVMBackup:
"""A Holland Backup plugin suitable for performing LVM snapshots of a
filesystem underlying a live MySQL instance.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class MysqlLVMBackup(object):
class MysqlLVMBackup:
"""
A Holland Backup plugin suitable for performing LVM snapshots of a
filesystem underlying a live MySQL instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MyOptionError(Exception):
"""Exception class for MySQL Option validation"""


class MyOptionChecker(object):
class MyOptionChecker:
"""Container for adding and validating multiple options"""

OPTION_ARG_CRE = re.compile(r"^(--[^=]+)(?:=(.+))?$", re.UNICODE)
Expand Down Expand Up @@ -62,7 +62,7 @@ def add_option(self, my_option):
self._options[my_option.option] = my_option


class MyOption(object):
class MyOption:
"""General MySQL command option"""

def __init__(self, option, min_version=None, arg=None):
Expand Down Expand Up @@ -171,7 +171,7 @@ def mysqldump_version(command):
raise MySQLDumpError("Failed to determine mysqldump version for %s" % command)


class MySQLDump(object):
class MySQLDump:
"""mysqldump command runner"""

def __init__(self, defaults_file, cmd_path="mysqldump", extra_defaults=False, mock_env=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

# For 2.7 or newer use unittest.mock
try:
from unittest.mock import MagicMock, ANY
from unittest.mock import ANY, MagicMock
except ImportError:
from mock import MagicMock, ANY
from mock import ANY, MagicMock

__all__ = ["MockEnvironment"]


class MockPopen(object):
class MockPopen:
"""
mock object to return to subclass.Popen
"""
Expand Down Expand Up @@ -39,7 +39,7 @@ def poll():
return 0


class MockEnvironment(object):
class MockEnvironment:
"""
Setup environement for dry-run
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class MySQLDumpPlugin(object):
class MySQLDumpPlugin:
"""MySQLDump Backup Plugin interface for Holland"""

CONFIGSPEC = CONFIGSPEC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class PgBaseBackup(object):
class PgBaseBackup:
"""
Postgres pg_basebackup backups
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class PgDump(object):
class PgDump:
"""
Postgres pg_dump backups
"""
Expand Down
2 changes: 1 addition & 1 deletion plugins/holland.backup.random/holland/backup/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
""".splitlines()


class RandomPlugin(object):
class RandomPlugin:
"""Back up randomness"""

def __init__(self, name, config, target_directory, dry_run=False):
Expand Down
2 changes: 1 addition & 1 deletion plugins/holland.backup.sqlite/holland/backup/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class SQLitePlugin(object):
class SQLitePlugin:
"""Define Plugin to backup SQLite"""

def __init__(self, name, config, target_directory, dry_run=False):
Expand Down
2 changes: 1 addition & 1 deletion plugins/holland.backup.tar/holland/backup/tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class TarPlugin(object):
class TarPlugin:
"""
Define Tar Backup method
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
CONFIGSPEC = CONFIGSPEC.splitlines()


class XtrabackupPlugin(object):
class XtrabackupPlugin:
"""plugin for backuping database using xtrabackup"""

#: control connection to mysql server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
LOG = logging.getLogger(__name__)


class DirArchive(object):
class DirArchive:
"""
Read, write, access directory archives. Treats a directory like an
archive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _make_tarinfo(name, size):
return tarinfo


class TarArchive(object):
class TarArchive:
"""
Read, write, access Tar archives.
"""
Expand Down
Loading