Merge "Update hacking package, fix I18n style issues"
This commit is contained in:
commit
07417b163c
@ -107,8 +107,9 @@ def rec2des(rec, zonename):
|
||||
if k in iparectype2designate:
|
||||
rectypes.append(k)
|
||||
else:
|
||||
LOG.info(_LI("Skipping unknown record type %s in %s") %
|
||||
k, name)
|
||||
LOG.info(_LI("Skipping unknown record type "
|
||||
"%(type)s in %(name)s") %
|
||||
{'type': k, 'name': name})
|
||||
|
||||
desrecs = []
|
||||
for rectype in rectypes:
|
||||
@ -293,8 +294,9 @@ def main():
|
||||
fakezoneid = resp.json()['id']
|
||||
delresp = designatereq.delete(domainurl + "/" + fakezoneid)
|
||||
if delresp.status_code != 200:
|
||||
LOG.error(_LE("Unable to delete %s: %s") %
|
||||
(domname, pprint.pformat(delresp.json())))
|
||||
LOG.error(_LE("Unable to delete %(name)s: %(response)s") %
|
||||
{'name': domname, 'response': pprint.pformat(
|
||||
delresp.json())})
|
||||
else:
|
||||
exc = CannotUseIPABackend(cuiberrorstr)
|
||||
|
||||
@ -304,7 +306,7 @@ def main():
|
||||
iparesp = ipabackend._call_and_handle_error(ipareq)
|
||||
LOG.debug("Response: %s" % pprint.pformat(iparesp))
|
||||
if iparesp['error']:
|
||||
LOG.error(_LE(pprint.pformat(iparesp)))
|
||||
LOG.error(_LE("%s") % pprint.pformat(iparesp))
|
||||
|
||||
if exc:
|
||||
raise exc
|
||||
@ -348,8 +350,9 @@ def main():
|
||||
for desreq in desreqs:
|
||||
resp = designatereq.post(recurl, data=json.dumps(desreq))
|
||||
if resp.status_code == 200:
|
||||
LOG.info(_LI("Added record %s for domain %s") %
|
||||
(desreq['name'], zonename))
|
||||
LOG.info(_LI("Added record %(record)s "
|
||||
"for domain %(domain)s") %
|
||||
{'record': desreq['name'], 'domain': zonename})
|
||||
else:
|
||||
raise AddRecordError("Could not add record %s: %s" %
|
||||
(desreq['name'],
|
||||
|
@ -168,8 +168,9 @@ class Extractor:
|
||||
zone_object = dns.zone.from_file(zonefile,
|
||||
allow_include=True)
|
||||
except dns.zone.UnknownOrigin:
|
||||
LOG.info(_LI('%s is missing $ORIGIN, inserting %s') %
|
||||
(zonefile, name))
|
||||
LOG.info(_LI('%(zonefile)s is missing $ORIGIN, '
|
||||
'inserting %(name)s') %
|
||||
{'zonefile': zonefile, 'name': name})
|
||||
zone_object = dns.zone.from_file(zonefile,
|
||||
allow_include=True,
|
||||
origin=name)
|
||||
|
@ -115,8 +115,9 @@ class Backend(DriverPlugin):
|
||||
except exceptions.DomainNotFound as e:
|
||||
# NOTE(Kiall): This means a domain was missing from the backend.
|
||||
# Good thing we're doing a sync!
|
||||
LOG.warn(_LW("Failed to delete domain '%s' during sync. "
|
||||
"Message: %s"), domain['id'], str(e))
|
||||
LOG.warn(_LW("Failed to delete domain '%(domain)s' during sync. "
|
||||
"Message: %(message)s"),
|
||||
{'domain': domain['id'], 'message': str(e)})
|
||||
|
||||
# Next, re-create the domain in the backend.
|
||||
self.create_domain(context, domain)
|
||||
@ -140,9 +141,11 @@ class Backend(DriverPlugin):
|
||||
except exceptions.RecordNotFound as e:
|
||||
# NOTE(Kiall): This means a record was missing from the backend.
|
||||
# Good thing we're doing a sync!
|
||||
LOG.warn(_LW("Failed to delete record '%s' in domain '%s' "
|
||||
"during sync. Message: %s"), record['id'],
|
||||
domain['id'], str(e))
|
||||
LOG.warn(_LW("Failed to delete record '%(record)s' "
|
||||
"in domain '%(domain)s' during sync. "
|
||||
"Message: %(message)s"),
|
||||
{'record': record['id'], 'domain': domain['id'],
|
||||
'message': str(e)})
|
||||
|
||||
# Finally, re-create the record in the backend.
|
||||
self.create_record(context, domain, recordset, record)
|
||||
|
@ -58,8 +58,9 @@ class Bind9Backend(base.Backend):
|
||||
except utils.processutils.ProcessExecutionError as proc_exec_err:
|
||||
stderr = proc_exec_err.stderr
|
||||
if stderr.count("rndc: 'reload' failed: not found") is not 0:
|
||||
LOG.warn(_LW("Domain %s (%s) missing from backend, "
|
||||
"recreating"), domain['name'], domain['id'])
|
||||
LOG.warn(_LW("Domain %(d_name)s (%(d_id)s) "
|
||||
"missing from backend, recreating"),
|
||||
{'d_name': domain['name'], 'd_id': domain['id']})
|
||||
self._sync_domain(domain, new_domain_flag=True)
|
||||
else:
|
||||
raise proc_exec_err
|
||||
|
@ -327,7 +327,8 @@ class DynECTBackend(base.Backend):
|
||||
timings=cfg.CONF[GROUP].timings)
|
||||
|
||||
def create_domain(self, context, domain):
|
||||
LOG.info(_LI('Creating domain %s / %s'), domain['id'], domain['name'])
|
||||
LOG.info(_LI('Creating domain %(d_id)s / %(d_name)s'),
|
||||
{'d_id': domain['id'], 'd_name': domain['name']})
|
||||
|
||||
url = '/Secondary/%s' % domain['name'].rstrip('.')
|
||||
data = {
|
||||
@ -349,15 +350,17 @@ class DynECTBackend(base.Backend):
|
||||
LOG.debug('Discarding update_domain call, not-applicable')
|
||||
|
||||
def delete_domain(self, context, domain):
|
||||
LOG.info(_LI('Deleting domain %s / %s'), domain['id'], domain['name'])
|
||||
LOG.info(_LI('Deleting domain %(d_id)s / %(d_name)s'),
|
||||
{'d_id': domain['id'], 'd_name': domain['name']})
|
||||
url = '/Zone/%s' % domain['name'].rstrip('.')
|
||||
client = self.get_client()
|
||||
try:
|
||||
client.delete(url)
|
||||
except DynClientError as e:
|
||||
if e.http_status == 404:
|
||||
LOG.warn(_LW("Attempt to delete %s / %s caused 404, "
|
||||
"ignoring."), domain['id'], domain['name'])
|
||||
LOG.warn(_LW("Attempt to delete %(d_id)s / %(d_name)s "
|
||||
"caused 404, ignoring."),
|
||||
{'d_id': domain['id'], 'd_name': domain['name']})
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
@ -54,31 +54,36 @@ class FakeBackend(base.Backend):
|
||||
LOG.info(_LI('Delete Domain %r') % domain)
|
||||
|
||||
def create_recordset(self, context, domain, recordset):
|
||||
LOG.info(_LI('Create RecordSet %r / %r') % (domain, recordset))
|
||||
LOG.info(_LI('Create RecordSet %(domain)r / %(recordset)r') %
|
||||
{'domain': domain, 'recordset': recordset})
|
||||
|
||||
def update_recordset(self, context, domain, recordset):
|
||||
LOG.info(_LI('Update RecordSet %r / %r') % (domain, recordset))
|
||||
LOG.info(_LI('Update RecordSet %(domain)r / %(recordset)r') %
|
||||
{'domain': domain, 'recordset': recordset})
|
||||
|
||||
def delete_recordset(self, context, domain, recordset):
|
||||
LOG.info(_LI('Delete RecordSet %r / %r') % (domain, recordset))
|
||||
LOG.info(_LI('Delete RecordSet %(domain)r / %(recordset)r') %
|
||||
{'domain': domain, 'recordset': recordset})
|
||||
|
||||
def create_record(self, context, domain, recordset, record):
|
||||
LOG.info(_LI('Create Record %r / %r / %r') %
|
||||
(domain, recordset, record))
|
||||
LOG.info(_LI('Create Record %(domain)r / %(recordset)r / %(record)r') %
|
||||
{'domain': domain, 'recordset': recordset, 'record': record})
|
||||
|
||||
def update_record(self, context, domain, recordset, record):
|
||||
LOG.info(_LI('Update Record %r / %r / %r') %
|
||||
(domain, recordset, record))
|
||||
LOG.info(_LI('Update Record %(domain)r / %(recordset)r / %(record)r') %
|
||||
{'domain': domain, 'recordset': recordset, 'record': record})
|
||||
|
||||
def delete_record(self, context, domain, recordset, record):
|
||||
LOG.info(_LI('Delete Record %r / %r / %r') %
|
||||
(domain, recordset, record))
|
||||
LOG.info(_LI('Delete Record %(domain)r / %(recordset)r / %(record)r') %
|
||||
{'domain': domain, 'recordset': recordset, 'record': record})
|
||||
|
||||
def sync_domain(self, context, domain, records):
|
||||
LOG.info(_LI('Sync Domain %r / %r') % (domain, records))
|
||||
LOG.info(_LI('Sync Domain %(domain)r / %(records)r') %
|
||||
{'domain': domain, 'records': records})
|
||||
|
||||
def sync_record(self, context, domain, record):
|
||||
LOG.info(_LI('Sync Record %r / %r') % (domain, record))
|
||||
LOG.info(_LI('Sync Record %(domain)r / %(record)r') %
|
||||
{'domain': domain, 'record': record})
|
||||
|
||||
def ping(self, context):
|
||||
LOG.info(_LI('Ping'))
|
||||
|
@ -1270,8 +1270,10 @@ class Service(service.Service):
|
||||
zone = self.storage_api.find_domain(
|
||||
elevated_context, {'name': zone_name})
|
||||
except exceptions.DomainNotFound:
|
||||
msg = _LI('Creating zone for %s:%s - %s zone %s') % \
|
||||
(floatingip_id, region, fip['address'], zone_name)
|
||||
msg = _LI('Creating zone for %(fip_id)s:%(region)s - '
|
||||
'%(fip_addr)s zone %(zonename)s') % \
|
||||
{'fip_id': floatingip_id, 'region': region,
|
||||
'fip_addr': fip['address'], 'zonename': zone_name}
|
||||
LOG.info(msg)
|
||||
|
||||
email = cfg.CONF['service:central'].managed_resource_email
|
||||
|
@ -59,9 +59,10 @@ class DatabaseCommands(base.Commands):
|
||||
raise Exception('Database not yet initialized')
|
||||
|
||||
LOG.info(_LI("Attempting to synchronize database from version "
|
||||
"'%s' to '%s'"),
|
||||
current_version,
|
||||
target_version if target_version is not None else "latest")
|
||||
"'%(curr_version)s' to '%(tgt_version)s'"),
|
||||
{'curr_version': current_version,
|
||||
'tgt_version': target_version if
|
||||
target_version is not None else "latest"})
|
||||
|
||||
if target_version and target_version < current_version:
|
||||
versioning_api.downgrade(url=url, repository=REPOSITORY,
|
||||
|
@ -61,9 +61,10 @@ class DatabaseCommands(base.Commands):
|
||||
raise Exception('PowerDNS database not yet initialized')
|
||||
|
||||
LOG.info(_LI("Attempting to synchronize PowerDNS database "
|
||||
"from version '%s' to '%s'"),
|
||||
current_version,
|
||||
target_version if target_version is not None else "latest")
|
||||
"from version '%(curr_version)s' to '%(tgt_version)s'"),
|
||||
{'curr_version': current_version,
|
||||
'tgt_version': target_version if
|
||||
target_version is not None else "latest"})
|
||||
|
||||
if target_version and target_version < current_version:
|
||||
versioning_api.downgrade(url=url, repository=REPOSITORY,
|
||||
|
@ -124,8 +124,9 @@ class NeutronNetworkAPI(NetworkAPI):
|
||||
LOG.exception(e)
|
||||
return
|
||||
except Exception as e:
|
||||
LOG.error(_LE('Failed calling Neutron %s - %s'),
|
||||
region, endpoint)
|
||||
LOG.error(_LE('Failed calling Neutron '
|
||||
'%(region)s - %(endpoint)s'),
|
||||
{'region': region, 'endpoint': endpoint})
|
||||
LOG.exception(e)
|
||||
failed.append((e, endpoint, region))
|
||||
return
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
hacking>=0.8.0,<0.9
|
||||
hacking>=0.9.2,<0.10
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
|
21
tox.ini
21
tox.ini
@ -29,7 +29,26 @@ commands = flake8
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = H302,H306,H401,H402,H404
|
||||
# ignored flake8 codes:
|
||||
# H302 import only modules
|
||||
# H306 imports not in alphabetical order
|
||||
# H401 docstring should not start with a space
|
||||
# H402 one line docstring needs punctuation
|
||||
# H404 multi line docstring should start with a summary
|
||||
|
||||
# TODO: The following ignored codes need review
|
||||
# H104 file contains nothing more than comments
|
||||
# H236 Python 3.x incompatible __metaclass__, use six.add_metaclass()
|
||||
# H305 imports not grouped correctly
|
||||
# H307 like imports should be grouped together
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
# H904 Wrap long lines in parentheses instead of a backslash
|
||||
# E111 Indentation is not a multiple of four
|
||||
# E126 continuation line over-indented for hanging indent
|
||||
# E128 continuation line under-indented for visual indent
|
||||
# E251 unexpected spaces around keyword / parameter equals
|
||||
# E265 Block comment should start with '# '
|
||||
ignore = H104,H236,H302,H305,H306,H307,H401,H402,H404,H405,H904,E111,E126,E128,E251,E265
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*openstack/deprecated*,*lib/python*,*egg,build,tools
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user