Create DS user and group during ipa-restore

ipa-restore would fail if DS user did not exist. Check for presence of DS
user and group and create them if needed.

https://fedorahosted.org/freeipa/ticket/3856
This commit is contained in:
Ana Krivokapic
2013-09-02 10:56:19 +02:00
committed by Petr Viktorin
parent f40cb4c031
commit de7b1f86dc
4 changed files with 59 additions and 52 deletions

View File

@@ -971,16 +971,7 @@ def main():
ipaservices.backup_and_replace_hostname(fstore, sstore, host_name)
# Create DS group if it doesn't exist yet
try:
grp.getgrnam(dsinstance.DS_GROUP)
root_logger.debug("ds group %s exists" % dsinstance.DS_GROUP)
except KeyError:
args = ["/usr/sbin/groupadd", "-r", dsinstance.DS_GROUP]
try:
ipautil.run(args)
root_logger.debug("done adding DS group")
except ipautil.CalledProcessError, e:
root_logger.critical("failed to add DS group: %s" % e)
dsinstance.create_ds_group()
# Create a directory server instance
if external != 2: