Fixed kwargs being defaulted to CONF values

The Trove code is full of numerous cases where kwargs are
defaulted to CONF values. This is an error-prone
way of setting up a default value, as python sets these one
time only. This fix accounts for that.

Change-Id: Icc0858ccb2d3e2584bf6f3d1542a7d631b251ac8
Closes-Bug: 1571076
This commit is contained in:
Brandon Irizarry
2016-04-16 22:55:50 +00:00
parent 69c03b9629
commit 64a869dbaf
4 changed files with 9 additions and 6 deletions
+2 -1
View File
@@ -138,7 +138,8 @@ class TroveBaseTraits(object):
self.context = ctxt
return self
def notify(self, event_type, publisher_id=CONF.host):
def notify(self, event_type, publisher_id=None):
publisher_id = publisher_id or CONF.host
event_type = self.event_type_format % event_type
event_payload = self.serialize(self.context)
LOG.debug('Sending event: %(event_type)s, %(payload)s' %
+3 -2
View File
@@ -40,8 +40,7 @@ def normalize_url(url):
def get_endpoint(service_catalog, service_type=None,
endpoint_region=CONF.os_region_name,
endpoint_type='publicURL'):
endpoint_region=None, endpoint_type='publicURL'):
"""
Select an endpoint from the service catalog
@@ -53,6 +52,8 @@ def get_endpoint(service_catalog, service_type=None,
Some parts copied from glance/common/auth.py.
"""
endpoint_region = endpoint_region or CONF.os_region_name
if not service_catalog:
raise exception.EmptyCatalog()
+2 -1
View File
@@ -280,7 +280,8 @@ def correct_id_with_req(id, request):
return id
def generate_random_password(password_length=CONF.default_password_length):
def generate_random_password(password_length=None):
password_length = password_length or CONF.default_password_length
return passlib_utils.generate_password(size=password_length)
@@ -473,9 +473,9 @@ class RedisAdmin(object):
_("Redis command '%(cmd_name)s %(cmd_args)s' failed.")
% {'cmd_name': cmd_name, 'cmd_args': ' '.join(cmd_args)})
def wait_until(self, key, wait_value, section=None,
timeout=CONF.usage_timeout):
def wait_until(self, key, wait_value, section=None, timeout=None):
"""Polls redis until the specified 'key' changes to 'wait_value'."""
timeout = timeout or CONF.usage_timeout
LOG.debug("Waiting for Redis '%s' to be: %s." % (key, wait_value))
def _check_info():