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 20:33:08 UTC
[ambari] branch trunk updated: AMBARI-24374. Testing if kerberos
command parameters are present when checking missing keytabs (they are
filtered out on the server side on purpose) (#1906)
This is an automated email from the ASF dual-hosted git repository.
smolnar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 62a2185 AMBARI-24374. Testing if kerberos command parameters are present when checking missing keytabs (they are filtered out on the server side on purpose) (#1906)
62a2185 is described below
commit 62a218559af8f993c407f64fb2ed27c93734970f
Author: Sandor Molnar <sm...@apache.org>
AuthorDate: Fri Jul 27 22:33:06 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) (#1906)
---
.../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):