[PATCH 2/2 v2 (added missing parenthesis)] Fix the error log when creating users and groups (#965571)
David Shea
dshea at redhat.com
Mon Aug 12 14:18:16 UTC 2013
Only log "User/Group ... already exists" if that's actually the reason
that createUser/createGroup failed.
---
pyanaconda/kickstart.py | 6 ++----
pyanaconda/users.py | 2 ++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 103a7de..be19c9a 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -549,8 +549,7 @@ class Group(commands.group.F12_Group):
for grp in self.groupList:
kwargs = grp.__dict__
kwargs.update({"root": ROOT_PATH})
- if not users.createGroup(grp.name, **kwargs):
- log.error("Group %s already exists, not creating." % grp.name)
+ users.createGroup(grp.name, **kwargs)
class IgnoreDisk(commands.ignoredisk.RHEL6_IgnoreDisk):
def parse(self, args):
@@ -1331,8 +1330,7 @@ class User(commands.user.F12_User):
for usr in self.userList:
kwargs = usr.__dict__
kwargs.update({"algo": algo, "root": ROOT_PATH})
- if not users.createUser(usr.name, **kwargs):
- log.error("User %s already exists, not creating." % usr.name)
+ users.createUser(usr.name, **kwargs)
class VolGroup(commands.volgroup.FC16_VolGroup):
def execute(self, storage, ksdata, instClass):
diff --git a/pyanaconda/users.py b/pyanaconda/users.py
index a1483b3..13c3e33 100644
--- a/pyanaconda/users.py
+++ b/pyanaconda/users.py
@@ -219,6 +219,7 @@ class Users:
try:
if self.admin.lookupGroupByName(group_name):
+ log.error("Group %s already exists, not creating." % grp.name)
os._exit(1)
groupEnt = self.admin.initGroup(group_name)
@@ -285,6 +286,7 @@ class Users:
try:
if self.admin.lookupUserByName(user_name):
+ log.error("User %s already exists, not creating." % usr.name)
os._exit(1)
userEnt = self.admin.initUser(user_name)
--
1.8.3.1
More information about the anaconda-patches
mailing list