Remove min and max from base.Version

The min and max attributes from the base.Version class is not needed,
it was set and used before when checking versions but right now we only
use the major and minor attributes.

Change-Id: Ic501db26a00c96ca55eb8fbcfc7b318599a48158
This commit is contained in:
Lucas Alvares Gomes 2015-02-05 11:40:58 +00:00
parent b0af29e664
commit 48ddf0b927
3 changed files with 1 additions and 20 deletions

View File

@ -62,15 +62,13 @@ class Version(object):
max_string = 'X-OpenStack-Ironic-API-Maximum-Version'
"""HTTP response header"""
def __init__(self, headers, min=None, max=None):
def __init__(self, headers):
"""Create an API Version object from the supplied headers.
:param headers: webob headers
:raises: webob.HTTPNotAcceptable
"""
(self.major, self.minor) = Version.parse_headers(headers)
self.min = min
self.max = max
def __repr__(self):
return '%s.%s' % (self.major, self.minor)
@ -96,16 +94,6 @@ class Version(object):
"header."))
return version
def set_min_max(self, min, max):
"""Set or update the min and max versions.
This is useful if the specific min and max are not known when
the Version object is instantiated, eg. because it was created
in the root controller.
"""
self.min = min
self.max = max
def __lt__(a, b):
if (a.major == b.major and a.minor < b.minor):
return True

View File

@ -171,8 +171,6 @@ class Controller(rest.RestController):
"[%(min)s, %(max)s].") % {'min': MIN_VER,
'max': MAX_VER})
version.set_min_max(MIN_VER, MAX_VER)
@pecan.expose()
def _route(self, args):
v = base.Version(pecan.request.headers)

View File

@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from webob import exc as webob_exc
from ironic.api.controllers import v1 as v1_api
@ -37,9 +36,6 @@ class TestCheckVersions(test_base.TestCase):
class ver(object):
major = None
minor = None
min = None
max = None
set_min_max = mock.Mock()
self.version = ver()
@ -71,4 +67,3 @@ class TestCheckVersions(test_base.TestCase):
self.version.major = v1_api.BASE_VERSION
self.version.minor = v1_api.MIN_VER.minor
v1_api.Controller()._check_version(self.version)
self.assertEqual(1, self.version.set_min_max.call_count)