Merge "Use parenthesis instead of backslashes in share folder"

This commit is contained in:
Jenkins 2017-06-19 11:58:09 +00:00 committed by Gerrit Code Review
commit 52084ee4f1
6 changed files with 34 additions and 34 deletions

View File

@ -79,9 +79,9 @@ class RestHelper(object):
except Exception as err: except Exception as err:
LOG.error('\nBad response from server: %(url)s.' LOG.error('\nBad response from server: %(url)s.'
' Error: %(err)s', {'url': url, 'err': err}) ' Error: %(err)s', {'url': url, 'err': err})
res = '{"error":{"code":%s,' \ res = ('{"error":{"code":%s,'
'"description":"Connect server error"}}' \ '"description":"Connect server error"}}'
% constants.ERROR_CONNECT_TO_SERVER % constants.ERROR_CONNECT_TO_SERVER)
try: try:
result = jsonutils.loads(res) result = jsonutils.loads(res)

View File

@ -149,8 +149,8 @@ class NaServer(object):
try: try:
self._api_major_version = int(major) self._api_major_version = int(major)
self._api_minor_version = int(minor) self._api_minor_version = int(minor)
self._api_version = six.text_type(major) + "." + \ self._api_version = (six.text_type(major) + "." +
six.text_type(minor) six.text_type(minor))
except ValueError: except ValueError:
raise ValueError('Major and minor versions must be integers') raise ValueError('Major and minor versions must be integers')
self._refresh_conn = True self._refresh_conn = True
@ -228,8 +228,8 @@ class NaServer(object):
if self._trace: if self._trace:
LOG.debug("Request: %s", request_element.to_string(pretty=True)) LOG.debug("Request: %s", request_element.to_string(pretty=True))
if not hasattr(self, '_opener') or not self._opener \ if (not hasattr(self, '_opener') or not self._opener
or self._refresh_conn: or self._refresh_conn):
self._build_opener() self._build_opener()
try: try:
if hasattr(self, '_timeout'): if hasattr(self, '_timeout'):
@ -262,15 +262,15 @@ class NaServer(object):
result = self.invoke_elem(na_element, enable_tunneling) result = self.invoke_elem(na_element, enable_tunneling)
if result.has_attr('status') and result.get_attr('status') == 'passed': if result.has_attr('status') and result.get_attr('status') == 'passed':
return result return result
code = result.get_attr('errno')\ code = (result.get_attr('errno')
or result.get_child_content('errorno')\ or result.get_child_content('errorno')
or 'ESTATUSFAILED' or 'ESTATUSFAILED')
if code == ESIS_CLONE_NOT_LICENSED: if code == ESIS_CLONE_NOT_LICENSED:
msg = 'Clone operation failed: FlexClone not licensed.' msg = 'Clone operation failed: FlexClone not licensed.'
else: else:
msg = result.get_attr('reason')\ msg = (result.get_attr('reason')
or result.get_child_content('reason')\ or result.get_child_content('reason')
or 'Execution status is failed due to unknown reason' or 'Execution status is failed due to unknown reason')
raise NaApiError(code, msg) raise NaApiError(code, msg)
def _create_request(self, na_element, enable_tunneling=False): def _create_request(self, na_element, enable_tunneling=False):
@ -291,19 +291,19 @@ class NaServer(object):
def _enable_tunnel_request(self, netapp_elem): def _enable_tunnel_request(self, netapp_elem):
"""Enables vserver or vfiler tunneling.""" """Enables vserver or vfiler tunneling."""
if hasattr(self, '_vfiler') and self._vfiler: if hasattr(self, '_vfiler') and self._vfiler:
if hasattr(self, '_api_major_version') and \ if (hasattr(self, '_api_major_version') and
hasattr(self, '_api_minor_version') and \ hasattr(self, '_api_minor_version') and
self._api_major_version >= 1 and \ self._api_major_version >= 1 and
self._api_minor_version >= 7: self._api_minor_version >= 7):
netapp_elem.add_attr('vfiler', self._vfiler) netapp_elem.add_attr('vfiler', self._vfiler)
else: else:
raise ValueError('ontapi version has to be atleast 1.7' raise ValueError('ontapi version has to be atleast 1.7'
' to send request to vfiler') ' to send request to vfiler')
if hasattr(self, '_vserver') and self._vserver: if hasattr(self, '_vserver') and self._vserver:
if hasattr(self, '_api_major_version') and \ if (hasattr(self, '_api_major_version') and
hasattr(self, '_api_minor_version') and \ hasattr(self, '_api_minor_version') and
self._api_major_version >= 1 and \ self._api_major_version >= 1 and
self._api_minor_version >= 15: self._api_minor_version >= 15):
netapp_elem.add_attr('vfiler', self._vserver) netapp_elem.add_attr('vfiler', self._vserver)
else: else:
raise ValueError('ontapi version has to be atleast 1.15' raise ValueError('ontapi version has to be atleast 1.15'

View File

@ -1368,9 +1368,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
@na_utils.trace @na_utils.trace
def _get_kerberos_service_principal_name(self, security_service, def _get_kerberos_service_principal_name(self, security_service,
vserver_name): vserver_name):
return 'nfs/' + vserver_name.replace('_', '-') + '.' + \ return ('nfs/' + vserver_name.replace('_', '-') + '.' +
security_service['domain'] + '@' + \ security_service['domain'] + '@' +
security_service['domain'].upper() security_service['domain'].upper())
@na_utils.trace @na_utils.trace
def configure_dns(self, security_service): def configure_dns(self, security_service):

View File

@ -63,8 +63,8 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
'netapp_aggregate_name_search_pattern is set correctly.') 'netapp_aggregate_name_search_pattern is set correctly.')
raise exception.NetAppException(msg) raise exception.NetAppException(msg)
super(NetAppCmodeMultiSVMFileStorageLibrary, self).\ (super(NetAppCmodeMultiSVMFileStorageLibrary, self).
check_for_setup_error() check_for_setup_error())
@na_utils.trace @na_utils.trace
def _get_vserver(self, share_server=None): def _get_vserver(self, share_server=None):
@ -102,8 +102,8 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
self._client.prune_deleted_nfs_export_policies() self._client.prune_deleted_nfs_export_policies()
self._client.prune_deleted_snapshots() self._client.prune_deleted_snapshots()
super(NetAppCmodeMultiSVMFileStorageLibrary, self).\ (super(NetAppCmodeMultiSVMFileStorageLibrary, self).
_handle_housekeeping_tasks() _handle_housekeeping_tasks())
@na_utils.trace @na_utils.trace
def _find_matching_aggregates(self): def _find_matching_aggregates(self):

