You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2019/07/22 17:51:46 UTC
[ambari] branch branch-2.7 updated: AMBARI-25339 : Reference to
classmethod of MissingKeytabs incorrect (#3055)
This is an automated email from the ASF dual-hosted git repository.
jonathanhurley 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 910bb13 AMBARI-25339 : Reference to classmethod of MissingKeytabs incorrect (#3055)
910bb13 is described below
commit 910bb13fedbebd0ca08c7d54b6d8cc3985ae1e02
Author: Viraj Jasani <34...@users.noreply.github.com>
AuthorDate: Mon Jul 22 23:21:40 2019 +0530
AMBARI-25339 : Reference to classmethod of MissingKeytabs incorrect (#3055)
---
.../services/KERBEROS/package/scripts/kerberos_common.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
index 6cbaed0..c10cf6d 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
@@ -436,13 +436,15 @@ class KerberosScript(Script):
def find_missing_keytabs(self):
import params
- missing_keytabs = MissingKeytabs.fromKerberosRecords(params.kerberos_command_params, params.hostname)
+ missing_keytabs = MissingKeytabs.from_kerberos_records(params.kerberos_command_params, params.hostname)
Logger.info(str(missing_keytabs))
curr_content = Script.structuredOut
curr_content['missing_keytabs'] = missing_keytabs.as_dict()
self.put_structured_out(curr_content)
+
class MissingKeytabs:
+
class Identity(namedtuple('Identity', ['principal', 'keytab_file_path'])):
@staticmethod
def fromKerberosRecord(item, hostname):
@@ -454,10 +456,11 @@ class MissingKeytabs:
return "Keytab: %s Principal: %s" % (self.keytab_file_path, self.principal)
@classmethod
- def fromKerberosRecords(self, kerberos_record, hostname):
- 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.fromKerberosRecord(each, hostname) for each in with_missing_keytab))
+ def from_kerberos_records(cls, kerberos_record, hostname):
+ with_missing_keytab = (each for each in kerberos_record if not MissingKeytabs.keytab_exists(each) or
+ not MissingKeytabs.keytab_has_principal(each, hostname))
+ return MissingKeytabs(
+ set(MissingKeytabs.Identity.fromKerberosRecord(each, hostname) for each in with_missing_keytab))
@staticmethod
def keytab_exists(kerberos_record):