You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/10/02 23:12:33 UTC

[29/32] ambari git commit: AMBARI-13295. ACCUMULO_TRACER START failed after enabling Kerberos (dlysnichenko)

AMBARI-13295. ACCUMULO_TRACER START failed after enabling Kerberos (dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/37f2617a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/37f2617a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/37f2617a

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 37f2617a6a7d2b339f3ee62111e01c3ad89dbc00
Parents: e04c4d0
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Fri Oct 2 18:47:28 2015 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Fri Oct 2 18:48:08 2015 +0300

----------------------------------------------------------------------
 .../libraries/functions/__init__.py             |  2 +-
 .../libraries/functions/get_bare_principal.py   | 42 ++++++++++++++++++++
 .../1.6.1.2.2.0/package/scripts/params.py       |  2 +
 .../0.9.1.2.1/package/scripts/params_linux.py   | 18 +--------
 .../HDP/2.3/services/ACCUMULO/kerberos.json     |  5 +++
 5 files changed, 51 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/37f2617a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
index 1998f69..1ab0ff1 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
@@ -42,7 +42,7 @@ from resource_management.libraries.functions.get_hdp_version import *
 from resource_management.libraries.functions.get_lzo_packages import *
 from resource_management.libraries.functions.setup_ranger_plugin import *
 from resource_management.libraries.functions.curl_krb_request import *
-
+from resource_management.libraries.functions.get_bare_principal import *
 IS_WINDOWS = platform.system() == "Windows"
 
 if IS_WINDOWS:

http://git-wip-us.apache.org/repos/asf/ambari/blob/37f2617a/ambari-common/src/main/python/resource_management/libraries/functions/get_bare_principal.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_bare_principal.py b/ambari-common/src/main/python/resource_management/libraries/functions/get_bare_principal.py
new file mode 100644
index 0000000..dbfe9b7
--- /dev/null
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/get_bare_principal.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+import re
+__all__ = ["get_bare_principal"]
+
+
+def get_bare_principal(normalized_principal_name):
+  """
+  Given a normalized principal name (nimbus/c6501.ambari.apache.org@EXAMPLE.COM) returns just the
+  primary component (nimbus)
+  :param normalized_principal_name: a string containing the principal name to process
+  :return: a string containing the primary component value or None if not valid
+  """
+
+  bare_principal = None
+
+  if normalized_principal_name:
+    match = re.match(r"([^/@]+)(?:/[^@])?(?:@.*)?", normalized_principal_name)
+
+    if match:
+      bare_principal = match.group(1)
+
+  return bare_principal
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/37f2617a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
index ca8cebe..76a39a4 100644
--- a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
@@ -23,6 +23,7 @@ from resource_management.libraries.resources.hdfs_resource import HdfsResource
 from resource_management.libraries.functions import format
 from resource_management.libraries.functions.version import format_hdp_stack_version
 from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.get_bare_principal import get_bare_principal
 from resource_management.libraries.script.script import Script
 
 import status_params
@@ -142,6 +143,7 @@ accumulo_principal_name = config['configurations']['accumulo-env']['accumulo_pri
 # kinit properties
 kinit_path_local = status_params.kinit_path_local
 if security_enabled:
+  bare_accumulo_principal = get_bare_principal(config['configurations']['accumulo-site']['general.kerberos.principal'])
   kinit_cmd = format("{kinit_path_local} -kt {accumulo_user_keytab} {accumulo_principal_name};")
 else:
   kinit_cmd = ""

http://git-wip-us.apache.org/repos/asf/ambari/blob/37f2617a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
index 2349a92..df65185 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params_linux.py
@@ -26,26 +26,10 @@ from ambari_commons.constants import AMBARI_SUDO_BINARY
 from resource_management.libraries.functions import format
 from resource_management.libraries.functions.version import format_hdp_stack_version
 from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.get_bare_principal import get_bare_principal
 from resource_management.libraries.script import Script
 
 
-def get_bare_principal(normalized_principal_name):
-  """
-  Given a normalized principal name (nimbus/c6501.ambari.apache.org@EXAMPLE.COM) returns just the
-  primary component (nimbus)
-  :param normalized_principal_name: a string containing the principal name to process
-  :return: a string containing the primary component value or None if not valid
-  """
-
-  bare_principal = None
-
-  if normalized_principal_name:
-    match = re.match(r"([^/@]+)(?:/[^@])?(?:@.*)?", normalized_principal_name)
-
-    if match:
-      bare_principal = match.group(1)
-
-  return bare_principal
 
 
 # server configurations

http://git-wip-us.apache.org/repos/asf/ambari/blob/37f2617a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/kerberos.json b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/kerberos.json
index 73aaf3d..1315e84 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/kerberos.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/kerberos.json
@@ -84,6 +84,11 @@
             "general.delegation.token.lifetime": "7d",
             "general.delegation.token.update.interval": "1d"
           }
+        },
+        {
+          "client": {
+            "kerberos.server.primary": "{{bare_accumulo_principal}}"
+          }
         }
       ],
       "components": [