summaryrefslogtreecommitdiff
path: root/ambari-agent
diff options
context:
space:
mode:
authorMahadev Konar <mahadev@apache.org>2012-11-07 08:49:58 +0000
committerMahadev Konar <mahadev@apache.org>2012-11-07 08:49:58 +0000
commit36d646ee25536c2584f7e5e94fdaf8637b7066d3 (patch)
tree5c9a1b9bd7d24f329b8c09fc2830ed80224e8b39 /ambari-agent
parente3b14497c51c125be53542ed112360b6ae6aed74 (diff)
AMBARI-974. Decommissioning of datanodes. (Jitendra Pandey via mahadev)
git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1406498 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'ambari-agent')
-rw-r--r--ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp2
-rw-r--r--ambari-agent/src/main/puppet/modules/hdp/manifests/lib/puppet/parser/functions/pkgName.rb191
-rw-r--r--ambari-agent/src/main/python/ambari_agent/AmbariConfig.py2
-rw-r--r--ambari-agent/src/main/python/ambari_agent/RepoInstaller.py7
-rw-r--r--ambari-agent/src/main/python/ambari_agent/puppetExecutor.py12
-rw-r--r--ambari-agent/src/main/python/ambari_agent/rolesToClass.dict1
6 files changed, 16 insertions, 199 deletions
diff --git a/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp b/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp
index 2fcff94406..e11dcfc32f 100644
--- a/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp/manifests/init.pp
@@ -232,7 +232,7 @@ define hdp::exec(
$user = undef,
$creates = undef,
$tries = 1,
- $timeout = 900,
+ $timeout = 300,
$try_sleep = undef,
$initial_wait = undef,
$logoutput = 'on_failure',
diff --git a/ambari-agent/src/main/puppet/modules/hdp/manifests/lib/puppet/parser/functions/pkgName.rb b/ambari-agent/src/main/puppet/modules/hdp/manifests/lib/puppet/parser/functions/pkgName.rb
deleted file mode 100644
index 929eac7d7a..0000000000
--- a/ambari-agent/src/main/puppet/modules/hdp/manifests/lib/puppet/parser/functions/pkgName.rb
+++ /dev/null
@@ -1,191 +0,0 @@
-#
-#
-# 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.
-#
-#
-
-# Returns package name(s) for the specific OS and architecture
-# Params:
-#
-# - name of the package
-# - OS name
-# - OS architecture
-#
-# If there are no approprite OS/architecture, it will search default entries (named as ALL)
-module Puppet::Parser::Functions
- newfunction(:pkgName, :type => :rvalue) do |args|
- packageName = args[0]
- os = args[1]
- arch = args[2]
- ALL = 'ALL'
-
- # First level (packages): packageName => OS hashmap
- # Second level (OS hashmap): Architecture => real package name(s)
- packages = {
- 'ganglia-monitor' => {
- 'ALL' => {
- 64 => 'ganglia-gmond-3.2.0'
- }
- },
- 'ganglia-server' => {
- 'ALL' => {
- 64 => 'ganglia-gmetad-3.2.0'
- }
- },
- 'ganglia-gweb' => {
- 'ALL' => {
- 64 => 'gweb'
- }
- },
- 'ganglia-hdp-gweb-addons' => {
- ALL => {
- 64 => 'hdp_mon_ganglia_addons'
- }
- },
- 'glibc' => {
- 'rhel6' => {
- ALL => ['glibc','glibc.i686']
- }
- },
- 'nagios-addons' => {
- ALL => {
- 64 => 'hdp_mon_nagios_addons'
- }
- },
- 'nagios-server' => {
- ALL => {
- 64 => 'nagios-3.2.3'
- }
- },
- 'nagios-plugins' => {
- ALL => {
- 64 => 'nagios-plugins-1.4.9'
- }
- },
- 'nagios-fping' => {
- ALL => {
- 64 =>'fping'
- }
- },
- 'nagios-php-pecl-json' => {
- ALL => {
- 64 => 'php-pecl-json.x86_64'
- }
- },
- 'snmp' => {
- ALL => {
- 64 => ['net-snmp','net-snmp-utils'],
- }
- },
- 'dashboard' => {
- ALL => {
- 64 => 'hdp_mon_dashboard'
- }
- },
- 'templeton' => {
- ALL => {
- ALL => 'templeton'
- }
- },
- 'oozie-client' => {
- ALL => {
- 64 => 'oozie-client.noarch'
- }
- },
- 'oozie-server' => {
- ALL => {
- 64 => 'oozie.noarch'
- }
- },
- 'lzo' => {
- 'rhel5' => {
- ALL => ['lzo','lzo.i386','lzo-devel','lzo-devel.i386']
- },
- 'rhel6' => {
- ALL => ['lzo','lzo.i686','lzo-devel','lzo-devel.i686']
- }
- },
- #TODO: make these two consistent on whether case of 64/32 bits
- 'snappy' => {
- ALL => {
- 32 => ['snappy','snappy-devel'],
- 64 => ['snappy','snappy-devel']
- }
- },
- 'mysql' => {
- ALL => {
- 32 => ['mysql','mysql-server']
- }
- },
- 'mysql-connector' => {
- ALL => {
- 64 => ['mysql-connector-java']
- }
- },
- 'extjs' => {
- ALL => {
- 64 => ['extjs-2.2-1']
- }
- },
- 'templeton-tar-hive' => {
- ALL => {
- 64 => ['templeton-tar-hive-0.0.1.14-1']
- }
- },
- 'templeton-tar-pig' => {
- ALL => {
- 64 => ['templeton-tar-pig-0.0.1.14-1']
- }
- }
- }
- ########################################################
- ########################################################
- # seeking package hashmap
- pkgHash = nil
-
- if has_key(packages, packageName)
- pkgHash = packages[packageName]
- else
- print "Wrong package name: " + packageName
- return nil
- end
-
- # seeking os hashmap
- osHash = nil
-
- if has_key(pkgHash, os)
- osHash = pkgHash[os]
- elsif has_key(pkgHash, ALL)
- osHash = pkgHash[ALL]
- else
- print "Wrong package name: " + packageName
- return nil
- end
-
- #seeking arhitecture
- result = nil
-
- if has_key(osHash, arch)
- result = osHash[arch]
- elsif has_key(osHash, ALL)
- result = osHash[ALL]
- end
-
- return result
- end
-end \ No newline at end of file
diff --git a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
index fbd79e772c..12716fdebd 100644
--- a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
+++ b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
@@ -39,7 +39,7 @@ serviceToPidMapFile=servicesToPidNames.dict
pidLookupPath=/var/run/
[stack]
-installprefix=/var/ambari/
+installprefix=/tmp
[puppet]
puppetmodules=/var/lib/ambari-agent/puppet/
diff --git a/ambari-agent/src/main/python/ambari_agent/RepoInstaller.py b/ambari-agent/src/main/python/ambari_agent/RepoInstaller.py
index 67eda7a9ae..ecf43e3894 100644
--- a/ambari-agent/src/main/python/ambari_agent/RepoInstaller.py
+++ b/ambari-agent/src/main/python/ambari_agent/RepoInstaller.py
@@ -23,7 +23,8 @@ import os
import json
from shell import shellRunner
from manifestGenerator import writeImports
-
+from pprint import pprint, pformat
+import ast
PUPPET_EXT=".pp"
@@ -44,11 +45,13 @@ class RepoInstaller:
params = self.parsedJson['hostLevelParams']
if params.has_key('repo_info'):
self.repoInfoList = params['repo_info']
+ self.repoInfoList = ast.literal_eval(self.repoInfoList)
def generateFiles(self):
repoPuppetFiles = []
for repo in self.repoInfoList:
- repoFile = open(self.path + os.sep + repo['repoId'] + '-' + str(self.taskId) + PUPPET_EXT, 'w+')
+ repoFile = open(self.path + os.sep + repo['repoId'] + '-' +
+ str(self.taskId) + PUPPET_EXT, 'w+')
writeImports(repoFile, self.modulesdir, inputFileName='imports.txt')
baseUrl = ''
diff --git a/ambari-agent/src/main/python/ambari_agent/puppetExecutor.py b/ambari-agent/src/main/python/ambari_agent/puppetExecutor.py
index 81c002ddb1..f7c70397e6 100644
--- a/ambari-agent/src/main/python/ambari_agent/puppetExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/puppetExecutor.py
@@ -130,17 +130,21 @@ class puppetExecutor:
if error == self.NO_ERROR:
if result.has_key("stdout"):
- result["stdout"] = result["stdout"] + os.linesep + str(grep.tail(puppetOutput, self.OUTPUT_LAST_LINES))
+ result["stdout"] = result["stdout"] + os.linesep + \
+ str(grep.tail(puppetOutput, self.OUTPUT_LAST_LINES))
else:
result["stdout"] = grep.tail(puppetOutput, self.OUTPUT_LAST_LINES)
else:
if result.has_key("stdout"):
- result["stdout"] = result["stdout"] + os.linesep + str(grep.grep(puppetOutput, "err", self.ERROR_LAST_LINES_BEFORE, self.ERROR_LAST_LINES_AFTER))
+ result["stdout"] = result["stdout"] + os.linesep + \
+ str(grep.grep(puppetOutput, "err", self.ERROR_LAST_LINES_BEFORE,
+ self.ERROR_LAST_LINES_AFTER))
else:
- result["stdout"] = str(grep.grep(puppetOutput, "err", self.ERROR_LAST_LINES_BEFORE, self.ERROR_LAST_LINES_AFTER))
+ result["stdout"] = str(grep.grep(puppetOutput, "err",
+ self.ERROR_LAST_LINES_BEFORE,
+ self.ERROR_LAST_LINES_AFTER))
logger.info("ExitCode : " + str(result["exitcode"]))
-
return result
def main():
diff --git a/ambari-agent/src/main/python/ambari_agent/rolesToClass.dict b/ambari-agent/src/main/python/ambari_agent/rolesToClass.dict
index 1f60d6fa77..3fb958c06a 100644
--- a/ambari-agent/src/main/python/ambari_agent/rolesToClass.dict
+++ b/ambari-agent/src/main/python/ambari_agent/rolesToClass.dict
@@ -38,3 +38,4 @@ PIG_SERVICE_CHECK = hdp-pig::pig::service_check
SQOOP_SERVICE_CHECK = hdp-sqoop::sqoop::service_check
TEMPLETON_SERVICE_CHECK = hdp-templeton::templeton::service_check
DASHBOARD_SERVICE_CHECK = hdp-dashboard::dashboard::service_check
+DECOMMISSION_DATANODE = hdp-hadoop::hdfs::decommission