diff --git a/INSTALL.rst b/INSTALL.rst index 488cb0dd..28fbcd00 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -6,7 +6,7 @@ Please check README.rst for further installation instructions. Install from sources:: ---------------------- -You have now the freezerc tool installed in /usr/local/bin/freezerc +You have now the freezer-agent tool installed in /usr/local/bin/freezer-agent Please execute the following command to all the available options:: diff --git a/README.rst b/README.rst index 7054dd8d..785b877a 100644 --- a/README.rst +++ b/README.rst @@ -586,7 +586,6 @@ The Freezer architecture is composed of the following components: | | - Multi-platform as it can be run on Linux, Windows, \*BSD and OSX | | | - Automatic removal of old backups | | | | -| | "freezerc" binary is deprecated and won't be available in next releases. Use freezer-agent instead. | +-------------------+------------------------------------------------------------------------------------------------------------------------------------------------+ | Freezer API | The API is used to store and provide metadata to the Freezer Web UI and to the Freezer Scheduler. | | | Also the API is used to store session information for multi node backup synchronization. No workload data is stored in the API. | @@ -1018,15 +1017,6 @@ optional arguments: If no default is set, logging will go to stderr as defined by use_stderr. This option is ignored if log_config_append is set. - --log-format FORMAT DEPRECATED. A logging.Formatter log message format - string which may use any of the available - logging.LogRecord attributes. This option is - deprecated. Please use logging_context_format_string - and logging_default_format_string instead. This option - is ignored if log_config_append is set. - --lvm-auto-snap LVM_AUTO_SNAP - Automatically guess the volume group and volume name - for given PATH. --lvm-dirmount LVM_DIRMOUNT Set the directory you want to mount the lvm snapshot to. If not provided, a unique name will be generated @@ -1114,8 +1104,7 @@ optional arguments: Checks in the specified container for object older than the specified days. If i.e. 30 is specified, it will remove the remote object older than 30 days. - Default False (Disabled) The option --remove-older- - then is deprecated and will be removed soon + Default False (Disabled) --restart-always-level RESTART_ALWAYS_LEVEL Restart the backup from level 0 after n days. Valid only if --always-level option if set. If --always- diff --git a/freezer/common/config.py b/freezer/common/config.py index 94f6c6d8..d7510043 100644 --- a/freezer/common/config.py +++ b/freezer/common/config.py @@ -123,12 +123,6 @@ _COMMON = [ "backup. When used, the lvm parameters will be guessed " "and/or the default values will be used, on windows it " "will invoke vssadmin"), - cfg.StrOpt('lvm-auto-snap', - dest='lvm_auto_snap', - default=DEFAULT_PARAMS['lvm_auto_snap'], - help="(Deprecated) Please use --snapshot instead" - "Automatically guess the volume group and volume name for " - "given PATH."), cfg.StrOpt('lvm-srcvol', dest='lvm_srcvol', default=DEFAULT_PARAMS['lvm_srcvol'], @@ -218,7 +212,6 @@ _COMMON = [ cfg.StrOpt('hostname', dest='hostname', default=DEFAULT_PARAMS['hostname'], - deprecated_name='restore-from-host', help="Set hostname to execute actions. If you are executing " "freezer from one host but you want to delete objects " "belonging to another host then you can set this option " @@ -427,15 +420,13 @@ _COMMON = [ "Please note this option is currently only available " "for file system backups. " "Please also note checking backup consistency is a " - "resource intensive operation, so use it carefully!", - deprecated_name='consistency_check'), + "resource intensive operation, so use it carefully!"), cfg.StrOpt('consistency-checksum', dest='consistency_checksum', default=DEFAULT_PARAMS['consistency_checksum'], help="Compute the checksum of the restored file(s) and compare " "it to the (provided) checksum to verify that the backup " - "was successful", - deprecated_name='consistency_checksum'), + "was successful"), cfg.BoolOpt('incremental', default=DEFAULT_PARAMS['incremental'], help="When the option is set, freezer will perform a " @@ -494,10 +485,6 @@ def get_backup_args(): defaults.update(conf.default) - # TODO(ANONYMOUS): restore_from_host is deprecated and to be removed - defaults['hostname'] = (conf.default.get('hostname') or - conf.default.get('restore_from_host')) - if defaults['log_file']: CONF.set_override('log_file', defaults['log_file']) @@ -580,9 +567,6 @@ def get_backup_args(): # TODO(enugaev): move it to new command line param backup_media - if backup_args.lvm_auto_snap: - raise Exception('lvm-auto-snap is deprecated. ' - 'Please use --snapshot instead') backup_media = 'fs' if backup_args.cinder_vol_id: backup_media = 'cinder' diff --git a/freezer/mode/mysql.py b/freezer/mode/mysql.py index 6222b1f6..267a3f05 100644 --- a/freezer/mode/mysql.py +++ b/freezer/mode/mysql.py @@ -56,7 +56,7 @@ class MysqlMode(mode.Mode): raise ImportError('Please install PyMySQL module') with open(conf.mysql_conf, 'r') as mysql_file_fd: - parsed_config = config.ini_parse(mysql_file_fd.read()) + parsed_config = config.ini_parse(mysql_file_fd) # Initialize the DB object and connect to the db according to # the db mysql backup file config self.released = False diff --git a/freezer/mode/sqlserver.py b/freezer/mode/sqlserver.py index abe12821..fced308e 100644 --- a/freezer/mode/sqlserver.py +++ b/freezer/mode/sqlserver.py @@ -35,7 +35,7 @@ class SqlserverMode(mode.Mode): self.released = False with open(conf.sql_server_conf, 'r') as sql_conf_file_fd: self.sql_server_instance = \ - config.ini_parse(sql_conf_file_fd.read())["instance"] + config.ini_parse(sql_conf_file_fd)["instance"] @property def name(self): diff --git a/freezer/scheduler/freezer_scheduler.py b/freezer/scheduler/freezer_scheduler.py index eef8006f..d62ff86d 100644 --- a/freezer/scheduler/freezer_scheduler.py +++ b/freezer/scheduler/freezer_scheduler.py @@ -202,7 +202,7 @@ def main(): doers = _get_doers(shell) doers.update(_get_doers(utils)) - possible_actions = doers.keys() + ['start', 'stop', 'status'] + possible_actions = doers.keys() + ['start', 'stop', 'status', 'reload'] arguments.parse_args(possible_actions) arguments.setup_logging() @@ -211,6 +211,11 @@ def main(): CONF.print_help() return 65 # os.EX_DATAERR + if CONF.action not in ['start', 'stop', 'status', 'reload']: + sys.stderr.write("Using freezer-scheduler as a command line client is " + "deprecated. Please use the freezer command line tool" + " from python-freezerclient.") + apiclient = None insecure = False if CONF.insecure: diff --git a/freezer/tests/freezer_tempest_plugin/tests/api/base.py b/freezer/tests/freezer_tempest_plugin/tests/api/base.py index bb6f2a5a..3be425fa 100644 --- a/freezer/tests/freezer_tempest_plugin/tests/api/base.py +++ b/freezer/tests/freezer_tempest_plugin/tests/api/base.py @@ -229,7 +229,7 @@ class BaseFreezerTest(tempest.test.BaseTestCase): backup_args += ['--compression', compression] if consistency_check: - backup_args += ['--consistency_check'] + backup_args += ['--consistency-check'] if incremental: if always_level is not None: diff --git a/freezer/tests/freezer_tempest_plugin/tests/api/test_metadata_checksum.py b/freezer/tests/freezer_tempest_plugin/tests/api/test_metadata_checksum.py index 6e729596..4e130941 100644 --- a/freezer/tests/freezer_tempest_plugin/tests/api/test_metadata_checksum.py +++ b/freezer/tests/freezer_tempest_plugin/tests/api/test_metadata_checksum.py @@ -55,7 +55,7 @@ class TestFreezerMetadataChecksum(base.BaseFreezerTest): '--container', metadata['container'], '--backup-name', self.backup_name, '--storage', 'local', - '--consistency_checksum', checksum] + '--consistency-checksum', checksum] self.run_subprocess(restore_args, 'Test restore from local storage with ' @@ -77,7 +77,7 @@ class TestFreezerMetadataChecksum(base.BaseFreezerTest): '--container', metadata['container'], '--backup-name', self.backup_name, '--storage', 'local', - '--consistency_checksum', bad_checksum] + '--consistency-checksum', bad_checksum] process = subprocess.Popen(restore_args, stdout=subprocess.PIPE, diff --git a/freezer/tests/integration/common.py b/freezer/tests/integration/common.py index c9ec4b27..30e77b14 100644 --- a/freezer/tests/integration/common.py +++ b/freezer/tests/integration/common.py @@ -25,7 +25,7 @@ import tempfile import unittest import paramiko -FREEZERC = distutils.spawn.find_executable('freezerc') +FREEZERC = distutils.spawn.find_executable('freezer-agent') class CommandFailed(Exception): diff --git a/freezer/tests/unit/utils/test_config.py b/freezer/tests/unit/utils/test_config.py index 0d3e9410..8a3bf592 100644 --- a/freezer/tests/unit/utils/test_config.py +++ b/freezer/tests/unit/utils/test_config.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from six.moves import cStringIO import unittest from freezer.utils import config @@ -20,50 +21,33 @@ from freezer.utils import config class TestConfig(unittest.TestCase): def test_export(self): string = """unset OS_DOMAIN_NAME - export OS_AUTH_URL="http://abracadabra/v3" - export OS_PROJECT_NAME=abracadabra_project - export OS_USERNAME=abracadabra_username - export OS_PASSWORD=abracadabra_password - export OS_PROJECT_DOMAIN_NAME=Default - export OS_USER_DOMAIN_NAME=Default - export OS_IDENTITY_API_VERSION=3 - export OS_AUTH_VERSION=3 - export OS_CACERT=/etc/ssl/certs/ca-certificates.crt - export OS_ENDPOINT_TYPE=internalURL""" +export OS_AUTH_URL="http://abracadabra/v3" +export OS_PROJECT_NAME=abracadabra_project +export OS_USERNAME=abracadabra_username +export OS_PASSWORD=abracadabra_password +export OS_PROJECT_DOMAIN_NAME=Default +export OS_USER_DOMAIN_NAME=Default +export OS_IDENTITY_API_VERSION=3 +export OS_AUTH_VERSION=3 +export OS_CACERT=/etc/ssl/certs/ca-certificates.crt +export OS_ENDPOINT_TYPE=internalURL""" res = config.osrc_parse(string) self.assertEqual("http://abracadabra/v3", res["OS_AUTH_URL"]) - def test_ini_like(self): - string = """# This is a comment line - # - host = 127.0.0.1 - port = 3306 - user = openstack - password = 'aNiceQuotedPassword' - password2 = "aNiceQuotedPassword" - spaced = value""" - - res = config.ini_parse(string) - self.assertEqual('127.0.0.1', res['host']) - self.assertEqual('openstack', res['user']) - self.assertEqual('3306', res['port']) - self.assertEqual('aNiceQuotedPassword', res['password']) - self.assertEqual('aNiceQuotedPassword', res['password2']) - self.assertEqual('value', res['spaced']) - def test_ini(self): string = """[default] - # This is a comment line - # - host = 127.0.0.1 - port = 3306 - user = openstack - password = 'aNiceQuotedPassword' - password2 = "aNiceQuotedPassword" - spaced = value""" +# This is a comment line +# +host = 127.0.0.1 +port = 3306 +user = openstack +password = 'aNiceQuotedPassword' +password2 = "aNiceQuotedPassword" +spaced = value""" - res = config.ini_parse(string) + fd = cStringIO(string) + res = config.ini_parse(fd) self.assertEqual('127.0.0.1', res['host']) self.assertEqual('openstack', res['user']) self.assertEqual('3306', res['port']) diff --git a/freezer/utils/config.py b/freezer/utils/config.py index 1de90153..65caa805 100644 --- a/freezer/utils/config.py +++ b/freezer/utils/config.py @@ -17,7 +17,6 @@ import os import re from six.moves import configparser -from six.moves import cStringIO from oslo_log import log @@ -81,28 +80,15 @@ def osrc_parse(lines): return find_all(EXPORT, lines) -def ini_parse(lines): +def ini_parse(fd): """ - :param lines: - :type lines: str + :param fd: + :type fd: file_descriptor :return: """ - try: - fd = cStringIO(lines) - parser = configparser.ConfigParser() - parser.readfp(fd) - return dict(parser.items('default')) - except Exception as e: - try: - # TODO(ANONYMOUS): Remove the parsing of ini-like file via regex - conf = find_all(INI, lines) - LOG.warning("Using non-INI files for database configuration " - "file is deprecated. Falling back to Regex.") - LOG.warning("INI parser error was: {}".format(str(e))) - return conf - except Exception: - LOG.warning("Couldn't parse non-INI config file using Regex") - raise + parser = configparser.ConfigParser() + parser.readfp(fd) + return dict(parser.items('default')) def find_all(regex, lines): diff --git a/setup.cfg b/setup.cfg index c865d092..917dae16 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,7 +57,6 @@ oslo.config.opts = scheduler = freezer.scheduler.arguments:list_opts console_scripts = freezer-scheduler = freezer.scheduler.freezer_scheduler:main - freezerc = freezer.main:main freezer-agent = freezer.main:main tempest.test_plugins = freezer_tempest_tests = freezer.tests.freezer_tempest_plugin.plugin:FreezerTempestPlugin