Deal with new flake8 error

Change-Id: I2d0f2c289a30ca7417b28f91b86958977128d944
Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
This commit is contained in:
Zhijiang Hu 2017-08-21 23:37:33 -04:00
parent dd58ce348f
commit 026709bce6
35 changed files with 776 additions and 425 deletions

View File

@ -87,16 +87,12 @@ def find_resource(manager, name_or_id, **find_args):
except exceptions.NotFound: except exceptions.NotFound:
msg = _("No %(name)s with a name or " msg = _("No %(name)s with a name or "
"ID of '%(name_or_id)s' exists.") % \ "ID of '%(name_or_id)s' exists.") % \
{ {"name": manager.resource_class.__name__.lower(),
"name": manager.resource_class.__name__.lower(), "name_or_id": name_or_id}
"name_or_id": name_or_id
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
except exceptions.NoUniqueMatch: except exceptions.NoUniqueMatch:
msg = _("Multiple %(name)s matches found for " msg = _("Multiple %(name)s matches found for "
"'%(name_or_id)s', use an ID to be more specific.") % \ "'%(name_or_id)s', use an ID to be more specific.") % \
{ {"name": manager.resource_class.__name__.lower(),
"name": manager.resource_class.__name__.lower(), "name_or_id": name_or_id}
"name_or_id": name_or_id
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -1,43 +1,43 @@
# Copyright 2012 OpenStack Foundation # Copyright 2012 OpenStack Foundation
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
# a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy import copy
import six import six
from daisyclient.common import utils from daisyclient.common import utils
from daisyclient.openstack.common.apiclient import base from daisyclient.openstack.common.apiclient import base
BACKEND_TYPES_PARAMS = () BACKEND_TYPES_PARAMS = ()
OS_REQ_ID_HDR = 'x-openstack-request-id' OS_REQ_ID_HDR = 'x-openstack-request-id'
class BackendTypes(base.Resource): class BackendTypes(base.Resource):
def __repr__(self): def __repr__(self):
return "<BackendTypes %s>" % self._info return "<BackendTypes %s>" % self._info
class BackendTypesManager(base.ManagerWithFind): class BackendTypesManager(base.ManagerWithFind):
resource_class = BackendTypes resource_class = BackendTypes
def list(self, **kwargs): def list(self, **kwargs):
pass pass
def get(self): def get(self):
""" """
get backend types get backend types
""" """
url = '/v1/backend_types' url = '/v1/backend_types'
resp, body = self.client.post(url, headers=None, data=None) resp, body = self.client.post(url, headers=None, data=None)
return BackendTypes(self, body) return BackendTypes(self, body)

View File

@ -1,232 +1,232 @@
# Copyright 2012 OpenStack Foundation # Copyright 2012 OpenStack Foundation
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
# a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy import copy
from oslo_utils import encodeutils from oslo_utils import encodeutils
from oslo_utils import strutils from oslo_utils import strutils
import six import six
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
from daisyclient.common import utils from daisyclient.common import utils
from daisyclient.openstack.common.apiclient import base from daisyclient.openstack.common.apiclient import base
PXE_ENV_CHECK_PARAMS = ('deployment_interface', 'server_ip') PXE_ENV_CHECK_PARAMS = ('deployment_interface', 'server_ip')
DEFAULT_PAGE_SIZE = 200 DEFAULT_PAGE_SIZE = 200
SORT_DIR_VALUES = ('asc', 'desc') SORT_DIR_VALUES = ('asc', 'desc')
SORT_KEY_VALUES = ('id', 'created_at', 'updated_at') SORT_KEY_VALUES = ('id', 'created_at', 'updated_at')
OS_REQ_ID_HDR = 'x-openstack-request-id' OS_REQ_ID_HDR = 'x-openstack-request-id'
class DeployServer(base.Resource): class DeployServer(base.Resource):
def __repr__(self): def __repr__(self):
return "<DeployServer %s>" % self._info return "<DeployServer %s>" % self._info
def update(self, **fields): def update(self, **fields):
self.manager.update(self, **fields) self.manager.update(self, **fields)
def delete(self, **kwargs): def delete(self, **kwargs):
return self.manager.delete(self) return self.manager.delete(self)
def data(self, **kwargs): def data(self, **kwargs):
return self.manager.data(self, **kwargs) return self.manager.data(self, **kwargs)
class DeployServerManager(base.ManagerWithFind): class DeployServerManager(base.ManagerWithFind):
resource_class = DeployServer resource_class = DeployServer
def _deploy_server_meta_to_headers(self, fields): def _deploy_server_meta_to_headers(self, fields):
headers = {} headers = {}
fields_copy = copy.deepcopy(fields) fields_copy = copy.deepcopy(fields)
# NOTE(flaper87): Convert to str, headers # NOTE(flaper87): Convert to str, headers
# that are not instance of basestring. All # that are not instance of basestring. All
# headers will be encoded later, before the # headers will be encoded later, before the
# request is sent. # request is sent.
for key, value in six.iteritems(fields_copy): for key, value in six.iteritems(fields_copy):
headers['%s' % key] = utils.to_str(value) headers['%s' % key] = utils.to_str(value)
return headers return headers
@staticmethod @staticmethod
def _format_deploy_server_meta_for_user(meta): def _format_deploy_server_meta_for_user(meta):
for key in ['size', 'min_ram', 'min_disk']: for key in ['size', 'min_ram', 'min_disk']:
if key in meta: if key in meta:
try: try:
meta[key] = int(meta[key]) if meta[key] else 0 meta[key] = int(meta[key]) if meta[key] else 0
except ValueError: except ValueError:
pass pass
return meta return meta
def _list(self, url, response_key, obj_class=None, body=None): def _list(self, url, response_key, obj_class=None, body=None):
resp, body = self.client.get(url) resp, body = self.client.get(url)
if obj_class is None: if obj_class is None:
obj_class = self.resource_class obj_class = self.resource_class
data = body[response_key] data = body[response_key]
return ([obj_class(self, res, loaded=True) for res in data if res], return ([obj_class(self, res, loaded=True) for res in data if res],
resp) resp)
def _build_params(self, parameters): def _build_params(self, parameters):
params = {'limit': parameters.get('page_size', DEFAULT_PAGE_SIZE)} params = {'limit': parameters.get('page_size', DEFAULT_PAGE_SIZE)}
if 'marker' in parameters: if 'marker' in parameters:
params['marker'] = parameters['marker'] params['marker'] = parameters['marker']
sort_key = parameters.get('sort_key') sort_key = parameters.get('sort_key')
if sort_key is not None: if sort_key is not None:
if sort_key in SORT_KEY_VALUES: if sort_key in SORT_KEY_VALUES:
params['sort_key'] = sort_key params['sort_key'] = sort_key
else: else:
raise ValueError('sort_key must be one of the following: %s.' raise ValueError('sort_key must be one of the following: %s.'
% ', '.join(SORT_KEY_VALUES)) % ', '.join(SORT_KEY_VALUES))
sort_dir = parameters.get('sort_dir') sort_dir = parameters.get('sort_dir')
if sort_dir is not None: if sort_dir is not None:
if sort_dir in SORT_DIR_VALUES: if sort_dir in SORT_DIR_VALUES:
params['sort_dir'] = sort_dir params['sort_dir'] = sort_dir
else: else:
raise ValueError('sort_dir must be one of the following: %s.' raise ValueError('sort_dir must be one of the following: %s.'
% ', '.join(SORT_DIR_VALUES)) % ', '.join(SORT_DIR_VALUES))
filters = parameters.get('filters', {}) filters = parameters.get('filters', {})
params.update(filters) params.update(filters)
return params return params
def get(self, id): def get(self, id):
"""get deploy server information by id.""" """get deploy server information by id."""
pass pass
def list(self, **kwargs): def list(self, **kwargs):
"""Get a list of deploy server. """Get a list of deploy server.
:param page_size: number of items to request in each paginated request :param page_size: number of items to request in each paginated request
:param limit: maximum number of services to return :param limit: maximum number of services to return
:param marker: begin returning services that appear later in the :param marker: begin returning services that appear later in the
service ist than that represented by this service id service ist than that represented by this service id
:param filters: dict of direct comparison filters that mimics the :param filters: dict of direct comparison filters that mimics the
structure of an service object structure of an service object
:param return_request_id: If an empty list is provided, populate this :param return_request_id: If an empty list is provided, populate this
list with the request ID value from the header list with the request ID value from the header
x-openstack-request-id x-openstack-request-id
:rtype: list of :class:`DeployServer` :rtype: list of :class:`DeployServer`
""" """
absolute_limit = kwargs.get('limit') absolute_limit = kwargs.get('limit')
page_size = kwargs.get('page_size', DEFAULT_PAGE_SIZE) page_size = kwargs.get('page_size', DEFAULT_PAGE_SIZE)
def paginate(qp, return_request_id=None): def paginate(qp, return_request_id=None):
for param, value in six.iteritems(qp): for param, value in six.iteritems(qp):
if isinstance(value, six.string_types): if isinstance(value, six.string_types):
# Note(flaper87) Url encoding should # Note(flaper87) Url encoding should
# be moved inside http utils, at least # be moved inside http utils, at least
# shouldn't be here. # shouldn't be here.
# #
# Making sure all params are str before # Making sure all params are str before
# trying to encode them # trying to encode them
qp[param] = encodeutils.safe_decode(value) qp[param] = encodeutils.safe_decode(value)
url = '/v1/deploy_server?%s' % urlparse.urlencode(qp) url = '/v1/deploy_server?%s' % urlparse.urlencode(qp)
deploy_servers, resp = self._list(url, "deploy_servers") deploy_servers, resp = self._list(url, "deploy_servers")
if return_request_id is not None: if return_request_id is not None:
return_request_id.append(resp.headers.get(OS_REQ_ID_HDR, None)) return_request_id.append(resp.headers.get(OS_REQ_ID_HDR, None))
for deploy_server in deploy_servers: for deploy_server in deploy_servers:
yield deploy_server yield deploy_server
return_request_id = kwargs.get('return_req_id', None) return_request_id = kwargs.get('return_req_id', None)
params = self._build_params(kwargs) params = self._build_params(kwargs)
seen = 0 seen = 0
while True: while True:
seen_last_page = 0 seen_last_page = 0
filtered = 0 filtered = 0
for deploy_server in paginate(params, return_request_id): for deploy_server in paginate(params, return_request_id):
last_deploy_server = deploy_server.id last_deploy_server = deploy_server.id
if (absolute_limit is not None and if (absolute_limit is not None and
seen + seen_last_page >= absolute_limit): seen + seen_last_page >= absolute_limit):
# Note(kragniz): we've seen enough images # Note(kragniz): we've seen enough images
return return
else: else:
seen_last_page += 1 seen_last_page += 1
yield deploy_server yield deploy_server
seen += seen_last_page seen += seen_last_page
if seen_last_page + filtered == 0: if seen_last_page + filtered == 0:
""" """
Note(kragniz): we didn't get any deploy_servers Note(kragniz): we didn't get any deploy_servers
in the last page in the last page
""" """
return return
if absolute_limit is not None and seen >= absolute_limit: if absolute_limit is not None and seen >= absolute_limit:
# Note(kragniz): reached the limit of deploy_servers to return # Note(kragniz): reached the limit of deploy_servers to return
return return
if page_size and seen_last_page + filtered < page_size: if page_size and seen_last_page + filtered < page_size:
""" """
Note(kragniz): we've reached the last page Note(kragniz): we've reached the last page
of the deploy_servers of the deploy_servers
""" """
return return
# Note(kragniz): there are more deploy_servers to come # Note(kragniz): there are more deploy_servers to come
params['marker'] = last_deploy_server params['marker'] = last_deploy_server
seen_last_page = 0 seen_last_page = 0
def add(self, **kwargs): def add(self, **kwargs):
"""Add . """Add .
TODO(bcwaldon): document accepted params TODO(bcwaldon): document accepted params
""" """
pass pass
def delete(self, id): def delete(self, id):
"""Delete.""" """Delete."""
pass pass
def update(self, id, **kwargs): def update(self, id, **kwargs):
"""Update""" """Update"""
pass pass
def pxe_env_check(self, **kwargs): def pxe_env_check(self, **kwargs):
"""pxe env check """pxe env check
TODO(bcwaldon): document accepted params TODO(bcwaldon): document accepted params
""" """
fields = {} fields = {}
for field in kwargs: for field in kwargs:
if field in PXE_ENV_CHECK_PARAMS: if field in PXE_ENV_CHECK_PARAMS:
fields[field] = kwargs[field] fields[field] = kwargs[field]
elif field == 'return_req_id': elif field == 'return_req_id':
continue continue
else: else:
msg = "pxe_env_check() got an unexpected "\ msg = "pxe_env_check() got an unexpected "\
"keyword argument '%s'" "keyword argument '%s'"
raise TypeError(msg % field) raise TypeError(msg % field)
url = '/v1/deploy_servers/pxe_env_check' url = '/v1/deploy_servers/pxe_env_check'
resp, body = self.client.post(url, headers=None, data=fields) resp, body = self.client.post(url, headers=None, data=fields)
return DeployServer( return DeployServer(
self, self._format_deploy_server_meta_for_user( self, self._format_deploy_server_meta_for_user(
body['deploy_server_meta'])) body['deploy_server_meta']))

View File

@ -1,86 +1,86 @@
# Copyright 2012 OpenStack Foundation # Copyright 2012 OpenStack Foundation
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
# a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
import os import os
def _read_template_file(args): def _read_template_file(args):
template_file = args.params_file_path template_file = args.params_file_path
if not os.path.exists(template_file): if not os.path.exists(template_file):
print("Params_file not exist or permission deiny.") print("Params_file not exist or permission deiny.")
return return
with open(template_file) as tfp: with open(template_file) as tfp:
params = ''.join( params = ''.join(
tfp.read().replace("\\'", "").split(" ")).replace("\n", "") tfp.read().replace("\\'", "").split(" ")).replace("\n", "")
return dict(eval(params)) return dict(eval(params))
CLUSTER_ADD_PARAMS_FILE = { CLUSTER_ADD_PARAMS_FILE = {
'description': 'desc', 'description': 'desc',
'name': "test", 'name': "test",
'routers': [{ 'routers': [{
'description': 'router1', 'description': 'router1',
'external_logic_network': 'flat1', 'external_logic_network': 'flat1',
'name': 'router1', 'name': 'router1',
'subnets': ['subnet2', 'subnet10']}], 'subnets': ['subnet2', 'subnet10']}],
'networks': [], 'networks': [],
'nodes': [], 'nodes': [],
'logic_networks': [{ 'logic_networks': [{
'name': 'internal1', 'name': 'internal1',
'physnet_name': 'PRIVATE1', 'physnet_name': 'PRIVATE1',
'segmentation_id': 200, 'segmentation_id': 200,
'segmentation_type': 'vlan', 'segmentation_type': 'vlan',
'shared': True, 'shared': True,
'subnets': [{'cidr': '192.168.1.0/24', 'subnets': [{'cidr': '192.168.1.0/24',
'dns_nameservers': ['8.8.4.4', 'dns_nameservers': ['8.8.4.4',
'8.8.8.8'], '8.8.8.8'],
'floating_ranges': [['192.168.1.2', 'floating_ranges': [['192.168.1.2',
'192.168.1.200']], '192.168.1.200']],
'gateway': '192.168.1.1', 'gateway': '192.168.1.1',
'name': 'subnet2'}, 'name': 'subnet2'},
{'cidr': '172.16.1.0/24', {'cidr': '172.16.1.0/24',
'dns_nameservers': ['8.8.4.4', 'dns_nameservers': ['8.8.4.4',
'8.8.8.8'], '8.8.8.8'],
'floating_ranges': [['172.16.1.130', 'floating_ranges': [['172.16.1.130',
'172.16.1.150'], '172.16.1.150'],
['172.16.1.151', ['172.16.1.151',
'172.16.1.254']], '172.16.1.254']],
'gateway': '172.16.1.1', 'gateway': '172.16.1.1',
'name': 'subnet10'}], 'name': 'subnet10'}],
'type': 'internal'}, 'type': 'internal'},
{'name': 'flat1', {'name': 'flat1',
'physnet_name': 'physnet1', 'physnet_name': 'physnet1',
'segmentation_type': 'flat', 'segmentation_type': 'flat',
'segmentation_id': -1, 'segmentation_id': -1,
'shared': True, 'shared': True,
'subnets': [{'cidr': '192.168.2.0/24', 'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4', 'dns_nameservers': ['8.8.4.4',
'8.8.8.8'], '8.8.8.8'],
'floating_ranges': [['192.168.2.130', 'floating_ranges': [['192.168.2.130',
'192.168.2.254']], '192.168.2.254']],
'gateway': '192.168.2.1', 'gateway': '192.168.2.1',
'name': 'subnet123'}], 'name': 'subnet123'}],
'type': 'external'} 'type': 'external'}
], ],
'networking_parameters': { 'networking_parameters': {
'base_mac': 'fa:16:3e:00:00:00', 'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 4094], 'gre_id_range': [2, 4094],
'net_l23_provider': 'ovs', 'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3', 'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,flat,vxlan,gre', 'segmentation_type': 'vlan,flat,vxlan,gre',
'vlan_range': [2, 4094], 'vlan_range': [2, 4094],
'vni_range': [2, 4094]} 'vni_range': [2, 4094]}
} }

View File

@ -955,7 +955,7 @@ def do_service_update(gc, args):
@utils.arg('--nova-lv-size', metavar='<NOVA_LV_SIZE>', @utils.arg('--nova-lv-size', metavar='<NOVA_LV_SIZE>',
help='the size of logic volume disk for nvoa, and the unit is MB.') help='the size of logic volume disk for nvoa, and the unit is MB.')
@utils.arg('--disk-location', metavar='<DISK_LOCATION>', @utils.arg('--disk-location', metavar='<DISK_LOCATION>',
help='where disks used by backends application from, default is "local". \ help='where disks used by backends from, default is "local". \
"local" means disks come from local host, \ "local" means disks come from local host, \
"share" means disks come from share storage devices') "share" means disks come from share storage devices')
@utils.arg('--role-type', metavar='<ROLE_TYPE>', @utils.arg('--role-type', metavar='<ROLE_TYPE>',
@ -1079,7 +1079,7 @@ def do_role_detail(gc, args):
@utils.arg('--docker-vg-size', metavar='<DOCKER_VG_SIZE>', @utils.arg('--docker-vg-size', metavar='<DOCKER_VG_SIZE>',
help='the size of docker_vg(M).') help='the size of docker_vg(M).')
@utils.arg('--disk-location', metavar='<DISK_LOCATION>', @utils.arg('--disk-location', metavar='<DISK_LOCATION>',
help='where disks used by backends application from, default is "local". \ help='where disks used by backends from, default is "local". \
"local" means disks come from local host, \ "local" means disks come from local host, \
"share" means disks come from share storage devices') "share" means disks come from share storage devices')
@utils.arg('--ntp-server', metavar='<NTP_SERVER>', @utils.arg('--ntp-server', metavar='<NTP_SERVER>',

View File

@ -36,6 +36,6 @@ downloadcache = ~/cache/pip
# H302 import only modules # H302 import only modules
# H303 no wildcard import # H303 no wildcard import
# H404 multi line docstring should start with a summary # H404 multi line docstring should start with a summary
ignore = F403,F812,F821,H233,H302,H303,H404,F841,F401,E731,H101,H201,H231,H233,H237,H238,H301,H306,H401,H403,H701,H702,H703,F999 ignore = F403,F812,F821,H233,H302,H303,H404,F841,F401,E731,H101,H201,H231,H233,H237,H238,H301,H306,H401,H403,H701,H702,H703,F999,H402
show-source = True show-source = True
exclude = .venv,.tox,dist,doc,*egg,build exclude = .venv,.tox,dist,doc,*egg,build

View File

@ -1,4 +1,22 @@
from __future__ import absolute_import # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from __future__ import absolute_import
from django.conf import settings from django.conf import settings

View File

@ -1 +0,0 @@
# intentionally left blank

View File

@ -1 +0,0 @@
# intentionally left blank

View File

@ -1,7 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import json import json
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions from horizon import exceptions

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django.http import HttpResponse from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt

View File

@ -1,7 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import logging import logging
from django.http import HttpResponse from django.http import HttpResponse

View File

@ -1,7 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import logging import logging
from django.http import HttpResponse from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt

View File

@ -1,7 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import json import json
from django import http from django import http

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django.http import HttpResponse from django.http import HttpResponse
from django.views import generic from django.views import generic

View File

@ -1,7 +1,20 @@
# # Copyright 2012 United States Government as represented by the
# Copyright ZTE # Administrator of the National Aeronautics and Space Administration.
# Daisy Tools Dashboard # All Rights Reserved.
# #
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import json import json
import logging import logging

View File

@ -1,7 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -385,11 +399,6 @@ def deploy_rule_func(request, cluster_id):
def ip_into_int(ip): def ip_into_int(ip):
"""
Switch ip string to decimalism integer..
:param ip: ip string
:return: decimalism integer
"""
return reduce(lambda x, y: (x << 8) + y, map(int, ip.split('.'))) return reduce(lambda x, y: (x << 8) + y, map(int, ip.split('.')))

View File

@ -1,7 +1,21 @@
# # Copyright 2012 United States Government as represented by the
# Copyright ZTE # Administrator of the National Aeronautics and Space Administration.
# Daisy Tools Dashboard # All Rights Reserved.
# #
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import os import os
from django.http import HttpResponse from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt

View File

@ -1,7 +1,20 @@
# # Copyright 2012 United States Government as represented by the
# Copyright ZTE # Administrator of the National Aeronautics and Space Administration.
# Daisy Tools Dashboard # All Rights Reserved.
# #
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import json import json

View File

@ -1,7 +1,20 @@
# # Copyright 2012 United States Government as represented by the
# Copyright ZTE # Administrator of the National Aeronautics and Space Administration.
# Daisy Tools Dashboard # All Rights Reserved.
# #
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import json import json

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django import http from django import http
from django.views import generic from django.views import generic

View File

@ -1,3 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django.http import HttpResponse from django.http import HttpResponse
from horizon import exceptions as horizon_exceptions from horizon import exceptions as horizon_exceptions

View File

@ -1,3 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import logging import logging
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import json import json

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django.http import HttpResponse from django.http import HttpResponse
from django.views import generic from django.views import generic

View File

@ -1,3 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from horizon import forms from horizon import forms
from horizon import tables from horizon import tables
from django import template from django import template

View File

@ -1,3 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from horizon import views from horizon import views
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse from django.http import HttpResponse

View File

@ -1,3 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.decorators.debug import sensitive_variables from django.views.decorators.debug import sensitive_variables
from django.forms.widgets import RadioSelect from django.forms.widgets import RadioSelect

View File

@ -1,3 +1,21 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from horizon import views from horizon import views

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import os import os
import logging import logging

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
from django import shortcuts from django import shortcuts
from horizon.utils import memoized from horizon.utils import memoized

View File

@ -1,7 +1,20 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# #
# Copyright ZTE # Copyright 2012 Nebula, Inc.
# Daisy Tools Dashboard
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import os import os
import json import json

View File

@ -17,18 +17,15 @@ setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0 PYTHONHASHSEED=0
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = /bin/bash run_tests.sh -N --no-pep8 {posargs} commands = python setup.py testr --testr-args='{posargs}'
[testenv:pep8] [testenv:pep8]
commands = commands = flake8
/bin/bash run_tests.sh -N --pep8
/bin/bash run_tests.sh -N --makemessages --check-only
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}
[testenv:cover] [testenv:cover]
commands = /bin/bash run_tests.sh -N --no-pep8 --coverage {posargs} commands = python setup.py testr --coverage --testr-args='{posargs}'
[testenv:py27dj14] [testenv:py27dj14]
basepython = python2.7 basepython = python2.7

View File

@ -1,3 +1,14 @@
[tox]
envlist = py26,py27,py33,py34,pypy,pep8
minversion = 1.6
skipsdist = True
[testenv:pep8]
commands = flake8
[testenv:venv]
commands = {posargs}
[flake8] [flake8]
# E125 is a won't fix until https://github.com/jcrocholl/pep8/issues/126 is resolved. For further detail see https://review.openstack.org/#/c/36788/ # E125 is a won't fix until https://github.com/jcrocholl/pep8/issues/126 is resolved. For further detail see https://review.openstack.org/#/c/36788/
# E123 skipped because it is ignored by default in the default pep8 # E123 skipped because it is ignored by default in the default pep8

View File

@ -45,4 +45,5 @@ yum -y install \
gcc \ gcc \
autoconf \ autoconf \
automake \ automake \
glibc-devel glibc-devel \
fontawesome-fonts-web