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)
|
||||
if os.path.exists(f):
|
||||
try:
|
||||
l = os.readlink(f)
|
||||
if fnmatch.fnmatch(l, pattern):
|
||||
worker.log.info(l)
|
||||
os.remove(l)
|
||||
link = os.readlink(f)
|
||||
if fnmatch.fnmatch(link, pattern):
|
||||
worker.log.info(link)
|
||||
os.remove(link)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
@ -10,6 +10,9 @@ from openstack_dashboard.settings import HORIZON_CONFIG
|
||||
|
||||
from tsconfig.tsconfig import distributed_cloud_role
|
||||
|
||||
# Custom STX settings
|
||||
import configss
|
||||
|
||||
DEBUG = False
|
||||
|
||||
# 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
|
||||
# contact an admin to change their password.
|
||||
# PASSWORD_EXPIRES_WARNING_THRESHOLD_DAYS = 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Custom WRS settings
|
||||
import configss
|
||||
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
||||
|
||||
HORIZON_CONFIG["password_autocomplete"] = "off"
|
||||
|
||||
# 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_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']
|
||||
SS_ENABLED = "True"
|
||||
else:
|
||||
@ -1190,6 +1179,3 @@ LOGGING = {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@ if command is None:
|
||||
|
||||
syslog.openlog('nova_migration_wrapper')
|
||||
|
||||
|
||||
def allow_command(user, args):
|
||||
syslog.syslog(syslog.LOG_INFO, "Allowing connection='{}' command={} ".format(
|
||||
ssh_connection,
|
||||
@ -18,6 +19,7 @@ def allow_command(user, args):
|
||||
))
|
||||
os.execlp('sudo', 'sudo', '-u', user, *args)
|
||||
|
||||
|
||||
def deny_command(args):
|
||||
syslog.syslog(syslog.LOG_ERR, "Denying connection='{}' command={}".format(
|
||||
ssh_connection,
|
||||
@ -26,6 +28,7 @@ def deny_command(args):
|
||||
sys.stderr.write('Forbidden\n')
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# Handle libvirt ssh tunnel script snippet
|
||||
# https://github.com/libvirt/libvirt/blob/f0803dae93d62a4b8a2f67f4873c290a76d978b3/src/rpc/virnetsocket.c#L890
|
||||
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']
|
||||
|
||||
|
||||
def validate_cold_migration_cmd(args):
|
||||
target_path = os.path.normpath(args[-1])
|
||||
cmd = args[:-1]
|
||||
return cmd in cold_migration_cmds and target_path.startswith(cold_migration_root)
|
||||
|
||||
|
||||
# Rules
|
||||
args = command.split(' ')
|
||||
if command == live_migration_tunnel_cmd:
|
||||
|
@ -61,4 +61,3 @@ else:
|
||||
with app_lock:
|
||||
if application is None:
|
||||
application = init_application()
|
||||
|
||||
|
@ -16,7 +16,9 @@ import logging
|
||||
|
||||
|
||||
# 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)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -82,6 +84,7 @@ def get_l3_cache_allocation_info():
|
||||
_L3_CACHE[cache]['num_cbm_bits'] = None
|
||||
return _L3_CACHE
|
||||
|
||||
|
||||
def get_l3_cache_allocation_schemata(uuid=None):
|
||||
"""Get resctrl L3 cache allocation technology schemata CBM corresponding
|
||||
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
|
||||
|
||||
|
||||
def get_all_l3_schemata():
|
||||
"""Get L3 CLOS schemata CBM for all resctrl uuids.
|
||||
: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 '-'))
|
||||
print('CLOSIDS/type: %d total, %d used' % (closids_total, closids_used))
|
||||
|
||||
|
||||
def main():
|
||||
l3_info = get_l3_cache_allocation_info()
|
||||
if not _L3_RESCTRL_SUPPORT:
|
||||
@ -276,6 +281,7 @@ def main():
|
||||
default_schemata=default_schemata,
|
||||
schematas=schematas)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(0)
|
||||
|
@ -1,3 +1,4 @@
|
||||
bashate >= 0.2
|
||||
PyYAML >= 3.1.0
|
||||
yamllint >= 0.5.2
|
||||
flake8 >= 2.5.4 # MIT
|
||||
|
22
tox.ini
22
tox.ini
@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = linters
|
||||
envlist = linters,pep8
|
||||
minversion = 2.3
|
||||
skipsdist = True
|
||||
|
||||
@ -30,11 +30,23 @@ commands =
|
||||
|
||||
[testenv:pep8]
|
||||
usedevelop = False
|
||||
skip_install = True
|
||||
deps =
|
||||
pep8
|
||||
description =
|
||||
Run style checks.
|
||||
|
||||
|
||||
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]
|
||||
commands = {posargs}
|
||||
|
Loading…
Reference in New Issue
Block a user