Fixed most pep8/flake8 issues in CloudCafe
* Removed unused imports * Removed extra lines from end of files * Fixed lines over the 79 char limit Change-Id: Ia5c9d776ad181fd76f632f9a4d03b5dc9f48cc7f
This commit is contained in:
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -200,4 +200,3 @@ class VolumesClient(AutoMarshallingRestClient):
|
||||
return self.request(
|
||||
'DELETE', url, response_entity_type=VolumeSnapshotResponse,
|
||||
requestslib_kwargs=requestslib_kwargs)
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ limitations under the License.
|
||||
|
||||
class Resource:
|
||||
"""
|
||||
@summary: Keeps details of a resource like server or image and how to delete it.
|
||||
@summary: Keeps details of a resource like server
|
||||
or image and how to delete it.
|
||||
"""
|
||||
|
||||
def __init__(self, resource_id, delete_function):
|
||||
@@ -56,4 +57,4 @@ class ResourcePool:
|
||||
try:
|
||||
resource.delete()
|
||||
except:
|
||||
pass
|
||||
pass
|
||||
|
||||
@@ -17,8 +17,7 @@ limitations under the License.
|
||||
import json
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from cafe.engine.models.base import AutoMarshallingModel, \
|
||||
AutoMarshallingDictModel
|
||||
from cafe.engine.models.base import AutoMarshallingDictModel
|
||||
from cloudcafe.compute.common.constants import Constants
|
||||
|
||||
|
||||
@@ -98,5 +97,3 @@ class MetadataItem(AutoMarshallingDictModel):
|
||||
meta_contents = json.loads(json_body)
|
||||
metadata.update(meta_contents.get('meta'))
|
||||
return metadata
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class ConsoleOutputClient(AutoMarshallingRestClient):
|
||||
self.url = url
|
||||
|
||||
def get_console_output(self, server_id, length,
|
||||
requestslib_kwargs=None):
|
||||
requestslib_kwargs=None):
|
||||
"""
|
||||
@summary: Returns Console Output for a server
|
||||
@param server_id: The id of an existing server
|
||||
|
||||
@@ -195,7 +195,8 @@ class ServersClient(AutoMarshallingRestClient):
|
||||
name=name, flavor_ref=flavor_ref, image_ref=image_ref,
|
||||
personality=personality, metadata=metadata, accessIPv4=accessIPv4,
|
||||
accessIPv6=accessIPv6, disk_config=disk_config, networks=networks,
|
||||
admin_pass=admin_pass, key_name=key_name, config_drive=config_drive)
|
||||
admin_pass=admin_pass, key_name=key_name,
|
||||
config_drive=config_drive)
|
||||
|
||||
url = '{base_url}/servers'.format(base_url=self.url)
|
||||
resp = self.request('POST', url,
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -72,4 +72,3 @@ class VolumeAttachmentListResponse(AutoMarshallingListModel):
|
||||
device=volume_attachment.get('device')))
|
||||
va_list.append(va)
|
||||
return va_list
|
||||
|
||||
|
||||
@@ -15,11 +15,10 @@ limitations under the License.
|
||||
"""
|
||||
|
||||
from cafe.engine.clients.rest import AutoMarshallingRestClient
|
||||
from cloudcafe.compute.volume_attachments_api.models.requests.volume_attachments \
|
||||
import VolumeAttachmentRequest
|
||||
|
||||
from cloudcafe.compute.volume_attachments_api.models.responses.volume_attachments \
|
||||
import VolumeAttachmentListResponse
|
||||
from cloudcafe.compute.volume_attachments_api.models. \
|
||||
requests.volume_attachments import VolumeAttachmentRequest
|
||||
from cloudcafe.compute.volume_attachments_api.models. \
|
||||
responses.volume_attachments import VolumeAttachmentListResponse
|
||||
|
||||
|
||||
class VolumeAttachmentsAPIClient(AutoMarshallingRestClient):
|
||||
|
||||
@@ -38,13 +38,16 @@ class DBaaSAPIClient(AutoMarshallingRestClient):
|
||||
insecure=False,
|
||||
serialize_format=None,
|
||||
deserialize_format=None):
|
||||
super(DBaaSAPIClient, self).__init__(serialize_format, deserialize_format)
|
||||
super(DBaaSAPIClient, self).__init__(serialize_format,
|
||||
deserialize_format)
|
||||
self.url = url
|
||||
self.tenant_id = tenant_id
|
||||
self.auth_token = auth_token
|
||||
self.default_headers['X-Auth-Token'] = auth_token
|
||||
self.default_headers['Content-Type'] = 'application/%s' % self.serialize_format
|
||||
self.default_headers['Accept'] = 'application/%s' % self.deserialize_format
|
||||
self.default_headers['Content-Type'] = 'application/%s' % \
|
||||
self.serialize_format
|
||||
self.default_headers['Accept'] = 'application/%s' % \
|
||||
self.deserialize_format
|
||||
|
||||
if self.serialize_format == 'xml':
|
||||
print "using the xml client!"
|
||||
@@ -95,7 +98,8 @@ class DBaaSAPIClient(AutoMarshallingRestClient):
|
||||
|
||||
def enable_root(self, instanceId, requestslib_kwargs=None):
|
||||
|
||||
url = '%s/%s/instances/%s/root' % (self.url, self.tenant_id, instanceId)
|
||||
url = '%s/%s/instances/%s/root' % (self.url, self.tenant_id,
|
||||
instanceId)
|
||||
|
||||
return self.request('POST', url,
|
||||
requestslib_kwargs=requestslib_kwargs)
|
||||
|
||||
@@ -15,8 +15,10 @@ limitations under the License.
|
||||
"""
|
||||
|
||||
from cafe.engine.behaviors import BaseBehavior, behavior
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.client import TokenAPI_Client
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.config import TokenAPI_Config
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.client \
|
||||
import TokenAPI_Client
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.config \
|
||||
import TokenAPI_Config
|
||||
|
||||
|
||||
class TokenAPI_Behaviors(BaseBehavior):
|
||||
|
||||
@@ -16,12 +16,12 @@ limitations under the License.
|
||||
|
||||
from cafe.engine.clients.rest import AutoMarshallingRestClient
|
||||
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.requests.auth import \
|
||||
Auth as AuthRequest
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.responses.access import \
|
||||
Access as AuthResponse
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.requests.credentials \
|
||||
import ApiKeyCredentials
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.requests. \
|
||||
auth import Auth as AuthRequest
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.responses. \
|
||||
access import Access as AuthResponse
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.requests. \
|
||||
credentials import ApiKeyCredentials
|
||||
|
||||
_version = 'v2.0'
|
||||
_tokens = 'tokens'
|
||||
|
||||
@@ -12,4 +12,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
"""
|
||||
|
||||
@@ -21,8 +21,8 @@ from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.base \
|
||||
import BaseIdentityModel
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.constants \
|
||||
import V2_0Constants
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.requests.credentials \
|
||||
import ApiKeyCredentials
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.requests. \
|
||||
credentials import ApiKeyCredentials
|
||||
|
||||
|
||||
class Auth(BaseIdentityModel):
|
||||
|
||||
@@ -54,4 +54,4 @@ class ApiKeyCredentials(BaseIdentityModel):
|
||||
element.set('username', self.username)
|
||||
if self.apiKey is not None:
|
||||
element.set('apiKey', self.apiKey)
|
||||
return element
|
||||
return element
|
||||
|
||||
@@ -12,4 +12,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
"""
|
||||
|
||||
@@ -125,6 +125,3 @@ class Version(BaseIdentityModel):
|
||||
self.id = id
|
||||
self.info = info
|
||||
self.list = list
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ class Roles(BaseIdentityListModel):
|
||||
ROOT_TAG = 'roles'
|
||||
|
||||
def __init__(self, roles=None):
|
||||
'''
|
||||
"""
|
||||
An object that represents an users response object.
|
||||
Keyword arguments:
|
||||
'''
|
||||
"""
|
||||
super(Roles, self).__init__()
|
||||
self.extend(roles)
|
||||
|
||||
@@ -62,7 +62,7 @@ class Role(BaseIdentityModel):
|
||||
ROOT_TAG = 'role'
|
||||
|
||||
def __init__(self, id=None, name=None, description=None, serviceId=None,
|
||||
tenantId=None, propagate = None, weight = None):
|
||||
tenantId=None, propagate=None, weight=None):
|
||||
super(Role, self).__init__()
|
||||
self.id = id
|
||||
self.name = name
|
||||
@@ -75,7 +75,8 @@ class Role(BaseIdentityModel):
|
||||
@classmethod
|
||||
def _json_to_obj(cls, serialized_str):
|
||||
json_dict = json.loads(serialized_str)
|
||||
json_dict['role']['propagate'] = json_dict['role'].pop('RAX-AUTH:propagate')
|
||||
json_dict['role']['propagate'] = \
|
||||
json_dict['role'].pop('RAX-AUTH:propagate')
|
||||
json_dict['role']['weight'] = json_dict['role'].pop('RAX-AUTH:Weight')
|
||||
return Role(**json_dict.get(cls.ROOT_TAG))
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import json
|
||||
from xml.etree import ElementTree
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.base import \
|
||||
BaseIdentityModel, BaseIdentityListModel
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.responses.role import \
|
||||
Roles, Role
|
||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.models.responses. \
|
||||
role import Roles, Role
|
||||
|
||||
|
||||
class Users(BaseIdentityListModel):
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
class V2_0Constants(object):
|
||||
XML_NS = 'http://docs.openstack.org/identity/api/v2.0'
|
||||
XML_NS_OPENSTACK_COMMON = 'http://docs.openstack.org/common/api/v1.0'
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -56,4 +56,3 @@ class PasswordCredentials(BaseIdentityModel):
|
||||
if self.password is not None:
|
||||
element.set('password', self.password)
|
||||
return element
|
||||
|
||||
|
||||
@@ -75,7 +75,8 @@ class Role(BaseIdentityModel):
|
||||
@classmethod
|
||||
def _json_to_obj(cls, serialized_str):
|
||||
json_dict = json.loads(serialized_str)
|
||||
json_dict['role']['propagate'] = json_dict['role'].pop('RAX-AUTH:propagate')
|
||||
json_dict['role']['propagate'] = \
|
||||
json_dict['role'].pop('RAX-AUTH:propagate')
|
||||
json_dict['role']['weight'] = json_dict['role'].pop('RAX-AUTH:Weight')
|
||||
return Role(**json_dict.get(cls.ROOT_TAG))
|
||||
|
||||
|
||||
@@ -13,4 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
from cafe.engine.behaviors import BaseBehavior
|
||||
|
||||
|
||||
class ImagesV2Behaviors(BaseBehavior):
|
||||
"""
|
||||
@summary: Base Behaviors class for Images V2 API tests
|
||||
|
||||
@@ -94,8 +94,8 @@ class ImageClient(AutoMarshallingRestClient):
|
||||
def list_images(self, name=None, disk_format=None, container_format=None,
|
||||
visibility=None, status=None, checksum=None, owner=None,
|
||||
min_ram=None, min_disk=None, changes_since=None,
|
||||
protected=None, size_min=None, size_max=None, sort_key=None,
|
||||
sort_dir=None, marker=None, limit=None,
|
||||
protected=None, size_min=None, size_max=None,
|
||||
sort_key=None, sort_dir=None, marker=None, limit=None,
|
||||
requestslib_kwargs=None, **param_kwargs):
|
||||
"""
|
||||
@summary: List all details for all available images.
|
||||
|
||||
@@ -19,8 +19,6 @@ from datetime import datetime
|
||||
|
||||
from cafe.engine.models.base import AutoMarshallingModel
|
||||
from cloudcafe.compute.common.equality_tools import EqualityTools
|
||||
from cloudcafe.images.common.types import ImageStatus, ImageVisibility, \
|
||||
ImageContainerFormat, ImageDiskFormat
|
||||
|
||||
|
||||
class Image(AutoMarshallingModel):
|
||||
|
||||
@@ -13,7 +13,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from cloudcafe.compute import provider as Compute
|
||||
from cloudcafe.identity import provider as Identity
|
||||
from cloudcafe.blockstorage import provider as BlockStorage
|
||||
|
||||
Reference in New Issue
Block a user