Merge "Fix flake8 errors"
This commit is contained in:
commit
539d7e5a41
@ -28,7 +28,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
|
|||||||
def write_autodoc_index():
|
def write_autodoc_index():
|
||||||
|
|
||||||
def find_autodoc_modules(module_name, sourcedir):
|
def find_autodoc_modules(module_name, sourcedir):
|
||||||
"""returns a list of modules in the SOURCE directory"""
|
"""Return a list of modules in the SOURCE directory."""
|
||||||
modlist = []
|
modlist = []
|
||||||
os.chdir(os.path.join(sourcedir, module_name))
|
os.chdir(os.path.join(sourcedir, module_name))
|
||||||
print "SEARCHING %s" % sourcedir
|
print "SEARCHING %s" % sourcedir
|
||||||
@ -77,8 +77,9 @@ def write_autodoc_index():
|
|||||||
if not(os.path.exists(MOD_DIR)):
|
if not(os.path.exists(MOD_DIR)):
|
||||||
os.mkdir(MOD_DIR)
|
os.mkdir(MOD_DIR)
|
||||||
for module in find_autodoc_modules(modulename, path):
|
for module in find_autodoc_modules(modulename, path):
|
||||||
if any([module.startswith(exclude) for exclude \
|
if any([module.startswith(exclude)
|
||||||
in EXCLUDED_MODULES]):
|
for exclude
|
||||||
|
in EXCLUDED_MODULES]):
|
||||||
print "Excluded module %s." % module
|
print "Excluded module %s." % module
|
||||||
continue
|
continue
|
||||||
mod_path = os.path.join(path, *module.split("."))
|
mod_path = os.path.join(path, *module.split("."))
|
||||||
@ -300,14 +301,14 @@ htmlhelp_basename = 'Ceilometerdoc'
|
|||||||
# -- Options for LaTeX output -------------------------------------------------
|
# -- Options for LaTeX output -------------------------------------------------
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
#'papersize': 'letterpaper',
|
#'papersize': 'letterpaper',
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
#'pointsize': '10pt',
|
#'pointsize': '10pt',
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
#'preamble': '',
|
#'preamble': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
@ -44,8 +44,9 @@ from nova.openstack.common import importutils
|
|||||||
from nova.openstack.common import log as logging
|
from nova.openstack.common import log as logging
|
||||||
from nova.openstack.common.notifier import api as notifier_api
|
from nova.openstack.common.notifier import api as notifier_api
|
||||||
|
|
||||||
# For nova_CONF.compute_manager, used in the nova_notifier module.
|
# This option is used in the nova_notifier module, so make
|
||||||
from nova import service
|
# sure it is defined.
|
||||||
|
config.cfg.CONF.import_opt('compute_manager', 'nova.service')
|
||||||
|
|
||||||
# HACK(dhellmann): Import this before any other ceilometer code
|
# HACK(dhellmann): Import this before any other ceilometer code
|
||||||
# because the notifier module messes with the import path to force
|
# because the notifier module messes with the import path to force
|
||||||
@ -156,20 +157,20 @@ class TestNovaNotifier(base.TestCase):
|
|||||||
|
|
||||||
# Terminate the instance to trigger the notification.
|
# Terminate the instance to trigger the notification.
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
# Under Grizzly, Nova has moved to no-db access on the
|
# Under Grizzly, Nova has moved to no-db access on the
|
||||||
# compute node. The compute manager uses RPC to talk to
|
# compute node. The compute manager uses RPC to talk to
|
||||||
# the conductor. We need to disable communication between
|
# the conductor. We need to disable communication between
|
||||||
# the nova manager and the remote system since we can't
|
# the nova manager and the remote system since we can't
|
||||||
# expect the message bus to be available, or the remote
|
# expect the message bus to be available, or the remote
|
||||||
# controller to be there if the message bus is online.
|
# controller to be there if the message bus is online.
|
||||||
mock.patch.object(self.compute, 'conductor_api'),
|
mock.patch.object(self.compute, 'conductor_api'),
|
||||||
# The code that looks up the instance uses a global
|
# The code that looks up the instance uses a global
|
||||||
# reference to the API, so we also have to patch that to
|
# reference to the API, so we also have to patch that to
|
||||||
# return our fake data.
|
# return our fake data.
|
||||||
mock.patch.object(nova_notifier.instance_info_source,
|
mock.patch.object(nova_notifier.instance_info_source,
|
||||||
'instance_get_by_uuid',
|
'instance_get_by_uuid',
|
||||||
self.fake_instance_ref_get),
|
self.fake_instance_ref_get),
|
||||||
):
|
):
|
||||||
self.compute.terminate_instance(self.context,
|
self.compute.terminate_instance(self.context,
|
||||||
instance=self.instance)
|
instance=self.instance)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
TMPFILE=`mktemp`
|
TMPFILE=`mktemp`
|
||||||
trap "rm -f ${TMPFILE}" EXIT
|
trap "rm -f ${TMPFILE}" EXIT
|
||||||
tools/conf/generate_sample.sh "${TMPFILE}"
|
tools/conf/generate_sample.sh "${TMPFILE}"
|
||||||
if ! cmp -s "${TMPFILE}" etc/ceilometer/ceilometer.conf.sample
|
if ! diff "${TMPFILE}" etc/ceilometer/ceilometer.conf.sample
|
||||||
then
|
then
|
||||||
echo "E: ceilometer.conf.sample is not up to date, please run tools/conf/generate_sample.sh"
|
echo "E: ceilometer.conf.sample is not up to date, please run tools/conf/generate_sample.sh"
|
||||||
exit 42
|
exit 42
|
||||||
|
@ -38,56 +38,56 @@ def main():
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='generate metering data',
|
description='generate metering data',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--interval',
|
'--interval',
|
||||||
default=10,
|
default=10,
|
||||||
type=int,
|
type=int,
|
||||||
help='the period between events, in minutes',
|
help='the period between events, in minutes',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--start',
|
'--start',
|
||||||
default=31,
|
default=31,
|
||||||
help='the number of days in the past to start timestamps',
|
help='the number of days in the past to start timestamps',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--end',
|
'--end',
|
||||||
default=2,
|
default=2,
|
||||||
help='the number of days into the future to continue timestamps',
|
help='the number of days into the future to continue timestamps',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--type',
|
'--type',
|
||||||
choices=('gauge', 'cumulative'),
|
choices=('gauge', 'cumulative'),
|
||||||
default='gauge',
|
default='gauge',
|
||||||
help='counter type',
|
help='counter type',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--unit',
|
'--unit',
|
||||||
default=None,
|
default=None,
|
||||||
help='counter unit',
|
help='counter unit',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--project',
|
'--project',
|
||||||
help='project id of owner',
|
help='project id of owner',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--user',
|
'--user',
|
||||||
help='user id of owner',
|
help='user id of owner',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'resource',
|
'resource',
|
||||||
help='the resource id for the meter data',
|
help='the resource id for the meter data',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'counter',
|
'counter',
|
||||||
help='the counter name for the meter data',
|
help='the counter name for the meter data',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'volume',
|
'volume',
|
||||||
help='the amount to attach to the meter',
|
help='the amount to attach to the meter',
|
||||||
type=int,
|
type=int,
|
||||||
default=1,
|
default=1,
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Set up logging to use the console
|
# Set up logging to use the console
|
||||||
|
@ -91,24 +91,24 @@ def send_messages(connection, topic, input):
|
|||||||
def main():
|
def main():
|
||||||
rpc.register_opts(cfg.CONF)
|
rpc.register_opts(cfg.CONF)
|
||||||
cfg.CONF.register_opts([
|
cfg.CONF.register_opts([
|
||||||
cfg.StrOpt('datafile',
|
cfg.StrOpt('datafile',
|
||||||
default=None,
|
default=None,
|
||||||
help='Data file to read or write',
|
help='Data file to read or write',
|
||||||
),
|
),
|
||||||
cfg.BoolOpt('record',
|
cfg.BoolOpt('record',
|
||||||
help='Record events',
|
help='Record events',
|
||||||
),
|
),
|
||||||
cfg.BoolOpt('replay',
|
cfg.BoolOpt('replay',
|
||||||
help='Replay events',
|
help='Replay events',
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
|
||||||
remaining_args = cfg.CONF(sys.argv)
|
remaining_args = cfg.CONF(sys.argv)
|
||||||
utils.monkey_patch()
|
#utils.monkey_patch()
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='record or play back notification events',
|
description='record or play back notification events',
|
||||||
)
|
)
|
||||||
parser.add_argument('mode',
|
parser.add_argument('mode',
|
||||||
choices=('record', 'replay', 'monitor'),
|
choices=('record', 'replay', 'monitor'),
|
||||||
help='operating mode',
|
help='operating mode',
|
||||||
|
@ -36,7 +36,7 @@ PRE_RELEASE_STATUS = "Fix Released"
|
|||||||
RELEASE_PROMPT = (
|
RELEASE_PROMPT = (
|
||||||
"Found {bug_count} '{pre_release_status}' bugs for milestone "
|
"Found {bug_count} '{pre_release_status}' bugs for milestone "
|
||||||
"{milestone_title}. Mark them 'Fix Released'? [y/n]: "
|
"{milestone_title}. Mark them 'Fix Released'? [y/n]: "
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -66,9 +66,9 @@ def show_total_resources(db, args):
|
|||||||
print u
|
print u
|
||||||
for meter in ['disk', 'cpu', 'instance']:
|
for meter in ['disk', 'cpu', 'instance']:
|
||||||
stats = db.get_statistics(storage.SampleFilter(
|
stats = db.get_statistics(storage.SampleFilter(
|
||||||
user=u,
|
user=u,
|
||||||
meter=meter,
|
meter=meter,
|
||||||
))
|
))
|
||||||
if meter in ['cpu', 'disk']:
|
if meter in ['cpu', 'disk']:
|
||||||
total = stats['max']
|
total = stats['max']
|
||||||
else:
|
else:
|
||||||
@ -85,7 +85,7 @@ def show_raw(db, args):
|
|||||||
for sample in db.get_samples(storage.SampleFilter(
|
for sample in db.get_samples(storage.SampleFilter(
|
||||||
user=u,
|
user=u,
|
||||||
resource=resource['resource_id'],
|
resource=resource['resource_id'],
|
||||||
)):
|
)):
|
||||||
print fmt % sample
|
print fmt % sample
|
||||||
|
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ COMMANDS = {
|
|||||||
'resources': show_resources,
|
'resources': show_resources,
|
||||||
'total_resources': show_total_resources,
|
'total_resources': show_total_resources,
|
||||||
'raw': show_raw,
|
'raw': show_raw,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
@ -116,7 +116,7 @@ def main(argv):
|
|||||||
# NOTE(dhellmann): Read the configuration file(s) for the
|
# NOTE(dhellmann): Read the configuration file(s) for the
|
||||||
#ceilometer collector by default.
|
#ceilometer collector by default.
|
||||||
default_config_files=['/etc/ceilometer/ceilometer.conf'],
|
default_config_files=['/etc/ceilometer/ceilometer.conf'],
|
||||||
)
|
)
|
||||||
storage.register_opts(cfg.CONF)
|
storage.register_opts(cfg.CONF)
|
||||||
db = storage.get_connection(cfg.CONF)
|
db = storage.get_connection(cfg.CONF)
|
||||||
command = extra_args[0] if extra_args else 'help'
|
command = extra_args[0] if extra_args else 'help'
|
||||||
|
2
tox.ini
2
tox.ini
@ -43,5 +43,5 @@ commands = {posargs}
|
|||||||
[flake8]
|
[flake8]
|
||||||
ignore = H301,H306
|
ignore = H301,H306
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,nova_tests
|
exclude=.venv,.git,.tox,dist,doc,./ceilometer/openstack/common,*lib/python*,*egg,tools,nova_tests,build
|
||||||
show-source = True
|
show-source = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user