flake8 codestyle fixes and tox flake8 setting enable
Fix major below issues: E741 ambiguous variable name 'l' ./openstack/python-horizon/centos/files/guni_config.py E402 module level import not at top of file ./openstack/python-horizon/centos/files/local_settings.py E265 block comment should start with '# ' ./openstack/python-horizon/centos/files/local_settings.py Story: 2003428 Task: 24617 Change-Id: I9d4d6c33ce032849f09e2ec232c83909fc6690a3 Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
parent
db03094634
commit
0de76ec71d
@ -23,10 +23,10 @@ def worker_abort(worker):
|
|||||||
f = os.path.join(path, i)
|
f = os.path.join(path, i)
|
||||||
if os.path.exists(f):
|
if os.path.exists(f):
|
||||||
try:
|
try:
|
||||||
l = os.readlink(f)
|
link = os.readlink(f)
|
||||||
if fnmatch.fnmatch(l, pattern):
|
if fnmatch.fnmatch(link, pattern):
|
||||||
worker.log.info(l)
|
worker.log.info(link)
|
||||||
os.remove(l)
|
os.remove(link)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@ from openstack_dashboard.settings import HORIZON_CONFIG
|
|||||||
|
|
||||||
from tsconfig.tsconfig import distributed_cloud_role
|
from tsconfig.tsconfig import distributed_cloud_role
|
||||||
|
|
||||||
|
# Custom STX settings
|
||||||
|
import configss
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
# This setting controls whether or not compression is enabled. Disabling
|
# This setting controls whether or not compression is enabled. Disabling
|
||||||
@ -896,21 +899,7 @@ ALLOWED_PRIVATE_SUBNET_CIDR = {'ipv4': [], 'ipv6': []}
|
|||||||
# Once the password expires keystone will deny the access and users must
|
# Once the password expires keystone will deny the access and users must
|
||||||
# contact an admin to change their password.
|
# contact an admin to change their password.
|
||||||
# PASSWORD_EXPIRES_WARNING_THRESHOLD_DAYS = 0
|
# PASSWORD_EXPIRES_WARNING_THRESHOLD_DAYS = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Custom WRS settings
|
|
||||||
import configss
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = ["*"]
|
ALLOWED_HOSTS = ["*"]
|
||||||
|
|
||||||
|
|
||||||
HORIZON_CONFIG["password_autocomplete"] = "off"
|
HORIZON_CONFIG["password_autocomplete"] = "off"
|
||||||
|
|
||||||
# The OPENSTACK_HEAT_STACK settings can be used to disable password
|
# The OPENSTACK_HEAT_STACK settings can be used to disable password
|
||||||
@ -936,7 +925,7 @@ try:
|
|||||||
|
|
||||||
OPENSTACK_HOST = configss.CONFSS['shared_services']['openstack_host']
|
OPENSTACK_HOST = configss.CONFSS['shared_services']['openstack_host']
|
||||||
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
|
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
|
||||||
AVAILABLE_REGIONS = [(OPENSTACK_KEYSTONE_URL, configss.CONFSS['shared_services']['region_name']),]
|
AVAILABLE_REGIONS = [(OPENSTACK_KEYSTONE_URL, configss.CONFSS['shared_services']['region_name'])]
|
||||||
REGION_NAME = configss.CONFSS['shared_services']['region_name']
|
REGION_NAME = configss.CONFSS['shared_services']['region_name']
|
||||||
SS_ENABLED = "True"
|
SS_ENABLED = "True"
|
||||||
else:
|
else:
|
||||||
@ -1190,6 +1179,3 @@ LOGGING = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ if command is None:
|
|||||||
|
|
||||||
syslog.openlog('nova_migration_wrapper')
|
syslog.openlog('nova_migration_wrapper')
|
||||||
|
|
||||||
|
|
||||||
def allow_command(user, args):
|
def allow_command(user, args):
|
||||||
syslog.syslog(syslog.LOG_INFO, "Allowing connection='{}' command={} ".format(
|
syslog.syslog(syslog.LOG_INFO, "Allowing connection='{}' command={} ".format(
|
||||||
ssh_connection,
|
ssh_connection,
|
||||||
@ -18,6 +19,7 @@ def allow_command(user, args):
|
|||||||
))
|
))
|
||||||
os.execlp('sudo', 'sudo', '-u', user, *args)
|
os.execlp('sudo', 'sudo', '-u', user, *args)
|
||||||
|
|
||||||
|
|
||||||
def deny_command(args):
|
def deny_command(args):
|
||||||
syslog.syslog(syslog.LOG_ERR, "Denying connection='{}' command={}".format(
|
syslog.syslog(syslog.LOG_ERR, "Denying connection='{}' command={}".format(
|
||||||
ssh_connection,
|
ssh_connection,
|
||||||
@ -26,6 +28,7 @@ def deny_command(args):
|
|||||||
sys.stderr.write('Forbidden\n')
|
sys.stderr.write('Forbidden\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
# Handle libvirt ssh tunnel script snippet
|
# Handle libvirt ssh tunnel script snippet
|
||||||
# https://github.com/libvirt/libvirt/blob/f0803dae93d62a4b8a2f67f4873c290a76d978b3/src/rpc/virnetsocket.c#L890
|
# https://github.com/libvirt/libvirt/blob/f0803dae93d62a4b8a2f67f4873c290a76d978b3/src/rpc/virnetsocket.c#L890
|
||||||
libvirt_sock = '/var/run/libvirt/libvirt-sock'
|
libvirt_sock = '/var/run/libvirt/libvirt-sock'
|
||||||
@ -49,11 +52,13 @@ cold_migration_cmds = [
|
|||||||
]
|
]
|
||||||
rootwrap_args = ['/usr/bin/nova-rootwrap', '/etc/nova/migration/rootwrap.conf']
|
rootwrap_args = ['/usr/bin/nova-rootwrap', '/etc/nova/migration/rootwrap.conf']
|
||||||
|
|
||||||
|
|
||||||
def validate_cold_migration_cmd(args):
|
def validate_cold_migration_cmd(args):
|
||||||
target_path = os.path.normpath(args[-1])
|
target_path = os.path.normpath(args[-1])
|
||||||
cmd = args[:-1]
|
cmd = args[:-1]
|
||||||
return cmd in cold_migration_cmds and target_path.startswith(cold_migration_root)
|
return cmd in cold_migration_cmds and target_path.startswith(cold_migration_root)
|
||||||
|
|
||||||
|
|
||||||
# Rules
|
# Rules
|
||||||
args = command.split(' ')
|
args = command.split(' ')
|
||||||
if command == live_migration_tunnel_cmd:
|
if command == live_migration_tunnel_cmd:
|
||||||
|
@ -61,4 +61,3 @@ else:
|
|||||||
with app_lock:
|
with app_lock:
|
||||||
if application is None:
|
if application is None:
|
||||||
application = init_application()
|
application = init_application()
|
||||||
|
|
||||||
|
@ -16,7 +16,9 @@ import logging
|
|||||||
|
|
||||||
|
|
||||||
# logger
|
# logger
|
||||||
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG,
|
||||||
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
logging.getLogger('multiprocessing').setLevel(logging.DEBUG)
|
logging.getLogger('multiprocessing').setLevel(logging.DEBUG)
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -82,6 +84,7 @@ def get_l3_cache_allocation_info():
|
|||||||
_L3_CACHE[cache]['num_cbm_bits'] = None
|
_L3_CACHE[cache]['num_cbm_bits'] = None
|
||||||
return _L3_CACHE
|
return _L3_CACHE
|
||||||
|
|
||||||
|
|
||||||
def get_l3_cache_allocation_schemata(uuid=None):
|
def get_l3_cache_allocation_schemata(uuid=None):
|
||||||
"""Get resctrl L3 cache allocation technology schemata CBM corresponding
|
"""Get resctrl L3 cache allocation technology schemata CBM corresponding
|
||||||
to instance uuid, or the default schemata if uuid not provided.
|
to instance uuid, or the default schemata if uuid not provided.
|
||||||
@ -136,6 +139,7 @@ def get_l3_cache_allocation_schemata(uuid=None):
|
|||||||
|
|
||||||
return schemata
|
return schemata
|
||||||
|
|
||||||
|
|
||||||
def get_all_l3_schemata():
|
def get_all_l3_schemata():
|
||||||
"""Get L3 CLOS schemata CBM for all resctrl uuids.
|
"""Get L3 CLOS schemata CBM for all resctrl uuids.
|
||||||
:param: None
|
:param: None
|
||||||
@ -266,6 +270,7 @@ def print_all_instance_schematas(l3_info=None, default_schemata=None, schematas=
|
|||||||
list_to_range(input_list=cbm_s) or '-'))
|
list_to_range(input_list=cbm_s) or '-'))
|
||||||
print('CLOSIDS/type: %d total, %d used' % (closids_total, closids_used))
|
print('CLOSIDS/type: %d total, %d used' % (closids_total, closids_used))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
l3_info = get_l3_cache_allocation_info()
|
l3_info = get_l3_cache_allocation_info()
|
||||||
if not _L3_RESCTRL_SUPPORT:
|
if not _L3_RESCTRL_SUPPORT:
|
||||||
@ -276,6 +281,7 @@ def main():
|
|||||||
default_schemata=default_schemata,
|
default_schemata=default_schemata,
|
||||||
schematas=schematas)
|
schematas=schematas)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
bashate >= 0.2
|
bashate >= 0.2
|
||||||
PyYAML >= 3.1.0
|
PyYAML >= 3.1.0
|
||||||
yamllint >= 0.5.2
|
yamllint >= 0.5.2
|
||||||
|
flake8 >= 2.5.4 # MIT
|
||||||
|
22
tox.ini
22
tox.ini
@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = linters
|
envlist = linters,pep8
|
||||||
minversion = 2.3
|
minversion = 2.3
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
@ -30,11 +30,23 @@ commands =
|
|||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
usedevelop = False
|
usedevelop = False
|
||||||
skip_install = True
|
description =
|
||||||
deps =
|
Run style checks.
|
||||||
pep8
|
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
pep8
|
flake8
|
||||||
|
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
|
# E501 skipped because some of the code files include templates
|
||||||
|
# that end up quite wide
|
||||||
|
# H405: multi line docstring summary not separated with an empty line
|
||||||
|
show-source = True
|
||||||
|
ignore = E123,E125,E501,H405
|
||||||
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||||
|
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
Loading…
Reference in New Issue
Block a user