Remove leading slash in os.path.join()

The os.path.join() function discard any previos paths/variables when it
encounters one starting with a leading "/" so the statedir & bundle name were
completely ignored when it ran into /usr/share/defaults/...
This fixes it so the path is correctly made, and the dirs and files should be
installed correctly.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
This commit is contained in:
Tudor Marcu
2016-03-25 13:08:32 -07:00
parent 4cdc1ea888
commit 24d8b59fdf
+2 -4
View File
@@ -283,15 +283,13 @@ def create_chroots(args, state_dir, bundles, yum_conf):
"""Read the configuration file for our script values"""
conf = config['swupd']
bundlename = conf['BUNDLE']
url = conf['URL']
contenturl = conf['CONTENTURL']
versionurl = conf['VERSIONURL']
formatname = conf['FORMAT']
confpath = os.path.join(out_dir, bundlename, "/usr/share/defaults/swupd/")
"""Do not add a leading slash on anything except the first variable in os.path.join!"""
confpath = os.path.join(out_dir, bundlename, "usr/share/defaults/swupd/")
os.mkdir(confpath)
with open(os.path.join(confpath, "url"), "w") as file:
file.writelines(url)
with open(os.path.join(confpath, "contenturl"), "w") as file:
file.writelines(contenturl)
with open(os.path.join(confpath, "versionurl"), "w") as file: