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:
msg = _("No %(name)s with a name or "
"ID of '%(name_or_id)s' exists.") % \
{
"name": manager.resource_class.__name__.lower(),
"name_or_id": name_or_id
}
{"name": manager.resource_class.__name__.lower(),
"name_or_id": name_or_id}
raise exceptions.CommandError(msg)
except exceptions.NoUniqueMatch:
msg = _("Multiple %(name)s matches found for "
"'%(name_or_id)s', use an ID to be more specific.") % \
{
"name": manager.resource_class.__name__.lower(),
"name_or_id": name_or_id
}
{"name": manager.resource_class.__name__.lower(),
"name_or_id": name_or_id}
raise exceptions.CommandError(msg)

View File

@ -1,43 +1,43 @@
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# 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 copy
import six
from daisyclient.common import utils
from daisyclient.openstack.common.apiclient import base
BACKEND_TYPES_PARAMS = ()
OS_REQ_ID_HDR = 'x-openstack-request-id'
class BackendTypes(base.Resource):
def __repr__(self):
return "<BackendTypes %s>" % self._info
class BackendTypesManager(base.ManagerWithFind):
resource_class = BackendTypes
def list(self, **kwargs):
pass
def get(self):
"""
get backend types
"""
url = '/v1/backend_types'
resp, body = self.client.post(url, headers=None, data=None)
return BackendTypes(self, body)
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# 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 copy
import six
from daisyclient.common import utils
from daisyclient.openstack.common.apiclient import base
BACKEND_TYPES_PARAMS = ()
OS_REQ_ID_HDR = 'x-openstack-request-id'
class BackendTypes(base.Resource):
def __repr__(self):
return "<BackendTypes %s>" % self._info
class BackendTypesManager(base.ManagerWithFind):
resource_class = BackendTypes
def list(self, **kwargs):
pass
def get(self):
"""
get backend types
"""
url = '/v1/backend_types'
resp, body = self.client.post(url, headers=None, data=None)
return BackendTypes(self, body)

View File

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

View File

@ -1,86 +1,86 @@
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# 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.
# -*- coding:utf-8 -*-
import os
def _read_template_file(args):
template_file = args.params_file_path
if not os.path.exists(template_file):
print("Params_file not exist or permission deiny.")
return
with open(template_file) as tfp:
params = ''.join(
tfp.read().replace("\\'", "").split(" ")).replace("\n", "")
return dict(eval(params))
CLUSTER_ADD_PARAMS_FILE = {
'description': 'desc',
'name': "test",
'routers': [{
'description': 'router1',
'external_logic_network': 'flat1',
'name': 'router1',
'subnets': ['subnet2', 'subnet10']}],
'networks': [],
'nodes': [],
'logic_networks': [{
'name': 'internal1',
'physnet_name': 'PRIVATE1',
'segmentation_id': 200,
'segmentation_type': 'vlan',
'shared': True,
'subnets': [{'cidr': '192.168.1.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.1.2',
'192.168.1.200']],
'gateway': '192.168.1.1',
'name': 'subnet2'},
{'cidr': '172.16.1.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['172.16.1.130',
'172.16.1.150'],
['172.16.1.151',
'172.16.1.254']],
'gateway': '172.16.1.1',
'name': 'subnet10'}],
'type': 'internal'},
{'name': 'flat1',
'physnet_name': 'physnet1',
'segmentation_type': 'flat',
'segmentation_id': -1,
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'external'}
],
'networking_parameters': {
'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 4094],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,flat,vxlan,gre',
'vlan_range': [2, 4094],
'vni_range': [2, 4094]}
}
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# 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.
# -*- coding:utf-8 -*-
import os
def _read_template_file(args):
template_file = args.params_file_path
if not os.path.exists(template_file):
print("Params_file not exist or permission deiny.")
return
with open(template_file) as tfp:
params = ''.join(
tfp.read().replace("\\'", "").split(" ")).replace("\n", "")
return dict(eval(params))
CLUSTER_ADD_PARAMS_FILE = {
'description': 'desc',
'name': "test",
'routers': [{
'description': 'router1',
'external_logic_network': 'flat1',
'name': 'router1',
'subnets': ['subnet2', 'subnet10']}],
'networks': [],
'nodes': [],
'logic_networks': [{
'name': 'internal1',
'physnet_name': 'PRIVATE1',
'segmentation_id': 200,
'segmentation_type': 'vlan',
'shared': True,
'subnets': [{'cidr': '192.168.1.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.1.2',
'192.168.1.200']],
'gateway': '192.168.1.1',
'name': 'subnet2'},
{'cidr': '172.16.1.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['172.16.1.130',
'172.16.1.150'],
['172.16.1.151',
'172.16.1.254']],
'gateway': '172.16.1.1',
'name': 'subnet10'}],
'type': 'internal'},
{'name': 'flat1',
'physnet_name': 'physnet1',
'segmentation_type': 'flat',
'segmentation_id': -1,
'shared': True,
'subnets': [{'cidr': '192.168.2.0/24',
'dns_nameservers': ['8.8.4.4',
'8.8.8.8'],
'floating_ranges': [['192.168.2.130',
'192.168.2.254']],
'gateway': '192.168.2.1',
'name': 'subnet123'}],
'type': 'external'}
],
'networking_parameters': {
'base_mac': 'fa:16:3e:00:00:00',
'gre_id_range': [2, 4094],
'net_l23_provider': 'ovs',
'public_vip': '172.16.0.3',
'segmentation_type': 'vlan,flat,vxlan,gre',
'vlan_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>',
help='the size of logic volume disk for nvoa, and the unit is MB.')
@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, \
"share" means disks come from share storage devices')
@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>',
help='the size of docker_vg(M).')
@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, \
"share" means disks come from share storage devices')
@utils.arg('--ntp-server', metavar='<NTP_SERVER>',

View File

@ -36,6 +36,6 @@ downloadcache = ~/cache/pip
# H302 import only modules
# H303 no wildcard import
# 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
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

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
# Daisy Tools Dashboard
# 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
from django.utils.translation import ugettext_lazy as _
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
# Daisy Tools Dashboard
# 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.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
# Daisy Tools Dashboard
# 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
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
# Daisy Tools Dashboard
# 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
from django.http import HttpResponse
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
# Daisy Tools Dashboard
# 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
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
# Daisy Tools Dashboard
# 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.views import generic

View File

@ -1,7 +1,20 @@
#
# Copyright ZTE
# Daisy Tools Dashboard
# 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 json
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
# Daisy Tools Dashboard
# 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.views.decorators.csrf import csrf_exempt
from django.utils.translation import ugettext_lazy as _
@ -385,11 +399,6 @@ def deploy_rule_func(request, cluster_id):
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('.')))

View File

@ -1,7 +1,21 @@
#
# Copyright ZTE
# Daisy Tools Dashboard
# 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 os
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt

View File

@ -1,7 +1,20 @@
#
# Copyright ZTE
# Daisy Tools Dashboard
# 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 json

View File

@ -1,7 +1,20 @@
#
# Copyright ZTE
# Daisy Tools Dashboard
# 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 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
# Daisy Tools Dashboard
# 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 import http
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 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
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
# Daisy Tools Dashboard
# 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

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
# Daisy Tools Dashboard
# 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.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 tables
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 django.utils.translation import ugettext_lazy as _
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.views.decorators.debug import sensitive_variables
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

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
# Daisy Tools Dashboard
# 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 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
# Daisy Tools Dashboard
# 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 import shortcuts
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
# Daisy Tools Dashboard
# 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 json

View File

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

View File

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