diff options
author | Mohammed Junaid <junaid@redhat.com> | 2013-05-29 06:43:11 +0530 |
---|---|---|
committer | Luis Pabon <lpabon@redhat.com> | 2013-05-29 10:29:10 -0700 |
commit | 44182fa87f5f499aa7c2876ee0f0c5a84afd12a9 (patch) | |
tree | ee0e3b43f58373d88b4bf87e87ee7a300cb8b50f /gluster | |
parent | ce614363d636385ccfaf92fc4b36c087a06b9fff (diff) |
Unittest case for constraints.py
Change-Id: Ibb37855c675d5def2ce2e1ed387429ce87a4926b
Signed-off-by: Mohammed Junaid <junaid@redhat.com>
Reviewed-on: http://review.gluster.org/5103
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'gluster')
-rw-r--r-- | gluster/swift/common/constraints.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gluster/swift/common/constraints.py b/gluster/swift/common/constraints.py index d1c990d..1ae8cbb 100644 --- a/gluster/swift/common/constraints.py +++ b/gluster/swift/common/constraints.py @@ -21,12 +21,25 @@ import swift.common.constraints import swift.common.ring as _ring from gluster.swift.common import Glusterfs, ring -if hasattr(swift.common.constraints, 'constraints_conf_int'): - MAX_OBJECT_NAME_COMPONENT_LENGTH = \ - swift.common.constraints.constraints_conf_int( +MAX_OBJECT_NAME_COMPONENT_LENGTH = 255 + +def set_object_name_component_length(len=None): + global MAX_OBJECT_NAME_COMPONENT_LENGTH + + if len: + MAX_OBJECT_NAME_COMPONENT_LENGTH = len + elif hasattr(swift.common.constraints, 'constraints_conf_int'): + MAX_OBJECT_NAME_COMPONENT_LENGTH = \ + swift.common.constraints.constraints_conf_int( 'max_object_name_component_length', 255) -else: - MAX_OBJECT_NAME_COMPONENT_LENGTH = 255 + else: + MAX_OBJECT_NAME_COMPONENT_LENGTH = 255 + return + +set_object_name_component_length() + +def get_object_name_component_length(): + return MAX_OBJECT_NAME_COMPONENT_LENGTH def validate_obj_name_component(obj): |