コード例 #1
0
ファイル: _legacy_clients.py プロジェクト: par-tec/shade
 def make_swift_service(self, suppress_warning=False):
     # NOTE(mordred): Not using helper functions because the
     #                error message needs to be different
     if not suppress_warning:
         warnings.warn(
             'Using shade to get a SwiftService object is deprecated. shade'
             ' will automatically do the things SwiftServices does as part'
             ' of the normal object resource calls. If you are having'
             ' trouble using those such that you still need to use'
             ' SwiftService, please file a bug with shade.'
             ' If you understand the issues and want to make this warning'
             ' go away, use cloud.make_swift_service(True) instead of'
             ' cloud.swift_service')
         # Abuse self._legacy_clients so that we only give the warning
         # once. We don't cache SwiftService objects.
         self._legacy_clients['swift-service'] = True
     try:
         import swiftclient.service
     except ImportError:
         self.log.error(
             'swiftclient is no longer a dependency of shade. You need to'
             ' install python-swiftclient directly.')
     with _utils.shade_exceptions("Error constructing SwiftService"):
         endpoint = self.get_session_endpoint(service_key='object-store')
         options = dict(os_auth_token=self.auth_token,
                        os_storage_url=endpoint,
                        os_region_name=self.region_name)
         options.update(self._get_swift_kwargs())
         return swiftclient.service.SwiftService(options=options)
コード例 #2
0
ファイル: _legacy_clients.py プロジェクト: dbckz/shade
 def make_swift_service(self, suppress_warning=False):
     # NOTE(mordred): Not using helper functions because the
     #                error message needs to be different
     if not suppress_warning:
         warnings.warn(
             'Using shade to get a SwiftService object is deprecated. shade'
             ' will automatically do the things SwiftServices does as part'
             ' of the normal object resource calls. If you are having'
             ' trouble using those such that you still need to use'
             ' SwiftService, please file a bug with shade.'
             ' If you understand the issues and want to make this warning'
             ' go away, use cloud.make_swift_service(True) instead of'
             ' cloud.swift_service')
         # Abuse self._legacy_clients so that we only give the warning
         # once. We don't cache SwiftService objects.
         self._legacy_clients['swift-service'] = True
     try:
         import swiftclient.service
     except ImportError:
         self.log.error(
             'swiftclient is no longer a dependency of shade. You need to'
             ' install python-swiftclient directly.')
     with _utils.shade_exceptions("Error constructing SwiftService"):
         endpoint = self.get_session_endpoint(
             service_key='object-store')
         options = dict(os_auth_token=self.auth_token,
                        os_storage_url=endpoint,
                        os_region_name=self.region_name)
         options.update(self._get_swift_kwargs())
         return swiftclient.service.SwiftService(options=options)