pylint: fixed logging

Change-Id: I1c1336edce7664f65e0fa2a01492c3544f59a14e
Related-Bug: #1910543
This commit is contained in:
Sorin Sbarnea 2021-01-06 12:37:23 +00:00 committed by Sorin Sbârnea
parent 8e57c59eb5
commit d10497246e
9 changed files with 79 additions and 80 deletions

View File

@ -17,8 +17,6 @@ disable =
import-error, import-error,
inconsistent-return-statements, inconsistent-return-statements,
invalid-name, invalid-name,
logging-format-interpolation,
logging-not-lazy,
lost-exception, lost-exception,
missing-class-docstring, missing-class-docstring,
missing-function-docstring, missing-function-docstring,

View File

@ -154,7 +154,7 @@ class TripleoInventory(object):
stack = self.hclient.stacks.get(self.plan_name) stack = self.hclient.stacks.get(self.plan_name)
except HTTPNotFound: except HTTPNotFound:
LOG.warning("Stack not found: %s. Only the undercloud will " LOG.warning("Stack not found: %s. Only the undercloud will "
"be added to the inventory." % self.plan_name) "be added to the inventory.", self.plan_name)
stack = None stack = None
return stack return stack

View File

@ -552,47 +552,47 @@ class ProcessTemplatesTest(base.TestCase):
self.assertEqual(expected, role_data) self.assertEqual(expected, role_data)
mock_log.assert_has_calls([ mock_log.assert_has_calls([
mock.call.warning( mock.call.warning(
"DEPRECATED: Role 'CephStorageFoo' without the 'ceph' tag " "DEPRECATED: Role '%s' without the 'ceph' tag "
"detected, the tag was added automatically. Please add the " "detected, the tag was added automatically. Please add the "
"'ceph' tag in roles data. The function to automatically " "'ceph' tag in roles data. The function to automatically "
"add tags based on role name will be removed in the next " "add tags based on role name will be removed in the next "
"release."), "release.", "CephStorageFoo"),
mock.call.warning( mock.call.warning(
"DEPRECATED: Role 'CephStorageFoo' without the 'storage' " "DEPRECATED: Role '%s' without the 'storage' "
"tag detected, the tag was added automatically. Please add " "tag detected, the tag was added automatically. Please add "
"the 'storage' tag in roles data. The function to " "the 'storage' tag in roles data. The function to "
"automatically add tags based on role name will be removed in " "automatically add tags based on role name will be removed in "
"the next release."), "the next release.", "CephStorageFoo"),
mock.call.warning( mock.call.warning(
"DEPRECATED: Role 'ObjectStorageFoo' without the 'storage' " "DEPRECATED: Role '%s' without the 'storage' "
"tag detected, the tag was added automatically. Please add " "tag detected, the tag was added automatically. Please add "
"the 'storage' tag in roles data. The function to " "the 'storage' tag in roles data. The function to "
"automatically add tags based on role name will be " "automatically add tags based on role name will be "
"removed in the next release."), "removed in the next release.", "ObjectStorageFoo"),
mock.call.warning( mock.call.warning(
"DEPRECATED: Role 'BlockStorageFoo' without the 'storage' tag " "DEPRECATED: Role '%s' without the 'storage' tag "
"detected, the tag was added automatically. Please add " "detected, the tag was added automatically. Please add "
"the 'storage' tag in roles data. The function to " "the 'storage' tag in roles data. The function to "
"automatically add tags based on role name will be removed " "automatically add tags based on role name will be removed "
"in the next release."), "in the next release.", "BlockStorageFoo"),
mock.call.warning( mock.call.warning(
"DEPRECATED: Role 'ComputeOvsDpdkFoo' without the 'compute' " "DEPRECATED: Role '%s' without the 'compute' "
"tag detected, the tag was added automatically. Please add " "tag detected, the tag was added automatically. Please add "
"the 'compute' tag in roles data. The function to " "the 'compute' tag in roles data. The function to "
"automatically add tags based on role name will be removed in " "automatically add tags based on role name will be removed in "
"the next release."), "the next release.", "ComputeOvsDpdkFoo"),
mock.call.warning( mock.call.warning(
"DEPRECATED: Role 'ComputeOvsDpdkFoo' without the 'ovsdpdk' " "DEPRECATED: Role '%s' without the 'ovsdpdk' "
"tag detected, the tag was added automatically. Please add " "tag detected, the tag was added automatically. Please add "
"the 'ovsdpdk' tag in roles data. The function to " "the 'ovsdpdk' tag in roles data. The function to "
"automatically add tags based on role name will be removed in " "automatically add tags based on role name will be removed in "
"the next release."), "the next release.", "ComputeOvsDpdkFoo"),
mock.call.warning( mock.call.warning(
"DEPRECATED: Role 'ComputeOvsDpdkBar' without the 'compute' " "DEPRECATED: Role '%s' without the 'compute' "
"tag detected, the tag was added automatically. Please add " "tag detected, the tag was added automatically. Please add "
"the 'compute' tag in roles data. The function to " "the 'compute' tag in roles data. The function to "
"automatically add tags based on role name will be removed in " "automatically add tags based on role name will be removed in "
"the next release."), "the next release.", "ComputeOvsDpdkBar"),
]) ])

