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:
parent
c63963c99f
commit
492d39933d
@ -964,22 +964,6 @@ def setup_logging(opts):
|
|||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
pylorax_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 = logging.StreamHandler()
|
||||||
sh.setLevel(logging.INFO)
|
sh.setLevel(logging.INFO)
|
||||||
fmt = logging.Formatter("%(asctime)s: %(message)s")
|
fmt = logging.Formatter("%(asctime)s: %(message)s")
|
||||||
@ -1002,6 +986,19 @@ def main():
|
|||||||
program_log.addHandler(fh)
|
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__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser( description="Create Live Install Media",
|
parser = argparse.ArgumentParser( description="Create Live Install Media",
|
||||||
fromfile_prefix_chars="@" )
|
fromfile_prefix_chars="@" )
|
||||||
|
Loading…
Reference in New Issue
Block a user