Merge "Code cleanup at multiple places."

This commit is contained in:
Jenkins 2016-01-30 15:27:55 +00:00 committed by Gerrit Code Review
commit 772a411a20
3 changed files with 14 additions and 10 deletions

View File

@ -160,20 +160,20 @@ class IPWrapper(SubProcessBase):
local=None, port=None, proxy=False): local=None, port=None, proxy=False):
cmd = ['add', name, 'type', 'vxlan', 'id', vni] cmd = ['add', name, 'type', 'vxlan', 'id', vni]
if group: if group:
cmd.extend(['group', group]) cmd.extend(['group', group])
if dev: if dev:
cmd.extend(['dev', dev]) cmd.extend(['dev', dev])
if ttl: if ttl:
cmd.extend(['ttl', ttl]) cmd.extend(['ttl', ttl])
if tos: if tos:
cmd.extend(['tos', tos]) cmd.extend(['tos', tos])
if local: if local:
cmd.extend(['local', local]) cmd.extend(['local', local])
if proxy: if proxy:
cmd.append('proxy') cmd.append('proxy')
# tuple: min,max # tuple: min,max
if port and len(port) == 2: if port and len(port) == 2:
cmd.extend(['port', port[0], port[1]]) cmd.extend(['port', port[0], port[1]])
elif port: elif port:
raise exceptions.NetworkVxlanPortRangeError(vxlan_range=port) raise exceptions.NetworkVxlanPortRangeError(vxlan_range=port)
self._as_root('', 'link', cmd) self._as_root('', 'link', cmd)
@ -520,7 +520,7 @@ class IpNetnsCommand(IpCommandBase):
def delete(self, name): def delete(self, name):
self._as_root('delete', name, use_root_namespace=True) self._as_root('delete', name, use_root_namespace=True)
def execute(self, cmds, addl_env={}, check_exit_code=True): def execute(self, cmds, addl_env=None, check_exit_code=True):
if not self._parent.root_helper: if not self._parent.root_helper:
raise exceptions.SudoRequired() raise exceptions.SudoRequired()
ns_params = [] ns_params = []

View File

@ -54,7 +54,7 @@ class BasePollingManager(object):
self._polling_completed = True self._polling_completed = True
def _is_polling_required(self): def _is_polling_required(self):
raise NotImplemented raise NotImplementedError
@property @property
def is_polling_required(self): def is_polling_required(self):
@ -84,9 +84,12 @@ class BasePollingManager(object):
class AlwaysPoll(BasePollingManager): class AlwaysPoll(BasePollingManager):
def _is_polling_required(self):
return True
@property @property
def is_polling_required(self): def is_polling_required(self):
return True return self._is_polling_required()
class InterfacePollingMinimizer(BasePollingManager): class InterfacePollingMinimizer(BasePollingManager):

View File

@ -280,6 +280,7 @@ class SortingEmulatedHelper(SortingHelper):
class SortingNativeHelper(SortingHelper): class SortingNativeHelper(SortingHelper):
def __init__(self, request, attr_info): def __init__(self, request, attr_info):
super(SortingNativeHelper, self).__init__(request, attr_info)
self.sort_dict = get_sorts(request, attr_info) self.sort_dict = get_sorts(request, attr_info)
def update_args(self, args): def update_args(self, args):