forked from third-party-mirrors/zfs_autobackup
ready to implement zfs-autoverify
This commit is contained in:
parent
d2b183bb27
commit
db5186bf38
3
setup.py
3
setup.py
@ -18,7 +18,8 @@ setuptools.setup(
|
|||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts':
|
'console_scripts':
|
||||||
[
|
[
|
||||||
'zfs-autobackup = zfs_autobackup:cli',
|
'zfs-autobackup = zfs_autobackup.ZfsAutobackup:cli',
|
||||||
|
'zfs-autoverify = zfs_autobackup.ZfsAutoverify:cli',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
packages=setuptools.find_packages(),
|
packages=setuptools.find_packages(),
|
||||||
|
@ -3,7 +3,6 @@ import os.path
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from .LogConsole import LogConsole
|
from .LogConsole import LogConsole
|
||||||
from . import compressors
|
|
||||||
|
|
||||||
|
|
||||||
class ZfsAuto(object):
|
class ZfsAuto(object):
|
||||||
@ -91,8 +90,6 @@ class ZfsAuto(object):
|
|||||||
self.verbose("Selecting dataset property : {}".format(self.property_name))
|
self.verbose("Selecting dataset property : {}".format(self.property_name))
|
||||||
self.verbose("Snapshot format : {}".format(self.snapshot_time_format))
|
self.verbose("Snapshot format : {}".format(self.snapshot_time_format))
|
||||||
|
|
||||||
if not args.no_holds:
|
|
||||||
self.verbose("Hold name : {}".format(self.hold_name))
|
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
@ -151,7 +148,7 @@ class ZfsAuto(object):
|
|||||||
help='Exclude datasets that have the origin of their autobackup: property as "received". '
|
help='Exclude datasets that have the origin of their autobackup: property as "received". '
|
||||||
'This can avoid recursive replication between two backup partners.')
|
'This can avoid recursive replication between two backup partners.')
|
||||||
|
|
||||||
return (parser)
|
return parser
|
||||||
|
|
||||||
def verbose(self, txt):
|
def verbose(self, txt):
|
||||||
self.log.verbose(txt)
|
self.log.verbose(txt)
|
||||||
|
@ -24,6 +24,9 @@ class ZfsAutobackup(ZfsAuto):
|
|||||||
|
|
||||||
args = super(ZfsAutobackup, self).parse_args(argv)
|
args = super(ZfsAutobackup, self).parse_args(argv)
|
||||||
|
|
||||||
|
if not args.no_holds:
|
||||||
|
self.verbose("Hold name : {}".format(self.hold_name))
|
||||||
|
|
||||||
if args.allow_empty:
|
if args.allow_empty:
|
||||||
args.min_change = 0
|
args.min_change = 0
|
||||||
|
|
||||||
@ -486,3 +489,13 @@ class ZfsAutobackup(ZfsAuto):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.error("Aborted")
|
self.error("Aborted")
|
||||||
return 255
|
return 255
|
||||||
|
|
||||||
|
|
||||||
|
def cli():
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.exit(ZfsAutobackup(sys.argv[1:], False).run())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
cli()
|
||||||
|
39
zfs_autobackup/ZfsAutoverify.py
Normal file
39
zfs_autobackup/ZfsAutoverify.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
from .ZfsAuto import ZfsAuto
|
||||||
|
|
||||||
|
|
||||||
|
class ZfsAutoverify(ZfsAuto):
|
||||||
|
"""The zfs-autoverify class"""
|
||||||
|
|
||||||
|
def __init__(self, argv, print_arguments=True):
|
||||||
|
|
||||||
|
# NOTE: common options and parameters are in ZfsAuto
|
||||||
|
super(ZfsAutoverify, self).__init__(argv, print_arguments)
|
||||||
|
|
||||||
|
def parse_args(self, argv):
|
||||||
|
"""do extra checks on common args"""
|
||||||
|
|
||||||
|
args=super(ZfsAutoverify, self).parse_args(argv)
|
||||||
|
|
||||||
|
|
||||||
|
return args
|
||||||
|
|
||||||
|
def get_parser(self):
|
||||||
|
"""extend common parser with extra stuff needed for zfs-autobackup"""
|
||||||
|
|
||||||
|
parser=super(ZfsAutoverify, self).get_parser()
|
||||||
|
|
||||||
|
|
||||||
|
return (parser)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
def cli():
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.exit(ZfsAutoverify(sys.argv[1:], False).run())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
cli()
|
@ -1,9 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cli():
|
|
||||||
import sys
|
|
||||||
from .ZfsAutobackup import ZfsAutobackup
|
|
||||||
|
|
||||||
zfs_autobackup = ZfsAutobackup(sys.argv[1:], False)
|
|
||||||
sys.exit(zfs_autobackup.run())
|
|
||||||
|
@ -4,7 +4,4 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
from . import cli
|
|
||||||
cli()
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user