Merge "Use cls in class method and remove unused CONF"

This commit is contained in:
Jenkins 2016-09-06 22:24:15 +00:00 committed by Gerrit Code Review
commit 386a3e2c2c
2 changed files with 7 additions and 12 deletions

View File

@ -168,7 +168,7 @@ class JsonPatchType(wtypes.Base):
'/uuid', '/project_id', '/user_id']
@classmethod
def non_removable_attrs(self):
def non_removable_attrs(cls):
"""Returns a set of names of attributes that may not be removed.
Attributes whose 'mandatory' property is True are automatically added
@ -176,15 +176,15 @@ class JsonPatchType(wtypes.Base):
field _extra_non_removable_attrs in subclasses, with a set of the form
{'/foo', '/bar'}.
"""
if self._non_removable_attrs is None:
self._non_removable_attrs = self._extra_non_removable_attrs.copy()
if self._api_base:
fields = inspect.getmembers(self._api_base,
if cls._non_removable_attrs is None:
cls._non_removable_attrs = cls._extra_non_removable_attrs.copy()
if cls._api_base:
fields = inspect.getmembers(cls._api_base,
lambda a: not inspect.isroutine(a))
for name, field in fields:
if getattr(field, 'mandatory', False):
self._non_removable_attrs.add('/%s' % name)
return self._non_removable_attrs
cls._non_removable_attrs.add('/%s' % name)
return cls._non_removable_attrs
@staticmethod
def validate(patch):

View File

@ -12,15 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from magnum.common.cert_manager import cert_manager
from magnum import objects
CONF = cfg.CONF
class Cert(cert_manager.Cert):
"""Representation of a Cert for Magnum DB storage."""
def __init__(self, certificate, private_key, intermediates=None,