Python 2.6 str.format() compatibility fixes.

This commit is contained in:
Matt Clay 2018-01-10 12:03:25 -08:00
commit 797664d9cb
20 changed files with 43 additions and 62 deletions

View file

@ -80,7 +80,7 @@ class DimensionDataModule(object):
# Region and location are common to all Dimension Data modules.
region = self.module.params['region']
self.region = 'dd-{}'.format(region)
self.region = 'dd-{0}'.format(region)
self.location = self.module.params['location']
libcloud.security.VERIFY_SSL_CERT = self.module.params['validate_certs']

View file

@ -227,7 +227,7 @@ def search_by_attributes(service, **kwargs):
# Check if 'list' method support search(look for search parameter):
if 'search' in inspect.getargspec(service.list)[0]:
res = service.list(
search=' and '.join('{}={}'.format(k, v) for k, v in kwargs.items())
search=' and '.join('{0}={1}'.format(k, v) for k, v in kwargs.items())
)
else:
res = [
@ -712,7 +712,7 @@ class BaseModule(object):
if entity is None:
self._module.fail_json(
msg="Entity not found, can't run action '{}'.".format(
msg="Entity not found, can't run action '{0}'.".format(
action
)
)

View file

@ -105,7 +105,7 @@ def uldap():
def construct():
try:
secret_file = open('/etc/ldap.secret', 'r')
bind_dn = 'cn=admin,{}'.format(base_dn())
bind_dn = 'cn=admin,{0}'.format(base_dn())
except IOError: # pragma: no cover
secret_file = open('/etc/machine.secret', 'r')
bind_dn = config_registry()["ldap/hostdn"]