Improved freezerc and freezer-agent script management
With this patch the scripts are generated by automatically only from setuptools. The /bin/freezerc script is removed and the content is incorporated in freezer.main This patch should make more portable freezer on win32 platform. Unfortunately in order to support win32 platforms we need to use a version of PBR >= 1.0.0, to support env markers. Now requirements.txt reflects that Change-Id: I31a4a13711f8c042072e3cc8785078fdbb971cb7
This commit is contained in:
parent
341584f038
commit
94e1c6ea4a
53
bin/freezerc
53
bin/freezerc
|
@ -1,53 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
'''
|
||||
(c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
This product includes cryptographic software written by Eric Young
|
||||
(eay@cryptsoft.com). This product includes software written by Tim
|
||||
Hudson (tjh@cryptsoft.com).
|
||||
========================================================================
|
||||
|
||||
Freezer offer the following features:
|
||||
[*] Backup your filesystem using lvm snapshot to swift
|
||||
[*] Data Encryption (AES-256-CFB)
|
||||
[*] Backup your file system tree directly (without volume snapshot)
|
||||
[*] Backup your journaled mongodb directory tree using lvm snap to swift
|
||||
[*] Backup MySQL DB with lvm snapshot
|
||||
[*] Restore automatically your data from swift to your filesystems
|
||||
[*] Low storage consumption as the backup are uploaded as a stream
|
||||
[*] Flexible Incremental backup policy
|
||||
'''
|
||||
|
||||
import sys
|
||||
|
||||
from freezer.main import freezer_main, fail
|
||||
from freezer.arguments import backup_arguments
|
||||
|
||||
|
||||
def main():
|
||||
"""Freezerc binary main execution"""
|
||||
|
||||
(backup_args, opt_args) = backup_arguments()
|
||||
try:
|
||||
freezer_main(backup_args, opt_args)
|
||||
except ValueError as err:
|
||||
return fail(1, err, backup_args.quiet)
|
||||
except ImportError as err:
|
||||
return fail(1, err, backup_args.quiet)
|
||||
except Exception as err:
|
||||
return fail(1, err, backup_args.quiet)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -26,6 +26,7 @@ import logging
|
|||
import sys
|
||||
import json
|
||||
|
||||
from freezer.arguments import backup_arguments
|
||||
from freezer.bandwidth import monkeypatch_socket_bandwidth
|
||||
from freezer import job
|
||||
from freezer.osclients import ClientManager
|
||||
|
@ -91,14 +92,6 @@ def freezer_main(backup_args, arg_parse):
|
|||
except Exception as priority_error:
|
||||
logging.warning('[*] Priority: {0}'.format(priority_error))
|
||||
|
||||
if backup_args.version:
|
||||
print "freezer version {0}".format(backup_args.__version__)
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
arg_parse.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
log_file_name = configure_log_file_using_defaults()
|
||||
except Exception as err:
|
||||
|
@ -196,3 +189,26 @@ def fail(exit_code, e, quiet, do_log=True):
|
|||
if do_log:
|
||||
logging.critical(msg)
|
||||
return exit_code
|
||||
|
||||
|
||||
def main():
|
||||
"""Freezerc binary main execution"""
|
||||
|
||||
(backup_args, opt_args) = backup_arguments()
|
||||
try:
|
||||
if backup_args.version:
|
||||
print "freezer version {0}".format(backup_args.__version__)
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
opt_args.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
freezer_main(backup_args, opt_args)
|
||||
|
||||
except ValueError as err:
|
||||
return fail(1, err, backup_args.quiet)
|
||||
except ImportError as err:
|
||||
return fail(1, err, backup_args.quiet)
|
||||
except Exception as err:
|
||||
return fail(1, err, backup_args.quiet)
|
||||
|
|
|
@ -13,7 +13,4 @@ PyMySQL>=0.6.2 # MIT License
|
|||
pymongo>=2.6.3,<3.0
|
||||
# Not in global-requirements
|
||||
apscheduler
|
||||
# Not in global-requirements
|
||||
pep3143daemon
|
||||
paramiko>=1.13.0
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ classifier =
|
|||
Topic :: System :: Archiving :: Compression
|
||||
Topic :: System :: Archiving
|
||||
keywords =
|
||||
horizon
|
||||
freezer
|
||||
backup
|
||||
openstack
|
||||
|
@ -70,12 +69,11 @@ data_files =
|
|||
freezer/bin/trickle
|
||||
freezer/bin/trickle-overload.so
|
||||
|
||||
scripts =
|
||||
bin/freezerc
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
freezer-scheduler = freezer.scheduler.freezer_scheduler:main
|
||||
freezerc = freezer.main:main
|
||||
freezer-agent = freezer.main:main
|
||||
|
||||
[pbr]
|
||||
# Have pbr generate the module indexes like sphinx autodoc
|
||||
|
|
22
setup.py
22
setup.py
|
@ -13,9 +13,27 @@
|
|||
#limitations under the License.
|
||||
|
||||
from setuptools import setup
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
# All this Machinery unfortunately is needed to support win32 platform.
|
||||
# We follow the advice from pbr as:
|
||||
# Note that we do nott support the easy_install aspects of setuptools:
|
||||
# while we depend on setup_requires, for any install_requires we recommend
|
||||
# that they be installed prior to running setup.py install - either by hand,
|
||||
# or by using an install tool such as pip.
|
||||
install_requires = ''
|
||||
if sys.platform.startswith('linux'):
|
||||
install_requires = 'pep3143daemon'
|
||||
elif sys.platform.startswith('win32'):
|
||||
install_requires = 'pywin32'
|
||||
|
||||
subprocess.call(['easy_install', 'pip'])
|
||||
if install_requires:
|
||||
subprocess.call(['pip', 'install', install_requires])
|
||||
|
||||
setup(
|
||||
setup_requires=['pbr>=0.6,!=0.7,<1.0'],
|
||||
pbr=True,
|
||||
setup_requires='pbr',
|
||||
pbr=True
|
||||
)
|
||||
|
||||
|
|
|
@ -28,11 +28,7 @@ import tempfile
|
|||
import unittest
|
||||
import paramiko
|
||||
|
||||
INTEGRATION_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
TEST_DIR = os.path.normpath(os.path.join(INTEGRATION_DIR, '..'))
|
||||
COMMON_DIR = os.path.normpath(os.path.join(TEST_DIR, '..'))
|
||||
FREEZER_BIN_DIR = os.path.normpath(os.path.join(COMMON_DIR, 'bin'))
|
||||
FREEZERC = os.path.normpath(os.path.join(FREEZER_BIN_DIR, 'freezerc '))
|
||||
FREEZERC = distutils.spawn.find_executable('freezerc')
|
||||
|
||||
class CommandFailed(Exception):
|
||||
|
||||
|
|
Loading…
Reference in New Issue