From b1b4c7049f64a97a92808524c7f0d266c1e1f05b Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Jun 26 2014 12:26:13 +0000 Subject: Echo messages outputted to stderr by domain join commands if enabled. --- diff --git a/authconfig.py b/authconfig.py index 52ef5bc..f010249 100755 --- a/authconfig.py +++ b/authconfig.py @@ -941,9 +941,9 @@ class AuthconfigTUI(Authconfig): self.screen.suspend() self.info.update() if self.info.enableWinbind: - self.info.joinDomain(False) + self.info.joinDomain(True) elif self.info.enableIPAv2: - self.info.joinIPADomain(False) + self.info.joinIPADomain(True) self.screen.resume() return True diff --git a/authinfo.py b/authinfo.py index d495aa2..b0b20b2 100644 --- a/authinfo.py +++ b/authinfo.py @@ -4253,15 +4253,21 @@ class AuthInfo: sys.stderr.write("[%s]\n" % cmd) if self.joinPassword: status, error = feedFork(cmd, echo, "sword:", self.joinPassword) + cerr = '' else: child = Popen([cmd], stderr=PIPE, shell=True) cout, cerr = child.communicate() status = child.returncode error = "\n" + cerr - if status != 0: - errmsg = _("Winbind domain join was not successful. The net join command failed with the following error:") - errmsg += "\n" + error - self.messageCB(errmsg) + if echo: + sys.stderr.write(cerr) + if status != 0: + self.messageCB(_("Winbind domain join was not successful.")) + else: + if status != 0: + errmsg = _("Winbind domain join was not successful. The net join command failed with the following error:") + errmsg += "\n" + error + self.messageCB(errmsg) return status == 0 def joinIPADomain(self, echo): @@ -4288,6 +4294,7 @@ class AuthInfo: sys.stderr.write("[%s]\n" % cmd) if self.joinPassword: status, error = feedFork(cmd, echo, "sword:", self.joinPassword) + cerr = '' else: child = Popen([cmd], stderr=PIPE, shell=True) cout, cerr = child.communicate() @@ -4295,10 +4302,15 @@ class AuthInfo: error = "\n" + cerr if status == 0: self.ipaDomainJoined = True + if echo: + sys.stderr.write(cerr) + if status != 0: + self.messageCB(_("IPAv2 domain join was not successful.")) else: - errmsg = _("IPAv2 domain join was not successful. The ipa-client-install command failed with the following error:") - errmsg += "\n" + error - self.messageCB(errmsg) + if status != 0: + errmsg = _("IPAv2 domain join was not successful. The ipa-client-install command failed with the following error:") + errmsg += "\n" + error + self.messageCB(errmsg) return status == 0 def uninstallIPA(self):