livemedia-creator: Fix logging (#1361031)

The cherry-pick for commit 0d28b9e09c
dropped the patch into the middle of setup_logging and added a (unused)
main() function so things would still run, but logging wasn't being
setup properly.

This removes the main() and moves the default_image_name() function
after all of the logging setup code.

Resolves: rhbz#1361031
This commit is contained in:
Brian C. Lane 2016-07-28 14:11:37 -07:00
parent c63963c99f
commit 492d39933d

View File

@ -964,22 +964,6 @@ def setup_logging(opts):
log.setLevel(logging.DEBUG)
pylorax_log.setLevel(logging.DEBUG)
def default_image_name(compression, basename):
""" Return a default image name with the correct suffix for the compression type.
:param str compression: Compression type
:param str basename: Base filename
:returns: basename with compression suffix
If the compression is unknown it defaults to xz
"""
SUFFIXES = {"xz": ".xz", "gzip": ".gz", "bzip2": ".bz2", "lzma": ".lzma"}
return basename + SUFFIXES.get(compression, ".xz")
def main():
sh = logging.StreamHandler()
sh.setLevel(logging.INFO)
fmt = logging.Formatter("%(asctime)s: %(message)s")
@ -1002,6 +986,19 @@ def main():
program_log.addHandler(fh)
def default_image_name(compression, basename):
""" Return a default image name with the correct suffix for the compression type.
:param str compression: Compression type
:param str basename: Base filename
:returns: basename with compression suffix
If the compression is unknown it defaults to xz
"""
SUFFIXES = {"xz": ".xz", "gzip": ".gz", "bzip2": ".bz2", "lzma": ".lzma"}
return basename + SUFFIXES.get(compression, ".xz")
if __name__ == '__main__':
parser = argparse.ArgumentParser( description="Create Live Install Media",
fromfile_prefix_chars="@" )