You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2018/07/27 22:04:49 UTC

[ambari] branch branch-2.7 updated: AMBARI-24374. Testing if kerberos command parameters are present when checking missing keytabs (they are filtered out on the server side on purpose) (#1909)

This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 97dcb55  AMBARI-24374. Testing if kerberos command parameters are present when checking missing keytabs (they are filtered out on the server side on purpose) (#1909)
97dcb55 is described below

commit 97dcb55b1a413d41c17ac3f12d5ceb18a9605702
Author: Sandor Molnar <sm...@apache.org>
AuthorDate: Sat Jul 28 00:04:47 2018 +0200

    AMBARI-24374. Testing if kerberos command parameters are present when checking missing keytabs (they are filtered out on the server side on purpose) (#1909)
---
 .../main/python/ambari_commons/kerberos/kerberos_common.py  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py b/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py
index ee06204..174bc10 100644
--- a/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py
+++ b/ambari-common/src/main/python/ambari_commons/kerberos/kerberos_common.py
@@ -52,10 +52,13 @@ class MissingKeytabs(object):
 
   @classmethod
   def from_kerberos_records(self, kerberos_record, hostname):
-    with_missing_keytab = (each for each in kerberos_record \
+    if kerberos_record is not None:
+      with_missing_keytab = (each for each in kerberos_record \
                            if not self.keytab_exists(each) or not self.keytab_has_principal(each, hostname))
-    return MissingKeytabs(
-      set(MissingKeytabs.Identity.from_kerberos_record(each, hostname) for each in with_missing_keytab))
+      return MissingKeytabs(
+        set(MissingKeytabs.Identity.from_kerberos_record(each, hostname) for each in with_missing_keytab))
+    else:
+      return MissingKeytabs(None)
 
   @staticmethod
   def keytab_exists(kerberos_record):
@@ -72,10 +75,10 @@ class MissingKeytabs(object):
     self.items = items
 
   def as_dict(self):
-    return [each._asdict() for each in self.items]
+    return [each._asdict() for each in self.items] if self.items is not None else []
 
   def __str__(self):
-    return "Missing keytabs:\n%s" % ("\n".join(map(str, self.items))) if self.items else 'No missing keytabs'
+    return "Missing keytabs:\n%s" % ("\n".join(map(str, self.items))) if self.items and self.items is not None else 'No missing keytabs'
 
 
 def write_krb5_conf(params):