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 2014/09/30 22:48:39 UTC
[33/35] git commit: AMBARI-7564. Storm failed to restart after adding
HDFS service to a cluster (aonishuk)
AMBARI-7564. Storm failed to restart after adding HDFS service to a cluster (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/11405289
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/11405289
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/11405289
Branch: refs/heads/branch-alerts-dev
Commit: 11405289e525d1d67eb12df3eb4942e82fc5adf3
Parents: 63d5072
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Sep 30 22:11:48 2014 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Sep 30 22:11:48 2014 +0300
----------------------------------------------------------------------
.../AmbariCustomCommandExecutionHelper.java | 12 ++
.../1.3.2/hooks/after-INSTALL/scripts/hook.py | 1 -
.../1.3.2/hooks/after-INSTALL/scripts/params.py | 5 +-
.../scripts/shared_initialization.py | 37 ++----
.../hooks/before-ANY/files/changeToSecureUid.sh | 50 ++++++++
.../HDP/1.3.2/hooks/before-ANY/scripts/hook.py | 3 +
.../1.3.2/hooks/before-ANY/scripts/params.py | 102 ++++++++++++++++
.../before-ANY/scripts/shared_initialization.py | 58 +++++++++
.../before-INSTALL/files/changeToSecureUid.sh | 50 --------
.../1.3.2/hooks/before-INSTALL/scripts/hook.py | 1 -
.../scripts/shared_initialization.py | 35 ------
.../1.3.2/hooks/before-START/scripts/hook.py | 1 -
.../2.0.6/hooks/after-INSTALL/scripts/hook.py | 1 -
.../2.0.6/hooks/after-INSTALL/scripts/params.py | 1 -
.../scripts/shared_initialization.py | 21 ----
.../hooks/before-ANY/files/changeToSecureUid.sh | 50 ++++++++
.../HDP/2.0.6/hooks/before-ANY/scripts/hook.py | 2 +
.../2.0.6/hooks/before-ANY/scripts/params.py | 108 ++++++++++++++++-
.../before-ANY/scripts/shared_initialization.py | 56 +++++++++
.../before-INSTALL/files/changeToSecureUid.sh | 50 --------
.../2.0.6/hooks/before-INSTALL/scripts/hook.py | 1 -
.../scripts/shared_initialization.py | 35 ------
.../2.0.6/hooks/before-START/scripts/hook.py | 1 -
.../hooks/after-INSTALL/test_after_install.py | 13 --
.../1.3.2/hooks/before-ANY/test_before_any.py | 119 +++++++++++++++++++
.../hooks/before-INSTALL/test_before_install.py | 106 -----------------
.../hooks/after-INSTALL/test_after_install.py | 13 --
.../2.0.6/hooks/before-ANY/test_before_any.py | 119 +++++++++++++++++++
.../hooks/before-INSTALL/test_before_install.py | 106 -----------------
29 files changed, 689 insertions(+), 468 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 156427d..92935e4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -21,11 +21,13 @@ package org.apache.ambari.server.controller;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMPONENT_CATEGORY;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.CUSTOM_COMMAND;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.GROUP_LIST;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.USER_LIST;
import java.util.ArrayList;
import java.util.Collections;
@@ -65,6 +67,7 @@ import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.State;
+import org.apache.ambari.server.state.PropertyInfo.PropertyType;
import org.apache.ambari.server.state.stack.OsFamily;
import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpInProgressEvent;
import org.apache.ambari.server.utils.StageUtils;
@@ -296,6 +299,15 @@ public class AmbariCustomCommandExecutionHelper {
// Set parameters required for re-installing clients on restart
hostLevelParams.put(REPO_INFO, getRepoInfo
(cluster, host));
+
+ Set<String> userSet = configHelper.getPropertyValuesWithPropertyType(stackId, PropertyType.USER, cluster);
+ String userList = gson.toJson(userSet);
+ hostLevelParams.put(USER_LIST, userList);
+
+ Set<String> groupSet = configHelper.getPropertyValuesWithPropertyType(stackId, PropertyType.GROUP, cluster);
+ String groupList = gson.toJson(groupSet);
+ hostLevelParams.put(GROUP_LIST, groupList);
+
execCmd.setHostLevelParams(hostLevelParams);
Map<String, String> commandParams = new TreeMap<String, String>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/hook.py
index cf83e19..c86e1c6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/hook.py
@@ -28,7 +28,6 @@ class AfterInstallHook(Hook):
import params
env.set_params(params)
- setup_hadoop_env()
setup_config()
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/params.py
index 4ba0ea7..c261c6b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/params.py
@@ -59,4 +59,7 @@ hadoop_libexec_dir = "/usr/lib/hadoop/libexec"
#users and groups
hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
-user_group = config['configurations']['cluster-env']['user_group']
\ No newline at end of file
+user_group = config['configurations']['cluster-env']['user_group']
+
+namenode_host = default("/clusterHostInfo/namenode_host", [])
+has_namenode = not len(namenode_host) == 0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/shared_initialization.py
index 9c8d413..ff2e746 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/after-INSTALL/scripts/shared_initialization.py
@@ -19,34 +19,13 @@ limitations under the License.
import os
from resource_management import *
-def setup_hadoop_env():
- import params
- if params.security_enabled:
- tc_owner = "root"
- else:
- tc_owner = params.hdfs_user
-
- Directory(params.hadoop_conf_empty_dir,
- recursive=True,
- owner='root',
- group='root'
- )
- Link(params.hadoop_conf_dir,
- to=params.hadoop_conf_empty_dir,
- not_if=format("ls {hadoop_conf_dir}")
- )
-
- File(os.path.join(params.hadoop_conf_dir, 'hadoop-env.sh'),
- owner=tc_owner,
- content=InlineTemplate(params.hadoop_env_sh_template)
- )
-
def setup_config():
import params
- XmlConfig("core-site.xml",
- conf_dir=params.hadoop_conf_dir,
- configurations=params.config['configurations']['core-site'],
- configuration_attributes=params.config['configuration_attributes']['core-site'],
- owner=params.hdfs_user,
- group=params.user_group
- )
+ if params.has_namenode:
+ XmlConfig("core-site.xml",
+ conf_dir=params.hadoop_conf_dir,
+ configurations=params.config['configurations']['core-site'],
+ configuration_attributes=params.config['configuration_attributes']['core-site'],
+ owner=params.hdfs_user,
+ group=params.user_group
+ )
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/files/changeToSecureUid.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/files/changeToSecureUid.sh b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/files/changeToSecureUid.sh
new file mode 100644
index 0000000..4872a10
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/files/changeToSecureUid.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+#
+# 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.
+#
+
+username=$1
+directories=$2
+
+function find_available_uid() {
+ for ((i=1001; i<=2000; i++))
+ do
+ grep -q $i /etc/passwd
+ if [ "$?" -ne 0 ]
+ then
+ newUid=$i
+ break
+ fi
+ done
+}
+
+find_available_uid
+
+if [ $newUid -eq 0 ]
+then
+ echo "Failed to find Uid between 1000 and 2000"
+ exit 1
+fi
+
+dir_array=($(echo $directories | sed 's/,/\n/g'))
+old_uid=$(id -u $username)
+echo "Changing uid of $username from $old_uid to $newUid"
+echo "Changing directory permisions for ${dir_array[@]}"
+usermod -u $newUid $username && for dir in ${dir_array[@]} ; do chown -Rh $newUid $dir ; done
+exit 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/hook.py
index 0f97e28..724f374 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/hook.py
@@ -27,6 +27,9 @@ class BeforeAnyHook(Hook):
env.set_params(params)
setup_jce()
+ setup_users()
+ setup_hadoop_env()
+
if __name__ == "__main__":
BeforeAnyHook().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/params.py
index af67cb6..fca4000 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/params.py
@@ -18,6 +18,8 @@ limitations under the License.
"""
from resource_management import *
+import collections
+import json
config = Script.get_config()
tmp_dir = Script.get_tmp_dir()
@@ -31,3 +33,103 @@ jdk_name = default("/hostLevelParams/jdk_name", None)
java_home = config['hostLevelParams']['java_home']
ambari_server_hostname = config['clusterHostInfo']['ambari_server_host'][0]
+
+
+#RPM versioning support
+rpm_version = default("/configurations/cluster-env/rpm_version", None)
+
+#hadoop params
+if rpm_version:
+ mapreduce_libs_path = "/usr/hdp/current/hadoop-mapreduce/*"
+ hadoop_libexec_dir = "/usr/hdp/current/hadoop/libexec"
+else:
+ mapreduce_libs_path = "/usr/lib/hadoop-mapreduce/*"
+ hadoop_libexec_dir = "/usr/lib/hadoop/libexec"
+
+hadoop_conf_dir = "/etc/hadoop/conf"
+hadoop_conf_empty_dir = "/etc/hadoop/conf.empty"
+versioned_hdp_root = '/usr/hdp/current'
+#security params
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+#java params
+java_home = config['hostLevelParams']['java_home']
+#hadoop params
+hdfs_log_dir_prefix = config['configurations']['hadoop-env']['hdfs_log_dir_prefix']
+hadoop_pid_dir_prefix = config['configurations']['hadoop-env']['hadoop_pid_dir_prefix']
+hadoop_root_logger = config['configurations']['hadoop-env']['hadoop_root_logger']
+
+#hadoop-env.sh
+java_home = config['hostLevelParams']['java_home']
+
+if str(config['hostLevelParams']['stack_version']).startswith('2.0') and System.get_instance().os_family != "suse":
+ # deprecated rhel jsvc_path
+ jsvc_path = "/usr/libexec/bigtop-utils"
+else:
+ jsvc_path = "/usr/lib/bigtop-utils"
+
+hadoop_heapsize = config['configurations']['hadoop-env']['hadoop_heapsize']
+namenode_heapsize = config['configurations']['hadoop-env']['namenode_heapsize']
+namenode_opt_newsize = config['configurations']['hadoop-env']['namenode_opt_newsize']
+namenode_opt_maxnewsize = config['configurations']['hadoop-env']['namenode_opt_maxnewsize']
+
+jtnode_opt_newsize = "200m"
+jtnode_opt_maxnewsize = "200m"
+jtnode_heapsize = "1024m"
+ttnode_heapsize = "1024m"
+
+dtnode_heapsize = config['configurations']['hadoop-env']['dtnode_heapsize']
+mapred_pid_dir_prefix = default("/configurations/mapred-env/mapred_pid_dir_prefix","/var/run/hadoop-mapreduce")
+mapred_log_dir_prefix = default("/configurations/mapred-env/mapred_log_dir_prefix","/var/log/hadoop-mapreduce")
+hadoop_env_sh_template = config['configurations']['hadoop-env']['content']
+
+#users and groups
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+user_group = config['configurations']['cluster-env']['user_group']
+
+hagios_server_hosts = default("/clusterHostInfo/nagios_server_host", [])
+ganglia_server_hosts = default("/clusterHostInfo/ganglia_server_host", [])
+namenode_host = default("/clusterHostInfo/namenode_host", [])
+hbase_master_hosts = default("/clusterHostInfo/hbase_master_hosts", [])
+
+has_namenode = not len(namenode_host) == 0
+has_nagios = not len(hagios_server_hosts) == 0
+has_ganglia_server = not len(ganglia_server_hosts) == 0
+has_tez = 'tez-site' in config['configurations']
+has_hbase_masters = not len(hbase_master_hosts) == 0
+
+hbase_tmp_dir = config['configurations']['hbase-site']['hbase.tmp.dir']
+
+#users and groups
+hbase_user = config['configurations']['hbase-env']['hbase_user']
+nagios_user = config['configurations']['nagios-env']['nagios_user']
+smoke_user = config['configurations']['cluster-env']['smokeuser']
+gmetad_user = config['configurations']['ganglia-env']["gmetad_user"]
+gmond_user = config['configurations']['ganglia-env']["gmond_user"]
+
+user_group = config['configurations']['cluster-env']['user_group']
+proxyuser_group = default("/configurations/hadoop-env/proxyuser_group","users")
+nagios_group = config['configurations']['nagios-env']['nagios_group']
+
+ignore_groupsusers_create = default("/configurations/cluster-env/ignore_groupsusers_create", False)
+
+smoke_user_dirs = format("/tmp/hadoop-{smoke_user},/tmp/hsperfdata_{smoke_user},/home/{smoke_user},/tmp/{smoke_user},/tmp/sqoop-{smoke_user}")
+if has_hbase_masters:
+ hbase_user_dirs = format("/home/{hbase_user},/tmp/{hbase_user},/usr/bin/{hbase_user},/var/log/{hbase_user},{hbase_tmp_dir}")
+#repo params
+repo_info = config['hostLevelParams']['repo_info']
+service_repo_info = default("/hostLevelParams/service_repo_info",None)
+
+user_to_groups_dict = collections.defaultdict(lambda:[user_group])
+user_to_groups_dict[smoke_user] = [proxyuser_group]
+if has_ganglia_server:
+ user_to_groups_dict[gmond_user] = [gmond_user]
+ user_to_groups_dict[gmetad_user] = [gmetad_user]
+if has_tez:
+ user_to_groups_dict[tez_user] = [proxyuser_group]
+
+user_to_gid_dict = collections.defaultdict(lambda:user_group)
+if has_nagios:
+ user_to_gid_dict[nagios_user] = nagios_group
+
+user_list = json.loads(config['hostLevelParams']['user_list'])
+group_list = json.loads(config['hostLevelParams']['group_list'])
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/shared_initialization.py
index 74bdce0..e20637c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-ANY/scripts/shared_initialization.py
@@ -56,3 +56,61 @@ def setup_jce():
cwd = security_dir,
path = ['/bin/','/usr/bin']
)
+
+
+def setup_users():
+ """
+ Creates users before cluster installation
+ """
+ import params
+
+ for group in params.group_list:
+ Group(group,
+ ignore_failures = params.ignore_groupsusers_create
+ )
+
+ for user in params.user_list:
+ User(user,
+ gid = params.user_to_gid_dict[user],
+ groups = params.user_to_groups_dict[user],
+ ignore_failures = params.ignore_groupsusers_create
+ )
+
+ set_uid(params.smoke_user, params.smoke_user_dirs)
+
+ if params.has_hbase_masters:
+ set_uid(params.hbase_user, params.hbase_user_dirs)
+
+def set_uid(user, user_dirs):
+ """
+ user_dirs - comma separated directories
+ """
+ import params
+
+ File(format("{tmp_dir}/changeUid.sh"),
+ content=StaticFile("changeToSecureUid.sh"),
+ mode=0555)
+ Execute(format("{tmp_dir}/changeUid.sh {user} {user_dirs} 2>/dev/null"),
+ not_if = format("test $(id -u {user}) -gt 1000"))
+
+def setup_hadoop_env():
+ import params
+ if params.has_namenode:
+ if params.security_enabled:
+ tc_owner = "root"
+ else:
+ tc_owner = params.hdfs_user
+ Directory(params.hadoop_conf_empty_dir,
+ recursive=True,
+ owner='root',
+ group='root'
+ )
+ Link(params.hadoop_conf_dir,
+ to=params.hadoop_conf_empty_dir,
+ not_if=format("ls {hadoop_conf_dir}")
+ )
+ File(os.path.join(params.hadoop_conf_dir, 'hadoop-env.sh'),
+ owner=tc_owner,
+ content=InlineTemplate(params.hadoop_env_sh_template)
+ )
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/files/changeToSecureUid.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/files/changeToSecureUid.sh b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/files/changeToSecureUid.sh
deleted file mode 100644
index 4872a10..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/files/changeToSecureUid.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-#
-#
-# 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.
-#
-
-username=$1
-directories=$2
-
-function find_available_uid() {
- for ((i=1001; i<=2000; i++))
- do
- grep -q $i /etc/passwd
- if [ "$?" -ne 0 ]
- then
- newUid=$i
- break
- fi
- done
-}
-
-find_available_uid
-
-if [ $newUid -eq 0 ]
-then
- echo "Failed to find Uid between 1000 and 2000"
- exit 1
-fi
-
-dir_array=($(echo $directories | sed 's/,/\n/g'))
-old_uid=$(id -u $username)
-echo "Changing uid of $username from $old_uid to $newUid"
-echo "Changing directory permisions for ${dir_array[@]}"
-usermod -u $newUid $username && for dir in ${dir_array[@]} ; do chown -Rh $newUid $dir ; done
-exit 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py
index 372df02..7f1bccd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/hook.py
@@ -32,7 +32,6 @@ class BeforeInstallHook(Hook):
install_repos()
setup_java()
- setup_users()
install_packages()
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/shared_initialization.py
index e4a1135..27993cd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-INSTALL/scripts/shared_initialization.py
@@ -21,41 +21,6 @@ import os
from resource_management import *
-def setup_users():
- """
- Creates users before cluster installation
- """
- import params
-
- for group in params.group_list:
- Group(group,
- ignore_failures = params.ignore_groupsusers_create
- )
-
- for user in params.user_list:
- User(user,
- gid = params.user_to_gid_dict[user],
- groups = params.user_to_groups_dict[user],
- ignore_failures = params.ignore_groupsusers_create
- )
-
- set_uid(params.smoke_user, params.smoke_user_dirs)
-
- if params.has_hbase_masters:
- set_uid(params.hbase_user, params.hbase_user_dirs)
-
-def set_uid(user, user_dirs):
- """
- user_dirs - comma separated directories
- """
- import params
-
- File(format("{tmp_dir}/changeUid.sh"),
- content=StaticFile("changeToSecureUid.sh"),
- mode=0555)
- Execute(format("{tmp_dir}/changeUid.sh {user} {user_dirs} 2>/dev/null"),
- not_if = format("test $(id -u {user}) -gt 1000"))
-
def setup_java():
"""
Installs jdk using specific params, that comes from ambari-server
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-START/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-START/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-START/scripts/hook.py
index 04bdc16..6a78a34 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-START/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/hooks/before-START/scripts/hook.py
@@ -27,7 +27,6 @@ class BeforeStartHook(Hook):
import params
self.run_custom_hook('before-ANY')
- self.run_custom_hook('after-INSTALL')
env.set_params(params)
setup_hadoop()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
index ea8cdb5..71ac3df 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
@@ -29,7 +29,6 @@ class AfterInstallHook(Hook):
env.set_params(params)
setup_hdp_install_directory()
- setup_hadoop_env()
setup_config()
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
index 6e312ca..34338a9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
@@ -44,7 +44,6 @@ java_home = config['hostLevelParams']['java_home']
hdfs_log_dir_prefix = config['configurations']['hadoop-env']['hdfs_log_dir_prefix']
hadoop_pid_dir_prefix = config['configurations']['hadoop-env']['hadoop_pid_dir_prefix']
hadoop_root_logger = config['configurations']['hadoop-env']['hadoop_root_logger']
-hadoop_env_sh_template = config['configurations']['hadoop-env']['content']
#hadoop-env.sh
java_home = config['hostLevelParams']['java_home']
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
index 47d01c7..216f7df 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
@@ -27,27 +27,6 @@ def setup_hdp_install_directory():
only_if=format('ls -d /usr/hdp/{rpm_version}-*')
)
-def setup_hadoop_env():
- import params
- if params.has_namenode:
- if params.security_enabled:
- tc_owner = "root"
- else:
- tc_owner = params.hdfs_user
- Directory(params.hadoop_conf_empty_dir,
- recursive=True,
- owner='root',
- group='root'
- )
- Link(params.hadoop_conf_dir,
- to=params.hadoop_conf_empty_dir,
- not_if=format("ls {hadoop_conf_dir}")
- )
- File(os.path.join(params.hadoop_conf_dir, 'hadoop-env.sh'),
- owner=tc_owner,
- content=InlineTemplate(params.hadoop_env_sh_template)
- )
-
def setup_config():
import params
if params.has_namenode:
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
new file mode 100644
index 0000000..154c1c0
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+
+username=$1
+directories=$2
+
+function find_available_uid() {
+ for ((i=1001; i<=2000; i++))
+ do
+ grep -q $i /etc/passwd
+ if [ "$?" -ne 0 ]
+ then
+ newUid=$i
+ break
+ fi
+ done
+}
+
+find_available_uid
+
+if [ $newUid -eq 0 ]
+then
+ echo "Failed to find Uid between 1000 and 2000"
+ exit 1
+fi
+
+dir_array=($(echo $directories | sed 's/,/\n/g'))
+old_uid=$(id -u $username)
+echo "Changing uid of $username from $old_uid to $newUid"
+echo "Changing directory permisions for ${dir_array[@]}"
+usermod -u $newUid $username && for dir in ${dir_array[@]} ; do chown -Rh $newUid $dir ; done
+exit 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py
index 0f97e28..1fd36d6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/hook.py
@@ -27,6 +27,8 @@ class BeforeAnyHook(Hook):
env.set_params(params)
setup_jce()
+ setup_users()
+ setup_hadoop_env()
if __name__ == "__main__":
BeforeAnyHook().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
index af67cb6..8962beb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
@@ -18,12 +18,12 @@ limitations under the License.
"""
from resource_management import *
+import collections
+import json
config = Script.get_config()
tmp_dir = Script.get_tmp_dir()
-security_enabled = config['configurations']['cluster-env']['security_enabled']
-
artifact_dir = format("{tmp_dir}/AMBARI-artifacts/")
jce_policy_zip = default("/hostLevelParams/jce_name", None) # None when jdk is already installed by user
jce_location = config['hostLevelParams']['jdk_location']
@@ -31,3 +31,107 @@ jdk_name = default("/hostLevelParams/jdk_name", None)
java_home = config['hostLevelParams']['java_home']
ambari_server_hostname = config['clusterHostInfo']['ambari_server_host'][0]
+
+#RPM versioning support
+rpm_version = default("/configurations/cluster-env/rpm_version", None)
+
+#hadoop params
+if rpm_version:
+ mapreduce_libs_path = "/usr/hdp/current/hadoop-mapreduce/*"
+ hadoop_libexec_dir = "/usr/hdp/current/hadoop/libexec"
+else:
+ mapreduce_libs_path = "/usr/lib/hadoop-mapreduce/*"
+ hadoop_libexec_dir = "/usr/lib/hadoop/libexec"
+
+hadoop_conf_dir = "/etc/hadoop/conf"
+hadoop_conf_empty_dir = "/etc/hadoop/conf.empty"
+versioned_hdp_root = '/usr/hdp/current'
+#security params
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+#java params
+java_home = config['hostLevelParams']['java_home']
+#hadoop params
+hdfs_log_dir_prefix = config['configurations']['hadoop-env']['hdfs_log_dir_prefix']
+hadoop_pid_dir_prefix = config['configurations']['hadoop-env']['hadoop_pid_dir_prefix']
+hadoop_root_logger = config['configurations']['hadoop-env']['hadoop_root_logger']
+
+#hadoop-env.sh
+java_home = config['hostLevelParams']['java_home']
+
+if str(config['hostLevelParams']['stack_version']).startswith('2.0') and System.get_instance().os_family != "suse":
+ # deprecated rhel jsvc_path
+ jsvc_path = "/usr/libexec/bigtop-utils"
+else:
+ jsvc_path = "/usr/lib/bigtop-utils"
+
+hadoop_heapsize = config['configurations']['hadoop-env']['hadoop_heapsize']
+namenode_heapsize = config['configurations']['hadoop-env']['namenode_heapsize']
+namenode_opt_newsize = config['configurations']['hadoop-env']['namenode_opt_newsize']
+namenode_opt_maxnewsize = config['configurations']['hadoop-env']['namenode_opt_maxnewsize']
+
+jtnode_opt_newsize = "200m"
+jtnode_opt_maxnewsize = "200m"
+jtnode_heapsize = "1024m"
+ttnode_heapsize = "1024m"
+
+dtnode_heapsize = config['configurations']['hadoop-env']['dtnode_heapsize']
+mapred_pid_dir_prefix = default("/configurations/mapred-env/mapred_pid_dir_prefix","/var/run/hadoop-mapreduce")
+mapred_log_dir_prefix = default("/configurations/mapred-env/mapred_log_dir_prefix","/var/log/hadoop-mapreduce")
+hadoop_env_sh_template = config['configurations']['hadoop-env']['content']
+
+#users and groups
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+hbase_user = config['configurations']['hbase-env']['hbase_user']
+nagios_user = config['configurations']['nagios-env']['nagios_user']
+smoke_user = config['configurations']['cluster-env']['smokeuser']
+gmetad_user = config['configurations']['ganglia-env']["gmetad_user"]
+gmond_user = config['configurations']['ganglia-env']["gmond_user"]
+tez_user = config['configurations']['tez-env']["tez_user"]
+
+user_group = config['configurations']['cluster-env']['user_group']
+proxyuser_group = default("/configurations/hadoop-env/proxyuser_group","users")
+nagios_group = config['configurations']['nagios-env']['nagios_group']
+
+hagios_server_hosts = default("/clusterHostInfo/nagios_server_host", [])
+ganglia_server_hosts = default("/clusterHostInfo/ganglia_server_host", [])
+namenode_host = default("/clusterHostInfo/namenode_host", [])
+hbase_master_hosts = default("/clusterHostInfo/hbase_master_hosts", [])
+
+has_namenode = not len(namenode_host) == 0
+has_nagios = not len(hagios_server_hosts) == 0
+has_ganglia_server = not len(ganglia_server_hosts) == 0
+has_tez = 'tez-site' in config['configurations']
+has_hbase_masters = not len(hbase_master_hosts) == 0
+
+hbase_tmp_dir = config['configurations']['hbase-site']['hbase.tmp.dir']
+
+hbase_user = config['configurations']['hbase-env']['hbase_user']
+smoke_user = config['configurations']['cluster-env']['smokeuser']
+
+user_group = config['configurations']['cluster-env']['user_group']
+proxyuser_group = default("/configurations/hadoop-env/proxyuser_group","users")
+nagios_group = config['configurations']['nagios-env']['nagios_group']
+
+ignore_groupsusers_create = default("/configurations/cluster-env/ignore_groupsusers_create", False)
+
+smoke_user_dirs = format("/tmp/hadoop-{smoke_user},/tmp/hsperfdata_{smoke_user},/home/{smoke_user},/tmp/{smoke_user},/tmp/sqoop-{smoke_user}")
+if has_hbase_masters:
+ hbase_user_dirs = format("/home/{hbase_user},/tmp/{hbase_user},/usr/bin/{hbase_user},/var/log/{hbase_user},{hbase_tmp_dir}")
+#repo params
+repo_info = config['hostLevelParams']['repo_info']
+service_repo_info = default("/hostLevelParams/service_repo_info",None)
+
+user_to_groups_dict = collections.defaultdict(lambda:[user_group])
+user_to_groups_dict[smoke_user] = [proxyuser_group]
+if has_ganglia_server:
+ user_to_groups_dict[gmond_user] = [gmond_user]
+ user_to_groups_dict[gmetad_user] = [gmetad_user]
+if has_tez:
+ user_to_groups_dict[tez_user] = [proxyuser_group]
+
+user_to_gid_dict = collections.defaultdict(lambda:user_group)
+if has_nagios:
+ user_to_gid_dict[nagios_user] = nagios_group
+
+user_list = json.loads(config['hostLevelParams']['user_list'])
+group_list = json.loads(config['hostLevelParams']['group_list'])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
index 74bdce0..126b8bb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
@@ -56,3 +56,59 @@ def setup_jce():
cwd = security_dir,
path = ['/bin/','/usr/bin']
)
+
+def setup_users():
+ """
+ Creates users before cluster installation
+ """
+ import params
+
+ for group in params.group_list:
+ Group(group,
+ ignore_failures = params.ignore_groupsusers_create
+ )
+
+ for user in params.user_list:
+ User(user,
+ gid = params.user_to_gid_dict[user],
+ groups = params.user_to_groups_dict[user],
+ ignore_failures = params.ignore_groupsusers_create
+ )
+
+ set_uid(params.smoke_user, params.smoke_user_dirs)
+
+ if params.has_hbase_masters:
+ set_uid(params.hbase_user, params.hbase_user_dirs)
+
+def set_uid(user, user_dirs):
+ """
+ user_dirs - comma separated directories
+ """
+ import params
+
+ File(format("{tmp_dir}/changeUid.sh"),
+ content=StaticFile("changeToSecureUid.sh"),
+ mode=0555)
+ Execute(format("{tmp_dir}/changeUid.sh {user} {user_dirs} 2>/dev/null"),
+ not_if = format("test $(id -u {user}) -gt 1000"))
+
+def setup_hadoop_env():
+ import params
+ if params.has_namenode:
+ if params.security_enabled:
+ tc_owner = "root"
+ else:
+ tc_owner = params.hdfs_user
+ Directory(params.hadoop_conf_empty_dir,
+ recursive=True,
+ owner='root',
+ group='root'
+ )
+ Link(params.hadoop_conf_dir,
+ to=params.hadoop_conf_empty_dir,
+ not_if=format("ls {hadoop_conf_dir}")
+ )
+ File(os.path.join(params.hadoop_conf_dir, 'hadoop-env.sh'),
+ owner=tc_owner,
+ content=InlineTemplate(params.hadoop_env_sh_template)
+ )
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/files/changeToSecureUid.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/files/changeToSecureUid.sh b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/files/changeToSecureUid.sh
deleted file mode 100644
index 154c1c0..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/files/changeToSecureUid.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-#
-#
-# 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.
-#
-
-username=$1
-directories=$2
-
-function find_available_uid() {
- for ((i=1001; i<=2000; i++))
- do
- grep -q $i /etc/passwd
- if [ "$?" -ne 0 ]
- then
- newUid=$i
- break
- fi
- done
-}
-
-find_available_uid
-
-if [ $newUid -eq 0 ]
-then
- echo "Failed to find Uid between 1000 and 2000"
- exit 1
-fi
-
-dir_array=($(echo $directories | sed 's/,/\n/g'))
-old_uid=$(id -u $username)
-echo "Changing uid of $username from $old_uid to $newUid"
-echo "Changing directory permisions for ${dir_array[@]}"
-usermod -u $newUid $username && for dir in ${dir_array[@]} ; do chown -Rh $newUid $dir ; done
-exit 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py
index a8a5662..61fba18 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/hook.py
@@ -33,7 +33,6 @@ class BeforeInstallHook(Hook):
install_repos()
install_packages()
setup_java()
- setup_users()
if __name__ == "__main__":
BeforeInstallHook().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
index 720777f..0116e97 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
@@ -21,41 +21,6 @@ import os
from resource_management import *
-def setup_users():
- """
- Creates users before cluster installation
- """
- import params
-
- for group in params.group_list:
- Group(group,
- ignore_failures = params.ignore_groupsusers_create
- )
-
- for user in params.user_list:
- User(user,
- gid = params.user_to_gid_dict[user],
- groups = params.user_to_groups_dict[user],
- ignore_failures = params.ignore_groupsusers_create
- )
-
- set_uid(params.smoke_user, params.smoke_user_dirs)
-
- if params.has_hbase_masters:
- set_uid(params.hbase_user, params.hbase_user_dirs)
-
-def set_uid(user, user_dirs):
- """
- user_dirs - comma separated directories
- """
- import params
-
- File(format("{tmp_dir}/changeUid.sh"),
- content=StaticFile("changeToSecureUid.sh"),
- mode=0555)
- Execute(format("{tmp_dir}/changeUid.sh {user} {user_dirs} 2>/dev/null"),
- not_if = format("test $(id -u {user}) -gt 1000"))
-
def setup_java():
"""
Installs jdk using specific params, that comes from ambari-server
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
index a18a776..c90a55c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/hook.py
@@ -27,7 +27,6 @@ class BeforeStartHook(Hook):
import params
self.run_custom_hook('before-ANY')
- self.run_custom_hook('after-INSTALL')
env.set_params(params)
setup_hadoop()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py b/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
index 2056168..dabaaf6 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/hooks/after-INSTALL/test_after_install.py
@@ -30,19 +30,6 @@ class TestHookAfterInstall(RMFTestCase):
command="hook",
config_file="default.json"
)
- self.assertResourceCalled('Directory', '/etc/hadoop/conf.empty',
- owner = 'root',
- group = 'root',
- recursive = True,
- )
- self.assertResourceCalled('Link', '/etc/hadoop/conf',
- to = '/etc/hadoop/conf.empty',
- not_if = 'ls /etc/hadoop/conf'
- )
- self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-env.sh',
- content = InlineTemplate(self.getConfig()['configurations']['hadoop-env']['content']),
- owner = 'hdfs',
- )
self.assertResourceCalled('XmlConfig', 'core-site.xml',
owner = 'hdfs',
group = 'hadoop',
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
index bdf0fa4..836274a 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-ANY/test_before_any.py
@@ -36,4 +36,123 @@ class TestHookBeforeInstall(RMFTestCase):
ignore_failures = True,
path = ['/bin', '/usr/bin/'],
)
+ self.assertResourceCalled('Group', 'hadoop',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('Group', 'nobody',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('Group', 'users',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('Group', 'nagios',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('User', 'hive',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'oozie',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'nobody',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'nobody'],
+ )
+ self.assertResourceCalled('User', 'nagios',
+ gid = 'nagios',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'ambari-qa',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'users'],
+ )
+ self.assertResourceCalled('User', 'flume',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'hdfs',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'storm',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'mapred',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'hbase',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'tez',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'zookeeper',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'falcon',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'sqoop',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'yarn',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'hcat',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('File', '/tmp/changeUid.sh',
+ content = StaticFile('changeToSecureUid.sh'),
+ mode = 0555,
+ )
+ self.assertResourceCalled('Execute', '/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa 2>/dev/null',
+ not_if = 'test $(id -u ambari-qa) -gt 1000',
+ )
+ self.assertResourceCalled('File', '/tmp/changeUid.sh',
+ content = StaticFile('changeToSecureUid.sh'),
+ mode = 0555,
+ )
+ self.assertResourceCalled('Execute', '/tmp/changeUid.sh hbase /home/hbase,/tmp/hbase,/usr/bin/hbase,/var/log/hbase,/hadoop/hbase 2>/dev/null',
+ not_if = 'test $(id -u hbase) -gt 1000',
+ )
+ self.assertResourceCalled('Directory', '/etc/hadoop/conf.empty',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('Link', '/etc/hadoop/conf',
+ not_if = 'ls /etc/hadoop/conf',
+ to = '/etc/hadoop/conf.empty',
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-env.sh',
+ content = InlineTemplate(self.getConfig()['configurations']['hadoop-env']['content']),
+ owner = 'hdfs',
+ )
self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
index 4758630..1f508c7 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/hooks/before-INSTALL/test_before_install.py
@@ -47,111 +47,5 @@ class TestHookBeforeInstall(RMFTestCase):
not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
path = ['/bin', '/usr/bin/'],
)
- self.assertResourceCalled('Group', 'hadoop',
- ignore_failures = False,
- )
- self.assertResourceCalled('Group', 'nobody',
- ignore_failures = False,
- )
- self.assertResourceCalled('Group', 'users',
- ignore_failures = False,
- )
- self.assertResourceCalled('Group', 'nagios',
- ignore_failures = False,
- )
- self.assertResourceCalled('User', 'hive',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'oozie',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'nobody',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'nobody'],
- )
- self.assertResourceCalled('User', 'nagios',
- gid = 'nagios',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'ambari-qa',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'users'],
- )
- self.assertResourceCalled('User', 'flume',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'hdfs',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'storm',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'mapred',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'hbase',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'tez',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'zookeeper',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'falcon',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'sqoop',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'yarn',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'hcat',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('File', '/tmp/changeUid.sh',
- content = StaticFile('changeToSecureUid.sh'),
- mode = 0555,
- )
- self.assertResourceCalled('Execute', '/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa 2>/dev/null',
- not_if = 'test $(id -u ambari-qa) -gt 1000',
- )
- self.assertResourceCalled('File', '/tmp/changeUid.sh',
- content = StaticFile('changeToSecureUid.sh'),
- mode = 0555,
- )
- self.assertResourceCalled('Execute', '/tmp/changeUid.sh hbase /home/hbase,/tmp/hbase,/usr/bin/hbase,/var/log/hbase,/hadoop/hbase 2>/dev/null',
- not_if = 'test $(id -u hbase) -gt 1000',
- )
self.assertResourceCalled('Package', 'unzip',)
self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
index 228b403..84a72b4 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
@@ -30,19 +30,6 @@ class TestHookAfterInstall(RMFTestCase):
command="hook",
config_file="default.json"
)
- self.assertResourceCalled('Directory', '/etc/hadoop/conf.empty',
- owner = 'root',
- group = 'root',
- recursive = True,
- )
- self.assertResourceCalled('Link', '/etc/hadoop/conf',
- to = '/etc/hadoop/conf.empty',
- not_if = 'ls /etc/hadoop/conf'
- )
- self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-env.sh',
- content = InlineTemplate(self.getConfig()['configurations']['hadoop-env']['content']),
- owner = 'hdfs',
- )
self.assertResourceCalled('XmlConfig', 'core-site.xml',
owner = 'hdfs',
group = 'hadoop',
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
index d1c4e45..6175577 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
@@ -36,4 +36,123 @@ class TestHookBeforeInstall(RMFTestCase):
ignore_failures = True,
path = ['/bin', '/usr/bin/'],
)
+ self.assertResourceCalled('Group', 'hadoop',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('Group', 'nobody',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('Group', 'users',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('Group', 'nagios',
+ ignore_failures = False,
+ )
+ self.assertResourceCalled('User', 'hive',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'oozie',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'nobody',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'nobody'],
+ )
+ self.assertResourceCalled('User', 'nagios',
+ gid = 'nagios',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'ambari-qa',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'users'],
+ )
+ self.assertResourceCalled('User', 'flume',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'hdfs',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'storm',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'mapred',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'hbase',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'tez',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'users'],
+ )
+ self.assertResourceCalled('User', 'zookeeper',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'falcon',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'sqoop',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'yarn',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('User', 'hcat',
+ gid = 'hadoop',
+ ignore_failures = False,
+ groups = [u'hadoop'],
+ )
+ self.assertResourceCalled('File', '/tmp/changeUid.sh',
+ content = StaticFile('changeToSecureUid.sh'),
+ mode = 0555,
+ )
+ self.assertResourceCalled('Execute', '/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa 2>/dev/null',
+ not_if = 'test $(id -u ambari-qa) -gt 1000',
+ )
+ self.assertResourceCalled('File', '/tmp/changeUid.sh',
+ content = StaticFile('changeToSecureUid.sh'),
+ mode = 0555,
+ )
+ self.assertResourceCalled('Execute', '/tmp/changeUid.sh hbase /home/hbase,/tmp/hbase,/usr/bin/hbase,/var/log/hbase,/hadoop/hbase 2>/dev/null',
+ not_if = 'test $(id -u hbase) -gt 1000',
+ )
+ self.assertResourceCalled('Directory', '/etc/hadoop/conf.empty',
+ owner = 'root',
+ group = 'root',
+ recursive = True,
+ )
+ self.assertResourceCalled('Link', '/etc/hadoop/conf',
+ not_if = 'ls /etc/hadoop/conf',
+ to = '/etc/hadoop/conf.empty',
+ )
+ self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-env.sh',
+ content = InlineTemplate(self.getConfig()['configurations']['hadoop-env']['content']),
+ owner = 'hdfs',
+ )
self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/11405289/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
index ec4db47..1ae0e60 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
@@ -49,110 +49,4 @@ class TestHookBeforeInstall(RMFTestCase):
not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
path = ['/bin', '/usr/bin/'],
)
- self.assertResourceCalled('Group', 'hadoop',
- ignore_failures = False,
- )
- self.assertResourceCalled('Group', 'nobody',
- ignore_failures = False,
- )
- self.assertResourceCalled('Group', 'users',
- ignore_failures = False,
- )
- self.assertResourceCalled('Group', 'nagios',
- ignore_failures = False,
- )
- self.assertResourceCalled('User', 'hive',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'oozie',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'nobody',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'nobody'],
- )
- self.assertResourceCalled('User', 'nagios',
- gid = 'nagios',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'ambari-qa',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'users'],
- )
- self.assertResourceCalled('User', 'flume',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'hdfs',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'storm',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'mapred',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'hbase',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'tez',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'users'],
- )
- self.assertResourceCalled('User', 'zookeeper',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'falcon',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'sqoop',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'yarn',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('User', 'hcat',
- gid = 'hadoop',
- ignore_failures = False,
- groups = [u'hadoop'],
- )
- self.assertResourceCalled('File', '/tmp/changeUid.sh',
- content = StaticFile('changeToSecureUid.sh'),
- mode = 0555,
- )
- self.assertResourceCalled('Execute', '/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa 2>/dev/null',
- not_if = 'test $(id -u ambari-qa) -gt 1000',
- )
- self.assertResourceCalled('File', '/tmp/changeUid.sh',
- content = StaticFile('changeToSecureUid.sh'),
- mode = 0555,
- )
- self.assertResourceCalled('Execute', '/tmp/changeUid.sh hbase /home/hbase,/tmp/hbase,/usr/bin/hbase,/var/log/hbase,/hadoop/hbase 2>/dev/null',
- not_if = 'test $(id -u hbase) -gt 1000',
- )
self.assertNoMoreResources()