Add heat-watch to pep8 checks

heat-watch was missing from pep8 checks in the past.  Tidy up heat-watch
and add to run_pep8.sh.

Change-Id: I36680b24ee90a5daeb7f8d7418b665a215026325
Fixes: Bug #1131275
This commit is contained in:
Steven Dake 2013-02-27 10:39:54 -07:00 committed by Gerrit Code Review
parent 637740a4f1
commit eea4a6d16d
2 changed files with 14 additions and 12 deletions

View File

@ -46,7 +46,8 @@ from heat.common import config
from heat.common import exception from heat.common import exception
from heat.cfn_client import utils from heat.cfn_client import utils
DEFAULT_PORT=8003 DEFAULT_PORT = 8003
@utils.catch_error('alarm-describe') @utils.catch_error('alarm-describe')
def alarm_describe(options, arguments): def alarm_describe(options, arguments):
@ -54,7 +55,7 @@ def alarm_describe(options, arguments):
Describe detail for specified alarm, or all alarms Describe detail for specified alarm, or all alarms
if no AlarmName is specified if no AlarmName is specified
''' '''
parameters={} parameters = {}
try: try:
parameters['AlarmName'] = arguments.pop(0) parameters['AlarmName'] = arguments.pop(0)
except IndexError: except IndexError:
@ -64,16 +65,17 @@ def alarm_describe(options, arguments):
result = c.describe_alarm(**parameters) result = c.describe_alarm(**parameters)
print c.format_metric_alarm(result) print c.format_metric_alarm(result)
@utils.catch_error('alarm-set-state') @utils.catch_error('alarm-set-state')
def alarm_set_state(options, arguments): def alarm_set_state(options, arguments):
''' '''
Temporarily set state for specified alarm Temporarily set state for specified alarm
''' '''
usage = ('''Usage: usage = ('''Usage:
%s alarm-set-state AlarmName StateValue [StateReason]''' % %s alarm-set-state AlarmName StateValue [StateReason]''' %
(scriptname)) (scriptname))
parameters={} parameters = {}
try: try:
parameters['AlarmName'] = arguments.pop(0) parameters['AlarmName'] = arguments.pop(0)
parameters['StateValue'] = arguments.pop(0) parameters['StateValue'] = arguments.pop(0)
@ -81,7 +83,7 @@ def alarm_set_state(options, arguments):
logging.error("Must specify AlarmName and StateValue") logging.error("Must specify AlarmName and StateValue")
print usage print usage
print "StateValue must be one of %s, %s or %s" % ( print "StateValue must be one of %s, %s or %s" % (
heat_client.BotoCWClient.ALARM_STATES) heat_client.BotoCWClient.ALARM_STATES)
return utils.FAILURE return utils.FAILURE
try: try:
parameters['StateReason'] = arguments.pop(0) parameters['StateReason'] = arguments.pop(0)
@ -101,7 +103,7 @@ def metric_list(options, arguments):
''' '''
List all metric data for a given metric (or all metrics if none specified) List all metric data for a given metric (or all metrics if none specified)
''' '''
parameters={} parameters = {}
try: try:
parameters['MetricName'] = arguments.pop(0) parameters['MetricName'] = arguments.pop(0)
except IndexError: except IndexError:
@ -127,7 +129,7 @@ e.g
# specific AlarmName, due to the current engine/db cloudwatch # specific AlarmName, due to the current engine/db cloudwatch
# implementation, we should probably revisit this so we can support # implementation, we should probably revisit this so we can support
# more generic metric data collection # more generic metric data collection
parameters={} parameters = {}
try: try:
parameters['AlarmName'] = arguments.pop(0) parameters['AlarmName'] = arguments.pop(0)
parameters['Namespace'] = arguments.pop(0) parameters['Namespace'] = arguments.pop(0)
@ -188,14 +190,14 @@ def parse_options(parser, cli_args):
if options.debug: if options.debug:
logging.basicConfig(format='%(levelname)s:%(message)s', logging.basicConfig(format='%(levelname)s:%(message)s',
level=logging.DEBUG) level=logging.DEBUG)
logging.debug("Debug level logging enabled") logging.debug("Debug level logging enabled")
elif options.verbose: elif options.verbose:
logging.basicConfig(format='%(levelname)s:%(message)s', logging.basicConfig(format='%(levelname)s:%(message)s',
level=logging.INFO) level=logging.INFO)
else: else:
logging.basicConfig(format='%(levelname)s:%(message)s', logging.basicConfig(format='%(levelname)s:%(message)s',
level=logging.WARNING) level=logging.WARNING)
return (options, command, args) return (options, command, args)

View File

@ -14,4 +14,4 @@ EXCLUDE+=',*egg,build,*tools*'
${PEP8} ${EXCLUDE} . ${PEP8} ${EXCLUDE} .
# Check binaries without py extension # Check binaries without py extension
${PEP8} bin/heat-api bin/heat-api-cfn bin/heat-api-cloudwatch bin/heat-cfn bin/heat-engine ${PEP8} bin/heat-api bin/heat-api-cfn bin/heat-api-cloudwatch bin/heat-cfn bin/heat-engine bin/heat-watch