View File

@ -79,8 +79,8 @@ class NetAppCmodeSingleSVMFileStorageLibrary(
else 'Vserver') else 'Vserver')
LOG.info(msg % msg_args) LOG.info(msg % msg_args)
super(NetAppCmodeSingleSVMFileStorageLibrary, self).\ (super(NetAppCmodeSingleSVMFileStorageLibrary, self).
check_for_setup_error() check_for_setup_error())
@na_utils.trace @na_utils.trace
def _get_vserver(self, share_server=None): def _get_vserver(self, share_server=None):
@ -115,8 +115,8 @@ class NetAppCmodeSingleSVMFileStorageLibrary(
vserver_client.prune_deleted_nfs_export_policies() vserver_client.prune_deleted_nfs_export_policies()
vserver_client.prune_deleted_snapshots() vserver_client.prune_deleted_snapshots()
super(NetAppCmodeSingleSVMFileStorageLibrary, self).\ (super(NetAppCmodeSingleSVMFileStorageLibrary, self).
_handle_housekeeping_tasks() _handle_housekeeping_tasks())
@na_utils.trace @na_utils.trace
def _find_matching_aggregates(self): def _find_matching_aggregates(self):

View File

@ -181,8 +181,8 @@ class RestClientURL(object): # pylint: disable=R0902
result = self.post("/access/v1") result = self.post("/access/v1")
del self.headers['authorization'] del self.headers['authorization']
if result.status == http_client.CREATED: if result.status == http_client.CREATED:
self.headers['x-auth-session'] = \ self.headers['x-auth-session'] = (
result.get_header('x-auth-session') result.get_header('x-auth-session'))
self.do_logout = True self.do_logout = True
log_debug_msg(self, ('ZFSSA version: %s') log_debug_msg(self, ('ZFSSA version: %s')
% result.get_header('x-zfssa-version')) % result.get_header('x-zfssa-version'))