dist/common/scripts: drop makedirs(), use os.makedirs()
Since os.makedirs() has exist_ok option, no need to create wrapper function.
This commit is contained in:
2
dist/common/scripts/scylla_coredump_setup
vendored
2
dist/common/scripts/scylla_coredump_setup
vendored
@@ -75,7 +75,7 @@ WantedBy=multi-user.target
|
||||
'''[1:-1]
|
||||
with open('/etc/systemd/system/var-lib-systemd-coredump.mount', 'w') as f:
|
||||
f.write(dot_mount)
|
||||
makedirs('/var/lib/scylla/coredump')
|
||||
os.makedirs('/var/lib/scylla/coredump', exist_ok=True)
|
||||
systemd_unit.reload()
|
||||
systemd_unit('var-lib-systemd-coredump.mount').enable()
|
||||
systemd_unit('var-lib-systemd-coredump.mount').start()
|
||||
|
||||
6
dist/common/scripts/scylla_raid_setup
vendored
6
dist/common/scripts/scylla_raid_setup
vendored
@@ -138,7 +138,7 @@ if __name__ == '__main__':
|
||||
f.write(res)
|
||||
f.write('\nMAILADDR root')
|
||||
|
||||
makedirs(mount_at)
|
||||
os.makedirs(mount_at, exist_ok=True)
|
||||
|
||||
uuid = out(f'blkid -s UUID -o value {fsdev}')
|
||||
after = 'local-fs.target'
|
||||
@@ -163,7 +163,7 @@ WantedBy=multi-user.target
|
||||
f.write(unit_data)
|
||||
mounts_conf = '/etc/systemd/system/scylla-server.service.d/mounts.conf'
|
||||
if not os.path.exists(mounts_conf):
|
||||
makedirs('/etc/systemd/system/scylla-server.service.d/')
|
||||
os.makedirs('/etc/systemd/system/scylla-server.service.d/', exist_ok=True)
|
||||
with open(mounts_conf, 'w') as f:
|
||||
f.write(f'[Unit]\nRequiresMountsFor={mount_at}\n')
|
||||
else:
|
||||
@@ -183,7 +183,7 @@ WantedBy=multi-user.target
|
||||
|
||||
for d in ['coredump', 'data', 'commitlog', 'hints', 'view_hints', 'saved_caches']:
|
||||
dpath = '{}/{}'.format(root, d)
|
||||
makedirs(dpath)
|
||||
os.makedirs(dpath, exist_ok=True)
|
||||
os.chown(dpath, uid, gid)
|
||||
|
||||
if is_debian_variant():
|
||||
|
||||
5
dist/common/scripts/scylla_util.py
vendored
5
dist/common/scripts/scylla_util.py
vendored
@@ -582,11 +582,6 @@ def hex2list(hex_str):
|
||||
return ",".join(cpu_list)
|
||||
|
||||
|
||||
def makedirs(name):
|
||||
if not os.path.isdir(name):
|
||||
os.makedirs(name)
|
||||
|
||||
|
||||
def rmtree(path):
|
||||
if not os.path.islink(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
Reference in New Issue
Block a user