Add --tmp to lorax-composer and set default tempdir

It was using /tmp/ which can fill up quickly when building images.
Default to /var/tmp unless the user passes --tmp /tmp/
This commit is contained in:
Brian C. Lane 2018-05-10 08:53:12 -07:00
parent 9a1dce5619
commit 3c31e52b3c

View File

@ -31,6 +31,7 @@ import pwd
import selinux
import sys
import subprocess
import tempfile
from threading import Lock
from gevent import socket
from gevent.wsgi import WSGIServer
@ -66,8 +67,10 @@ def get_parser():
help="show program's version number and exit")
parser.add_argument("-c", "--config", default="/etc/lorax/composer.conf", metavar="CONFIG",
help="Path to lorax-composer configuration file.")
parser.add_argument( "--releasever", default=None, metavar="STRING",
help="Release version to use for $releasever in dnf repository urls" )
parser.add_argument("--releasever", default=None, metavar="STRING",
help="Release version to use for $releasever in dnf repository urls")
parser.add_argument("--tmp", default="/var/tmp",
help="Top level temporary directory")
parser.add_argument("BLUEPRINTS", metavar="BLUEPRINTS",
help="Path to the blueprints")
@ -156,6 +159,7 @@ if __name__ == '__main__':
print(VERSION)
sys.exit(0)
tempfile.tempdir = opts.tmp
logpath = os.path.abspath(os.path.dirname(opts.logfile))
if not os.path.isdir(logpath):
os.makedirs(logpath)