View File

@ -179,12 +179,12 @@ class Config(object):
def snapshot_config_dir(self, repo, commit_message): def snapshot_config_dir(self, repo, commit_message):
if repo.is_dirty(untracked_files=True): if repo.is_dirty(untracked_files=True):
self.log.info('Snapshotting {}'.format(repo.working_dir)) self.log.info('Snapshotting %s', repo.working_dir)
# Use repo.git.add directly as repo.index.add defaults to forcing # Use repo.git.add directly as repo.index.add defaults to forcing
# commit of ignored files, which we don't want. # commit of ignored files, which we don't want.
repo.git.add('.') repo.git.add('.')
commit = repo.index.commit(commit_message) commit = repo.index.commit(commit_message)
self.log.info('Created commit {}'.format(commit.hexsha)) self.log.info('Created commit %s', commit.hexsha)
else: else:
self.log.info('No changes to commit') self.log.info('No changes to commit')
@ -201,8 +201,8 @@ class Config(object):
# Create config directory # Create config directory
if os.path.exists(config_dir) and preserve_config_dir is False: if os.path.exists(config_dir) and preserve_config_dir is False:
try: try:
self.log.info("Directory %s already exists, removing" self.log.info("Directory %s already exists, removing",
% config_dir) config_dir)
shutil.rmtree(config_dir) shutil.rmtree(config_dir)
except OSError as e: except OSError as e:
message = 'Failed to remove: %s, error: %s' % (config_dir, message = 'Failed to remove: %s, error: %s' % (config_dir,
@ -220,8 +220,8 @@ class Config(object):
try: try:
yaml.safe_load(template_data) yaml.safe_load(template_data)
except (yaml.scanner.ScannerError, yaml.YAMLError) as e: except (yaml.scanner.ScannerError, yaml.YAMLError) as e:
self.log.error("Config for file {} contains invalid yaml, got " self.log.error("Config for file %s contains invalid yaml, got "
"error {}".format(yaml_file, e)) "error %s", yaml_file, e)
raise e raise e
def render_network_config(self, config_dir): def render_network_config(self, config_dir):
@ -422,7 +422,7 @@ class Config(object):
[]).append(config_dict) []).append(config_dict)
except KeyError: except KeyError:
self.log.warning('Server with id %s is ignored from config ' self.log.warning('Server with id %s is ignored from config '
'(may be blacklisted)' % server_id) '(may be blacklisted)', server_id)
# continue the loop as this server_id is probably excluded # continue the loop as this server_id is probably excluded
continue continue
except Exception as err: except Exception as err:
@ -562,7 +562,7 @@ class Config(object):
os.path.join(config_dir, 'deployments.yaml')) os.path.join(config_dir, 'deployments.yaml'))
self.log.info("The TripleO configuration has been successfully " self.log.info("The TripleO configuration has been successfully "
"generated into: %s" % config_dir) "generated into: %s", config_dir)
return config_dir return config_dir
def download_config(self, name, config_dir, config_type=None, def download_config(self, name, config_dir, config_type=None,
@ -577,7 +577,7 @@ class Config(object):
self._mkdir(config_dir) self._mkdir(config_dir)
git_repo = self.initialize_git_repo(config_dir) git_repo = self.initialize_git_repo(config_dir)
self.log.info("Generating configuration under the directory: " self.log.info("Generating configuration under the directory: "
"%s" % config_dir) "%s", config_dir)
self.write_config(stack, name, config_dir, config_type) self.write_config(stack, name, config_dir, config_type)
self.snapshot_config_dir(git_repo, commit_message) self.snapshot_config_dir(git_repo, commit_message)
return config_dir return config_dir

View File

@ -395,8 +395,9 @@ def register_ironic_node(node, client):
ironic_node = client.node.create(**create_map) ironic_node = client.node.create(**create_map)
for port in node.get('ports', []): for port in node.get('ports', []):
LOG.debug('Creating Bare Metal port for node: %s, with properties: %s.' LOG.debug(
% (ironic_node.uuid, port)) 'Creating Bare Metal port for node: %s, with properties: %s.',
ironic_node.uuid, port)
client.port.create( client.port.create(
address=port.get('address'), address=port.get('address'),
physical_network=port.get('physical_network', 'ctlplane'), physical_network=port.get('physical_network', 'ctlplane'),
@ -527,10 +528,10 @@ def _clean_up_extra_nodes(seen, client, remove=False):
extra_nodes = all_nodes - {n.uuid for n in seen} extra_nodes = all_nodes - {n.uuid for n in seen}
for node in extra_nodes: for node in extra_nodes:
if remove: if remove:
LOG.debug('Removing extra registered node %s.' % node) LOG.debug('Removing extra registered node %s.', node)
remove_func(node) remove_func(node)
else: else:
LOG.debug('Extra registered node %s found.' % node) LOG.debug('Extra registered node %s found.', node)
def register_all_nodes(nodes_list, client, remove=False, glance_client=None, def register_all_nodes(nodes_list, client, remove=False, glance_client=None,

View File

@ -289,8 +289,8 @@ def get_role_data(swift, container=constants.DEFAULT_CONTAINER_NAME):
constants.OVERCLOUD_J2_ROLES_NAME) constants.OVERCLOUD_J2_ROLES_NAME)
role_data = yaml.safe_load(j2_role_file) role_data = yaml.safe_load(j2_role_file)
except swiftexceptions.ClientException: except swiftexceptions.ClientException:
LOG.info("No %s file found, not filtering container images by role" LOG.info("No %s file found, not filtering container images by role",
% constants.OVERCLOUD_J2_ROLES_NAME) constants.OVERCLOUD_J2_ROLES_NAME)
role_data = None role_data = None
return role_data return role_data
@ -396,7 +396,7 @@ def generate_passwords(swift, heat, mistral=None,
env = get_env(swift, container) env = get_env(swift, container)
except swiftexceptions.ClientException as err: except swiftexceptions.ClientException as err:
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
container, err)) container, err)) # pylint: disable=logging-not-lazy
LOG.exception(err_msg) LOG.exception(err_msg)
return RuntimeError(err_msg) return RuntimeError(err_msg)
@ -412,7 +412,7 @@ def generate_passwords(swift, heat, mistral=None,
param_defaults = stack_env.get('parameter_defaults', {}) param_defaults = stack_env.get('parameter_defaults', {})
param_defaults[pw_res] = res.attributes['value'] param_defaults[pw_res] = res.attributes['value']
except heat_exc.HTTPNotFound: except heat_exc.HTTPNotFound:
LOG.debug('Heat resouce not found: %s' % pw_res) LOG.debug('Heat resouce not found: %s', pw_res)
pass pass
except heat_exc.HTTPNotFound: except heat_exc.HTTPNotFound:

View File

@ -157,8 +157,9 @@ def create_and_upload_tarball(swiftservice,
LOG.info(r['object']) LOG.info(r['object'])
elif 'for_object' in r: elif 'for_object' in r:
LOG.info( LOG.info(
'%s segment %s' % (r['for_object'], '%s segment %s',
r['segment_index']) r['for_object'],
r['segment_index']
) )
else: else:
error = r['error'] error = r['error']
@ -169,11 +170,11 @@ def create_and_upload_tarball(swiftservice,
) )
elif r['action'] == "upload_object": elif r['action'] == "upload_object":
LOG.error( LOG.error(
"Failed to upload object %s to container %s: %s" % "Failed to upload object %s to container %s: %s",
(container, r['object'], error) container, r['object'], error
) )
else: else:
LOG.error("%s" % error) LOG.error("%s", error)
except SwiftError as e: except SwiftError as e:
LOG.error(e.value) LOG.error(e.value)

View File

@ -24,7 +24,7 @@ DEFAULT_TARBALL_EXCLUDES = ['.git', '.tox', '*.pyc', '*.pyo']
def create_tarball(directory, filename, options='-czf', def create_tarball(directory, filename, options='-czf',
excludes=DEFAULT_TARBALL_EXCLUDES): excludes=DEFAULT_TARBALL_EXCLUDES):
"""Create a tarball of a directory.""" """Create a tarball of a directory."""
LOG.debug('Creating tarball of %s at location %s' % (directory, filename)) LOG.debug('Creating tarball of %s at location %s', directory, filename)
cmd = ['/usr/bin/tar', '-C', directory, options, filename] cmd = ['/usr/bin/tar', '-C', directory, options, filename]
for x in excludes: for x in excludes:
cmd.extend(['--exclude', x]) cmd.extend(['--exclude', x])
@ -33,8 +33,8 @@ def create_tarball(directory, filename, options='-czf',
def tarball_extract_to_swift_container(object_client, filename, container): def tarball_extract_to_swift_container(object_client, filename, container):
LOG.debug('Uploading filename %s to Swift container %s' % (filename, LOG.debug('Uploading filename %s to Swift container %s',
container)) filename, container)
with open(filename, 'rb') as f: with open(filename, 'rb') as f:
object_client.put_object( object_client.put_object(
container=container, container=container,
@ -49,11 +49,11 @@ def extract_tarball(directory, tarball, options='-xf', remove=False):
"""Extracts the tarball contained in the directory.""" """Extracts the tarball contained in the directory."""
full_path = directory + '/' + tarball full_path = directory + '/' + tarball
if not os.path.exists(full_path): if not os.path.exists(full_path):
LOG.debug('Tarball %s does not exist' % full_path) LOG.debug('Tarball %s does not exist', full_path)
else: else:
LOG.debug('Extracting tarball %s' % full_path) LOG.debug('Extracting tarball %s', full_path)
cmd = ['/usr/bin/tar', '-C', directory, options, full_path] cmd = ['/usr/bin/tar', '-C', directory, options, full_path]
processutils.execute(*cmd) processutils.execute(*cmd)
if remove: if remove:
LOG.debug('Removing tarball %s' % full_path) LOG.debug('Removing tarball %s', full_path)
os.remove(full_path) os.remove(full_path)

View File

@ -85,12 +85,12 @@ def j2_render_and_put(swift, j2_template, j2_data, yaml_f,
try: try:
# write the template back to the plan container # write the template back to the plan container
LOG.info("Writing rendered template %s" % yaml_f) LOG.info("Writing rendered template %s", yaml_f)
swiftutils.put_object_string(swift, container, yaml_f, swiftutils.put_object_string(swift, container, yaml_f,
r_template) r_template)
except swiftexceptions.ClientException: except swiftexceptions.ClientException:
error_msg = ("Error storing file %s in container %s" error_msg = ("Error storing file %s in container %s",
% (yaml_f, container)) yaml_f, container)
LOG.error(error_msg) LOG.error(error_msg)
raise RuntimeError(error_msg) raise RuntimeError(error_msg)
@ -104,11 +104,11 @@ def get_j2_excludes_file(swift, container=constants.DEFAULT_CONTAINER_NAME):
j2_excl_data = {"name": []} j2_excl_data = {"name": []}
LOG.info("j2_excludes.yaml is either empty or there are " LOG.info("j2_excludes.yaml is either empty or there are "
"no templates to exclude, defaulting the J2 " "no templates to exclude, defaulting the J2 "
"excludes list to: %s" % j2_excl_data) "excludes list to: %s", j2_excl_data)
except swiftexceptions.ClientException: except swiftexceptions.ClientException:
j2_excl_data = {"name": []} j2_excl_data = {"name": []}
LOG.info("No J2 exclude file found, defaulting " LOG.info("No J2 exclude file found, defaulting "
"the J2 excludes list to: %s" % j2_excl_data) "the J2 excludes list to: %s", j2_excl_data)
return j2_excl_data return j2_excl_data
@ -121,18 +121,18 @@ def heat_resource_exists(heat, stack, nested_stack_name, resource_name):
nested_stack = heat.resources.get(stack.id, nested_stack_name) nested_stack = heat.resources.get(stack.id, nested_stack_name)
except heat_exc.HTTPNotFound: except heat_exc.HTTPNotFound:
LOG.debug( LOG.debug(
"Resource does not exist because {} stack does " "Resource does not exist because %s stack does "
"not exist".format(nested_stack_name)) "not exist", nested_stack_name)
return False return False
try: try:
heat.resources.get(nested_stack.physical_resource_id, heat.resources.get(nested_stack.physical_resource_id,
resource_name) resource_name)
except heat_exc.HTTPNotFound: except heat_exc.HTTPNotFound:
LOG.debug("Resource does not exist: {}".format(resource_name)) LOG.debug("Resource does not exist: %s", resource_name)
return False return False
else: else:
LOG.debug("Resource exists: {}".format(resource_name)) LOG.debug("Resource exists: %s", resource_name)
return True return True
@ -149,14 +149,14 @@ def _set_tags_based_on_role_name(role_data):
"detected, the tag was added automatically. Please " "detected, the tag was added automatically. Please "
"add the 'compute' tag in roles data. The function to " "add the 'compute' tag in roles data. The function to "
"automatically add tags based on role name will be " "automatically add tags based on role name will be "
"removed in the next release." % role_name) "removed in the next release.", role_name)
if role_name.startswith('Ceph') and 'ceph' not in role['tags']: if role_name.startswith('Ceph') and 'ceph' not in role['tags']:
role['tags'].append('ceph') role['tags'].append('ceph')
LOG.warning("DEPRECATED: Role '%s' without the 'ceph' tag " LOG.warning("DEPRECATED: Role '%s' without the 'ceph' tag "
"detected, the tag was added automatically. Please " "detected, the tag was added automatically. Please "
"add the 'ceph' tag in roles data. The function to " "add the 'ceph' tag in roles data. The function to "
"automatically add tags based on role name will be " "automatically add tags based on role name will be "
"removed in the next release." % role_name) "removed in the next release.", role_name)
if (role_name.startswith('ComputeOvsDpdk') if (role_name.startswith('ComputeOvsDpdk')
and 'ovsdpdk' not in role['tags']): and 'ovsdpdk' not in role['tags']):
role['tags'].append('ovsdpdk') role['tags'].append('ovsdpdk')
@ -164,7 +164,7 @@ def _set_tags_based_on_role_name(role_data):
"detected, the tag was added automatically. Please " "detected, the tag was added automatically. Please "
"add the 'ovsdpdk' tag in roles data. The function to " "add the 'ovsdpdk' tag in roles data. The function to "
"automatically add tags based on role name will be " "automatically add tags based on role name will be "
"removed in the next release." % role_name) "removed in the next release.", role_name)
if ((role_name.startswith('ObjectStorage') if ((role_name.startswith('ObjectStorage')
or role_name.startswith('BlockStorage') or role_name.startswith('BlockStorage')
or role_name.startswith('Ceph')) or role_name.startswith('Ceph'))
@ -174,7 +174,7 @@ def _set_tags_based_on_role_name(role_data):
"detected, the tag was added automatically. Please " "detected, the tag was added automatically. Please "
"add the 'storage' tag in roles data. The function to " "add the 'storage' tag in roles data. The function to "
"automatically add tags based on role name will be " "automatically add tags based on role name will be "
"removed in the next release." % role_name) "removed in the next release.", role_name)
def process_custom_roles(swift, heat, def process_custom_roles(swift, heat,
@ -184,8 +184,8 @@ def process_custom_roles(swift, heat,
swift, container, constants.OVERCLOUD_J2_ROLES_NAME) swift, container, constants.OVERCLOUD_J2_ROLES_NAME)
role_data = yaml.safe_load(j2_role_file) role_data = yaml.safe_load(j2_role_file)
except swiftexceptions.ClientException: except swiftexceptions.ClientException:
LOG.info("No %s file found, skipping jinja templating" LOG.info("No %s file found, skipping jinja templating",
% constants.OVERCLOUD_J2_ROLES_NAME) constants.OVERCLOUD_J2_ROLES_NAME)
return return
try: try:
@ -197,8 +197,8 @@ def process_custom_roles(swift, heat,
network_data = [] network_data = []
except swiftexceptions.ClientException: except swiftexceptions.ClientException:
# Until t-h-t contains network_data.yaml we tolerate a missing file # Until t-h-t contains network_data.yaml we tolerate a missing file
LOG.warning("No %s file found, ignoring" LOG.warning("No %s file found, ignoring",
% constants.OVERCLOUD_J2_ROLES_NAME) constants.OVERCLOUD_J2_ROLES_NAME)
network_data = [] network_data = []
j2_excl_data = get_j2_excludes_file(swift, container) j2_excl_data = get_j2_excludes_file(swift, container)
@ -208,8 +208,8 @@ def process_custom_roles(swift, heat,
# we j2 render any with the .j2.yaml suffix # we j2 render any with the .j2.yaml suffix
container_files = swift.get_container(container) container_files = swift.get_container(container)
except swiftexceptions.ClientException as ex: except swiftexceptions.ClientException as ex:
error_msg = ("Error listing contents of container %s : %s" error_msg = ("Error listing contents of container %s : %s",
% (container, six.text_type(ex))) container, six.text_type(ex))
LOG.error(error_msg) LOG.error(error_msg)
raise RuntimeError(error_msg) raise RuntimeError(error_msg)
@ -245,7 +245,7 @@ def process_custom_roles(swift, heat,
LOG.info("Upgrade compatibility enabled for legacy " LOG.info("Upgrade compatibility enabled for legacy "
"network resource Internal.") "network resource Internal.")
else: else:
LOG.info("skipping %s network: network is disabled." % LOG.info("skipping %s network: network is disabled.",
n.get('name')) n.get('name'))
plan_utils.cache_delete(swift, container, "tripleo.parameters.get") plan_utils.cache_delete(swift, container, "tripleo.parameters.get")
@ -260,13 +260,13 @@ def process_custom_roles(swift, heat,
# 3. *.j2.yaml - we template with all roles_data, # 3. *.j2.yaml - we template with all roles_data,
# and create one file common to all roles # and create one file common to all roles
if f.endswith('.role.j2.yaml'): if f.endswith('.role.j2.yaml'):
LOG.info("jinja2 rendering role template %s" % f) LOG.info("jinja2 rendering role template %s", f)
j2_template = swiftutils.get_object_string(swift, j2_template = swiftutils.get_object_string(swift,
container, f) container, f)
LOG.info("jinja2 rendering roles %s" % "," LOG.info("jinja2 rendering roles %s", ","
.join(role_names)) .join(role_names))
for role in role_names: for role in role_names:
LOG.info("jinja2 rendering role %s" % role) LOG.info("jinja2 rendering role %s", role)
out_f = "-".join( out_f = "-".join(
[role.lower(), [role.lower(),
os.path.basename(f).replace('.role.j2.yaml', os.path.basename(f).replace('.role.j2.yaml',
@ -290,20 +290,20 @@ def process_custom_roles(swift, heat,
# Backwards compatibility with templates # Backwards compatibility with templates
# that specify {{role}} vs {{role.name}} # that specify {{role}} vs {{role.name}}
j2_data = {'role': role, 'networks': network_data} j2_data = {'role': role, 'networks': network_data}
LOG.debug("role legacy path for role %s" % role) LOG.debug("role legacy path for role %s", role)
j2_render_and_put(swift, j2_template, j2_render_and_put(swift, j2_template,
j2_data, out_f_path, j2_data, out_f_path,
container) container)
else: else:
LOG.info("Skipping rendering of %s, defined in %s" % LOG.info("Skipping rendering of %s, defined in %s",
(out_f_path, j2_excl_data)) out_f_path, j2_excl_data)
elif (f.endswith('.network.j2.yaml')): elif (f.endswith('.network.j2.yaml')):
LOG.info("jinja2 rendering network template %s" % f) LOG.info("jinja2 rendering network template %s", f)
j2_template = swiftutils.get_object_string(swift, j2_template = swiftutils.get_object_string(swift,
container, container,
f) f)
LOG.info("jinja2 rendering networks %s" % ",".join(n_map)) LOG.info("jinja2 rendering networks %s", ",".join(n_map))
for network in n_map: for network in n_map:
j2_data = {'network': n_map[network]} j2_data = {'network': n_map[network]}
# Output file names in "<name>.yaml" format # Output file names in "<name>.yaml" format
@ -321,11 +321,11 @@ def process_custom_roles(swift, heat,
j2_data, out_f_path, j2_data, out_f_path,
container) container)
else: else:
LOG.info("Skipping rendering of %s, defined in %s" % LOG.info("Skipping rendering of %s, defined in %s",
(out_f_path, j2_excl_data)) out_f_path, j2_excl_data)
elif f.endswith('.j2.yaml'): elif f.endswith('.j2.yaml'):
LOG.info("jinja2 rendering %s" % f) LOG.info("jinja2 rendering %s", f)
j2_template = swiftutils.get_object_string(swift, j2_template = swiftutils.get_object_string(swift,
container, container,
f) f)
@ -367,8 +367,7 @@ def prune_unused_services(swift, role_data,
for service in to_remove: for service in to_remove:
try: try:
role.get('ServicesDefault', []).remove(service) role.get('ServicesDefault', []).remove(service)
LOG.debug('Removing {} from {} role'.format( LOG.debug('Removing %s from %s role', service, role_name)
service, role_name))
except ValueError: except ValueError:
pass pass
LOG.debug('Saving updated role data to swift') LOG.debug('Saving updated role data to swift')
@ -404,13 +403,13 @@ def build_heat_args(swift, heat, container=constants.DEFAULT_CONTAINER_NAME):
template_object = os.path.join(swift.url, container, template_object = os.path.join(swift.url, container,
template_name) template_name)
LOG.debug('Template: %s' % template_name) LOG.debug('Template: %s', template_name)
try: try:
template_files, template = plan_utils.get_template_contents( template_files, template = plan_utils.get_template_contents(
swift, template_object) swift, template_object)
except Exception as err: except Exception as err:
error_text = six.text_type(err) error_text = six.text_type(err)
LOG.exception("Error occurred while fetching %s" % template_object) LOG.exception("Error occurred while fetching %s", template_object)
temp_env_paths = [] temp_env_paths = []
try: try: