Commit 9051387e authored by Xavier Thompson's avatar Xavier Thompson

slapformat: WIP: Rename creatPath and createUser into ensurePath and ensureUser

parent 0588d597
...@@ -258,7 +258,7 @@ class Computer(object): ...@@ -258,7 +258,7 @@ class Computer(object):
# Software root path # Software root path
ensureDir(self.conf.software_root, 0o755) ensureDir(self.conf.software_root, 0o755)
# Software user # Software user
self.user.createUser() self.user.ensureUser()
uid, gid = self.user.getIds() uid, gid = self.user.getIds()
os.chown(self.conf.software_root, uid, gid) os.chown(self.conf.software_root, uid, gid)
# Non local bind for IPv6 ranges # Non local bind for IPv6 ranges
...@@ -428,8 +428,8 @@ class Partition(object): ...@@ -428,8 +428,8 @@ class Partition(object):
# XXX # XXX
def format(self, interface): def format(self, interface):
self.user.createUser() self.user.ensureUser()
self.createPath() self.ensurePath()
for ip in self.ipv4_list: for ip in self.ipv4_list:
interface.addAddress(ip, self.reference) interface.addAddress(ip, self.reference)
for ip in self.ipv6_list: for ip in self.ipv6_list:
...@@ -441,7 +441,7 @@ class Partition(object): ...@@ -441,7 +441,7 @@ class Partition(object):
for ip in self.ipv6_list: for ip in self.ipv6_list:
interface.checkAddress(ip, self.reference) interface.checkAddress(ip, self.reference)
def createPath(self): def ensurePath(self):
if not os.path.exists(self.path): if not os.path.exists(self.path):
os.mkdir(self.path) os.mkdir(self.path)
uid, gid = self.user.getIds() uid, gid = self.user.getIds()
...@@ -461,7 +461,7 @@ class User(object): ...@@ -461,7 +461,7 @@ class User(object):
self.path = path self.path = path
self.groups = groups self.groups = groups
def createUser(self): def ensureUser(self):
groupname = 'grp_' + self.name if sys.platform == 'cygwin' else self.name groupname = 'grp_' + self.name if sys.platform == 'cygwin' else self.name
if not self.groupExists(groupname): if not self.groupExists(groupname):
call(['groupadd', groupname]) call(['groupadd', groupname])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment