Remove post_as_copy deprecated warning from copy middleware

Almost one year has passed since all post_as_copy related code
removed by [1], we don't have to keep the warning message for
post_as_copy setting anymore in the code tree.

1: 1e79f828ad

Change-Id: Id9eea22ed688574d84ca582584c0c207d5f01383
This commit is contained in:
Kota Tsuyuzaki 2018-09-11 07:00:37 +09:00 committed by John Dickinson
parent 1f29508327
commit b4be37cc25
2 changed files with 1 additions and 68 deletions

View File

@ -125,7 +125,7 @@ from swift.common.constraints import check_account_format, MAX_FILE_SIZE
from swift.common.request_helpers import copy_header_subset, remove_items, \
is_sys_meta, is_sys_or_user_meta, is_object_transient_sysmeta, \
check_path_header
from swift.common.wsgi import WSGIContext, make_subrequest, load_app_config
from swift.common.wsgi import WSGIContext, make_subrequest
def _check_copy_from_header(req):
@ -221,24 +221,6 @@ class ServerSideCopyMiddleware(object):
def __init__(self, app, conf):
self.app = app
self.logger = get_logger(conf, log_route="copy")
self._load_object_post_as_copy_conf(conf)
self.object_post_as_copy = \
config_true_value(conf.get('object_post_as_copy', 'false'))
if self.object_post_as_copy:
msg = ('object_post_as_copy=true is deprecated; This '
'option is now ignored')
self.logger.warning(msg)
def _load_object_post_as_copy_conf(self, conf):
if ('object_post_as_copy' in conf or '__file__' not in conf):
# Option is explicitly set in middleware conf. In that case,
# we assume operator knows what he's doing.
# This takes preference over the one set in proxy app
return
proxy_conf = load_app_config(conf['__file__'])
if 'object_post_as_copy' in proxy_conf:
conf['object_post_as_copy'] = proxy_conf['object_post_as_copy']
def __call__(self, env, start_response):
req = Request(env)

View File

@ -15,12 +15,9 @@
# limitations under the License.
import mock
import shutil
import tempfile
import unittest
from hashlib import md5
from six.moves import urllib
from textwrap import dedent
from swift.common import swob
from swift.common.middleware import copy
@ -1281,52 +1278,6 @@ class TestServerSideCopyMiddleware(unittest.TestCase):
self.assertEqual('fghijk', body)
class TestServerSideCopyConfiguration(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.tmpdir)
def _test_post_as_copy_emits_warning(self, conf):
with mock.patch('swift.common.middleware.copy.get_logger',
return_value=debug_logger('copy')):
ssc = copy.filter_factory(conf)("no app here")
self.assertEqual(ssc.object_post_as_copy, True)
log_lines = ssc.logger.get_lines_for_level('warning')
self.assertEqual(1, len(log_lines))
self.assertIn('object_post_as_copy=true is deprecated', log_lines[0])
def test_post_as_copy_emits_warning(self):
self._test_post_as_copy_emits_warning({'object_post_as_copy': 'yes'})
proxy_conf = dedent("""
[DEFAULT]
bind_ip = 10.4.5.6
[pipeline:main]
pipeline = catch_errors copy ye-olde-proxy-server
[filter:catch_errors]
use = egg:swift#catch_errors
[filter:copy]
use = egg:swift#copy
[app:ye-olde-proxy-server]
use = egg:swift#proxy
object_post_as_copy = yes
""")
conffile = tempfile.NamedTemporaryFile()
conffile.write(proxy_conf)
conffile.flush()
self._test_post_as_copy_emits_warning({'__file__': conffile.name})
@patch_policies(with_ec_default=True)
class TestServerSideCopyMiddlewareWithEC(unittest.TestCase):
container_info = {