Some code clean up in climate_filter.py

1) Use () for long string
2) Enable I18N for audit log
3) Remove else: for a simple if statement

Change-Id: Id0c64c04aa325483f9d4225a31fde7f79720cc84
This commit is contained in:
Jay Lau 2014-05-06 18:02:09 +08:00
parent 5c3d416eae
commit 8d48f69189
1 changed files with 4 additions and 5 deletions

View File

@ -84,14 +84,14 @@ class ClimateFilter(filters.BaseHostFilter):
if agg['availability_zone'].startswith( if agg['availability_zone'].startswith(
cfg.CONF['climate:physical:host'].climate_az_prefix): cfg.CONF['climate:physical:host'].climate_az_prefix):
pools.append(agg) pools.append(agg)
if agg['name'] == \ if agg['name'] == (
cfg.CONF['climate:physical:host'].aggregate_freepool_name: cfg.CONF['climate:physical:host'].aggregate_freepool_name):
pools.append(agg) pools.append(agg)
if pools: if pools:
if not requested_pools: if not requested_pools:
# Host is in a Pool and none requested # Host is in a Pool and none requested
LOG.audit("In a user pool or in the freepool") LOG.audit(_("In a user pool or in the freepool"))
return False return False
# Find aggregate which matches Pool # Find aggregate which matches Pool
@ -127,5 +127,4 @@ class ClimateFilter(filters.BaseHostFilter):
if requested_pools: if requested_pools:
# Host is not in a Pool and Pool requested # Host is not in a Pool and Pool requested
return False return False
else: return True
return True