ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mug...@apache.org
Subject ambari git commit: AMBARI-20792: Atlas admin username and password should be configurable through ambari (Vishal Suvagia via mugdha)
Date Fri, 21 Apr 2017 10:37:31 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 836c78995 -> 3d5da62cb


AMBARI-20792: Atlas admin username and password should be configurable through ambari (Vishal
Suvagia via mugdha)


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

Branch: refs/heads/trunk
Commit: 3d5da62cbbc673034f8db54fbad8d6a83afe57cb
Parents: 836c789
Author: Vishal Suvagia <vishalsuvagia@yahoo.com>
Authored: Thu Apr 20 10:36:26 2017 +0530
Committer: Mugdha Varadkar <mugdha@apache.org>
Committed: Fri Apr 21 16:07:03 2017 +0530

----------------------------------------------------------------------
 .../ATLAS/0.1.0.2.3/package/scripts/metadata.py | 14 ++++++-
 .../ATLAS/0.1.0.2.3/package/scripts/params.py   |  3 ++
 .../services/ATLAS/configuration/atlas-env.xml  | 41 ++++++++++++++++++++
 3 files changed, 56 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3d5da62c/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
index c25445c..36c4598 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
@@ -18,6 +18,7 @@ limitations under the License.
 
 """
 import os
+import hashlib
 
 from resource_management import Package
 from resource_management import StackFeature
@@ -31,11 +32,13 @@ from resource_management.libraries.functions.stack_features import check_stack_f
 from resource_management.libraries.resources.properties_file import PropertiesFile
 from resource_management.libraries.resources.template_config import TemplateConfig
 from resource_management.libraries.resources.xml_config import XmlConfig
+from resource_management.libraries.functions.is_empty import is_empty
+from resource_management.libraries.resources.modify_properties_file import ModifyPropertiesFile
 
 
 def metadata(type='server'):
     import params
-    
+
     # Needed by both Server and Client
     Directory(params.conf_dir,
               mode=0755,
@@ -97,7 +100,14 @@ def metadata(type='server'):
            mode=0755,
            content=InlineTemplate(params.metadata_env_content)
       )
- 
+
+      if not is_empty(params.atlas_admin_username) and not is_empty(params.atlas_admin_password):
+        psswd_output = hashlib.sha256(params.atlas_admin_password).hexdigest()
+        ModifyPropertiesFile(format("{conf_dir}/users-credentials.properties"),
+            properties = {format('{atlas_admin_username}') : format('ROLE_ADMIN::{psswd_output}')},
+            owner = params.metadata_user
+        )
+
       files_to_chown = [format("{conf_dir}/policy-store.txt"), format("{conf_dir}/users-credentials.properties")]
       for file in files_to_chown:
         if os.path.exists(file):

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d5da62c/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
index bf4848b..d26df33 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
@@ -412,3 +412,6 @@ if stack_supports_atlas_ranger_plugin and enable_ranger_atlas:
     'type': 'atlas',
     }
 # ranger atlas plugin section end
+# atlas admin login username password
+atlas_admin_username = config['configurations']['atlas-env']['atlas.admin.username']
+atlas_admin_password = config['configurations']['atlas-env']['atlas.admin.password']

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d5da62c/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/atlas-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/atlas-env.xml
b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/atlas-env.xml
new file mode 100644
index 0000000..d54cf15
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/atlas-env.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_adding_forbidden="true">
+  <property>
+    <name>atlas.admin.username</name>
+    <display-name>Admin username</display-name>
+    <description>Admin Login user</description>
+    <value>admin</value>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>atlas.admin.password</name>
+    <display-name>Admin password</display-name>
+    <description>Admin Login password</description>
+    <value>admin</value>
+    <property-type>PASSWORD</property-type>
+    <value-attributes>
+      <type>password</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>


Mime
View raw message