瀏覽代碼

AMBARI-1991. Remove unused python files from ambari-agent. (smohanty)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1469941 13f79535-47bb-0310-9956-ffa450edef68
Sumit Mohanty 12 年之前
父節點
當前提交
04e73cc4bf
共有 35 個文件被更改,包括 53 次插入982 次删除
  1. 2 0
      CHANGES.txt
  2. 4 9
      ambari-agent/src/main/python/ambari_agent/ActionQueue.py
  3. 0 52
      ambari-agent/src/main/python/ambari_agent/ActionResults.py
  4. 0 2
      ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
  5. 6 10
      ambari-agent/src/main/python/ambari_agent/Controller.py
  6. 0 48
      ambari-agent/src/main/python/ambari_agent/DaemonHandler.py
  7. 0 185
      ambari-agent/src/main/python/ambari_agent/FileUtil.py
  8. 3 4
      ambari-agent/src/main/python/ambari_agent/Hardware.py
  9. 4 6
      ambari-agent/src/main/python/ambari_agent/Heartbeat.py
  10. 0 4
      ambari-agent/src/main/python/ambari_agent/LiveStatus.py
  11. 0 3
      ambari-agent/src/main/python/ambari_agent/NetUtil.py
  12. 0 48
      ambari-agent/src/main/python/ambari_agent/PackageHandler.py
  13. 0 38
      ambari-agent/src/main/python/ambari_agent/ProcUtil.py
  14. 5 3
      ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py
  15. 4 4
      ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
  16. 3 7
      ambari-agent/src/main/python/ambari_agent/Register.py
  17. 3 4
      ambari-agent/src/main/python/ambari_agent/RepoInstaller.py
  18. 0 66
      ambari-agent/src/main/python/ambari_agent/Runner.py
  19. 0 50
      ambari-agent/src/main/python/ambari_agent/ServerStatus.py
  20. 1 5
      ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py
  21. 2 3
      ambari-agent/src/main/python/ambari_agent/StatusCheck.py
  22. 3 9
      ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py
  23. 0 7
      ambari-agent/src/main/python/ambari_agent/__init__.py
  24. 0 205
      ambari-agent/src/main/python/ambari_agent/createDaemon.py
  25. 0 37
      ambari-agent/src/main/python/ambari_agent/daemon.py
  26. 2 1
      ambari-agent/src/main/python/ambari_agent/hostname.py
  27. 0 60
      ambari-agent/src/main/python/ambari_agent/machine.py
  28. 3 4
      ambari-agent/src/main/python/ambari_agent/main.py
  29. 2 3
      ambari-agent/src/main/python/ambari_agent/manifestGenerator.py
  30. 3 3
      ambari-agent/src/main/python/ambari_agent/security.py
  31. 2 4
      ambari-agent/src/main/python/ambari_agent/shell.py
  32. 0 1
      ambari-agent/src/test/python/TestActionQueue.py
  33. 1 7
      ambari-agent/src/test/python/TestAgentActions.py
  34. 0 61
      ambari-agent/src/test/python/TestFileUtil.py
  35. 0 29
      ambari-agent/src/test/python/TestServerStatus.py

+ 2 - 0
CHANGES.txt

@@ -774,6 +774,8 @@ Trunk (unreleased changes):
 
 
  BUG FIXES
  BUG FIXES
 
 
+ AMBARI-1991. Remove unused python files from ambari-agent. (smohanty)
+
  AMBARI-1984. WebHCat log and pid dirs configs should be under WebHCat >
  AMBARI-1984. WebHCat log and pid dirs configs should be under WebHCat >
  Advanced. (yusaku)
  Advanced. (yusaku)
 
 

+ 4 - 9
ambari-agent/src/main/python/ambari_agent/ActionQueue.py

@@ -20,26 +20,21 @@ limitations under the License.
 
 
 import logging
 import logging
 import traceback
 import traceback
-import logging.handlers
 import Queue
 import Queue
 import threading
 import threading
-import AmbariConfig
-from LiveStatus import LiveStatus
-from shell import shellRunner
-from FileUtil import writeFile, createStructure, deleteStructure, getFilePath, appendToFile
-import json
 import pprint
 import pprint
 import os
 import os
 import time
 import time
-import subprocess
-import copy
+
+from LiveStatus import LiveStatus
+from shell import shellRunner
 import PuppetExecutor
 import PuppetExecutor
 import UpgradeExecutor
 import UpgradeExecutor
 import PythonExecutor
 import PythonExecutor
-import tempfile
 from Grep import Grep
 from Grep import Grep
 from ActualConfigHandler import ActualConfigHandler
 from ActualConfigHandler import ActualConfigHandler
 
 
+
 logger = logging.getLogger()
 logger = logging.getLogger()
 installScriptHash = -1
 installScriptHash = -1
 
 

+ 0 - 52
ambari-agent/src/main/python/ambari_agent/ActionResults.py

@@ -1,52 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-import logging
-import logging.handlers
-import Queue
-import ActionQueue
-
-logger = logging.getLogger()
-
-class ActionResults:
-  global r
-
-  # Build action results list from memory queue
-  def build(self):
-    results = []
-    while not ActionQueue.r.empty():
-      result = { 
-                 'clusterId': 'unknown',
-                 'id' : 'action-001',
-                 'kind' : 'STOP_ACTION',
-                 'commandResults' : [],
-                 'cleanUpCommandResults' : [],
-                 'serverName' : 'hadoop.datanode'
-               }
-      results.append(result)
-    logger.info(results)
-    return results
-
-def main(argv=None):
-  ar = ActionResults()
-  print ar.build()
-
-if __name__ == '__main__':
-  main()

+ 0 - 2
ambari-agent/src/main/python/ambari_agent/AmbariConfig.py

@@ -18,8 +18,6 @@ See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 '''
 '''
 
 
-import logging
-import logging.handlers
 import ConfigParser
 import ConfigParser
 import StringIO
 import StringIO
 
 

+ 6 - 10
ambari-agent/src/main/python/ambari_agent/Controller.py

@@ -19,28 +19,24 @@ limitations under the License.
 '''
 '''
 
 
 import logging
 import logging
-import logging.handlers
 import signal
 import signal
 import json
 import json
-import hostname
-import sys, traceback
+import sys
 import time
 import time
 import threading
 import threading
 import urllib2
 import urllib2
-from urllib2 import Request, urlopen, URLError
-import httplib
-import ssl
-import AmbariConfig
 import pprint
 import pprint
+from random import randint
+
+import hostname
+import AmbariConfig
 import ProcessHelper
 import ProcessHelper
 from Heartbeat import Heartbeat
 from Heartbeat import Heartbeat
 from Register import Register
 from Register import Register
 from ActionQueue import ActionQueue
 from ActionQueue import ActionQueue
-from optparse import OptionParser
-from wsgiref.simple_server import ServerHandler
 import security
 import security
 from NetUtil import NetUtil
 from NetUtil import NetUtil
-from random import randrange, randint
+
 
 
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 

+ 0 - 48
ambari-agent/src/main/python/ambari_agent/DaemonHandler.py

@@ -1,48 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-import simplejson
-import web
-from mimerender import mimerender
-from Runner import Runner
-
-render_json = lambda **args: simplejson.dumps(args)
-
-class DaemonHandler:
-    @mimerender(
-        default = 'json',
-        json = render_json
-    )
-    
-    def GET(self, cmd, daemonName):
-        data = []
-        data['cmd']=cmd
-        data['daemonName']=daemonName
-        dispatcher = Runner()
-        return dispatcher.run(data)
-    
-    def POST(self, cmd):
-        web.header('Content-Type','application/json')
-        data = web.data();
-        jsonp = simplejson.loads(data)
-        jsonp['cmd']=cmd
-        dispatcher = Runner()
-        return dispatcher.run(jsonp)
-

+ 0 - 185
ambari-agent/src/main/python/ambari_agent/FileUtil.py

@@ -1,185 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-from pwd import getpwnam
-from grp import getgrnam
-import logging
-import logging.handlers
-import getpass
-import os, errno
-import sys, traceback
-import ConfigParser
-import shutil
-import StringIO
-import AmbariConfig
-
-logger = logging.getLogger()
-
-def getFilePath(action, fileName=""):
-  #Change the method signature to take the individual action fields
-  pathComp=""
-  if 'clusterId' in action:
-    pathComp = action['clusterId']
-  if 'role' in action:
-    pathComp = pathComp + "-" + action['role'] 
-  path = os.path.join(AmbariConfig.config.get('agent','prefix'),
-                      "clusters", 
-                      pathComp)
-  fullPathName=""
-  if fileName != "":
-    fullPathName=os.path.join(path, fileName)
-  else:
-    fileInfo = action['file']
-    fullPathName=os.path.join(path, fileInfo['path'])
-  return fullPathName
-  
-def appendToFile(data,absolutePath):
-  f = open(absolutePath, 'a')
-  f.write(data)
-  f.close()
-
-def writeFile(action, result, fileName=""):
-  fileInfo = action['file']
-  pathComp=""
-  if 'clusterId' in action:
-    pathComp = action['clusterId']
-  if 'role' in action:
-    pathComp = pathComp + "-" + action['role'] 
-  try:
-    path = os.path.join(AmbariConfig.config.get('agent','prefix'),
-                        "clusters", 
-                        pathComp)
-    user=getpass.getuser()
-    if 'owner' in fileInfo:
-      user=fileInfo['owner']
-    group=os.getgid()
-    if 'group' in fileInfo:
-      group=fileInfo['group']
-    fullPathName=""
-    if fileName != "":
-      fullPathName=os.path.join(path, fileName)
-    else:
-      fullPathName=os.path.join(path, fileInfo['path'])
-    logger.debug("path in writeFile: %s" % fullPathName)
-    content=fileInfo['data']
-    try:
-      if isinstance(user, int)!=True:
-        user=getpwnam(user)[2]
-      if isinstance(group, int)!=True:
-        group=getgrnam(group)[2]
-    except Exception:
-      logger.warn("can not find user uid/gid: (%s/%s) for writing %s" % (user, group, fullPathName))
-    if 'permission' in fileInfo:
-      if fileInfo['permission'] is not None:
-        permission=fileInfo['permission']
-    else:
-      permission=0750
-    oldMask = os.umask(0)
-    if 'umask' in fileInfo:
-      if fileInfo['umask'] is not None: 
-        umask=int(fileInfo['umask'])
-    else:
-      umask=oldMask 
-    os.umask(int(umask))
-    prefix = os.path.dirname(fullPathName)
-    try:
-      os.makedirs(prefix)
-    except OSError as err:
-      if err.errno == errno.EEXIST:
-        pass
-      else:
-        raise
-    f = open(fullPathName, 'w')
-    f.write(content)
-    f.close()
-    if os.getuid()==0:
-      os.chmod(fullPathName, permission)
-      os.chown(fullPathName, user, group)
-    os.umask(oldMask)
-    result['exitCode'] = 0
-  except Exception, err:
-    traceback.print_exc()
-    result['exitCode'] = 1
-    result['error'] = traceback.format_exc()
-  return result
-
-def createStructure(action, result):
-  try:
-    workdir = action['workDirComponent']
-    path = AmbariConfig.config.get('agent','prefix')+"/clusters/"+workdir
-    shutil.rmtree(path, 1)
-    os.makedirs(path+"/stack")
-    os.makedirs(path+"/logs")
-    os.makedirs(path+"/data")
-    os.makedirs(path+"/pkgs")
-    os.makedirs(path+"/config")
-    result['exitCode'] = 0
-  except Exception, err:
-    traceback.print_exc()
-    result['exitCode'] = 1
-    result['error'] = traceback.format_exc()
-  return result
-
-def deleteStructure(action, result):
-  try:
-    workdir = action['workDirComponent']
-    path = AmbariConfig.config.get('agent','prefix')+"/clusters/"+workdir
-    if os.path.exists(path):
-      shutil.rmtree(path)
-    result['exitCode'] = 0
-  except Exception, err:
-    result['exitCode'] = 1
-    result['error'] = traceback.format_exc()
-  return result
-
-def main():
-
-  action = { 'clusterId' : 'abc', 'role' : 'hdfs' }
-  result = {}
-  print createStructure(action, result)
-
-  configFile = {
-    "data"       : "test", 
-    "owner"      : os.getuid(), 
-    "group"      : os.getgid() , 
-    "permission" : 0700, 
-    "path"       : "/tmp/ambari_file_test/_file_write_test", 
-    "umask"      : 022 
-  }
-  action = { 'file' : configFile }
-  result = { }
-  print writeFile(action, result)
-
-  configFile = { 
-    "data"       : "test", 
-    "owner"      : "eyang", 
-    "group"      : "staff", 
-    "permission" : "0700", 
-    "path"       : "/tmp/ambari_file_test/_file_write_test", 
-    "umask"      : "022" 
-  }
-  result = { }
-  action = { 'file' : configFile }
-  print writeFile(action, result)
-
-  print deleteStructure(action, result)
-
-if __name__ == "__main__":
-  main()

+ 3 - 4
ambari-agent/src/main/python/ambari_agent/Hardware.py

@@ -18,16 +18,15 @@ See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 '''
 '''
 
 
-import multiprocessing
-import platform
-import AmbariConfig
 import os.path
 import os.path
-import shell
 import logging
 import logging
 import subprocess
 import subprocess
 import pprint
 import pprint
 import traceback
 import traceback
 
 
+import AmbariConfig
+
+
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 
 class Hardware:
 class Hardware:

+ 4 - 6
ambari-agent/src/main/python/ambari_agent/Heartbeat.py

@@ -20,17 +20,15 @@ limitations under the License.
 
 
 import json
 import json
 import logging
 import logging
-from Hardware import Hardware
+import time
+from pprint import pformat
+
 from ActionQueue import ActionQueue
 from ActionQueue import ActionQueue
-from ServerStatus import ServerStatus
-import NetUtil
 import AmbariConfig
 import AmbariConfig
 import hostname
 import hostname
-import time
-import traceback
-from pprint import pprint, pformat
 from HostInfo import HostInfo
 from HostInfo import HostInfo
 
 
+
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 
 firstContact = True
 firstContact = True

+ 0 - 4
ambari-agent/src/main/python/ambari_agent/LiveStatus.py

@@ -22,10 +22,6 @@ import json
 import logging
 import logging
 from StatusCheck import StatusCheck
 from StatusCheck import StatusCheck
 import AmbariConfig
 import AmbariConfig
-import socket
-import time
-import traceback
-from pprint import pprint, pformat
 from StackVersionsFileHandler import StackVersionsFileHandler
 from StackVersionsFileHandler import StackVersionsFileHandler
 from ActualConfigHandler import ActualConfigHandler
 from ActualConfigHandler import ActualConfigHandler
 
 

+ 0 - 3
ambari-agent/src/main/python/ambari_agent/NetUtil.py

@@ -14,12 +14,9 @@
 # limitations under the License.
 # limitations under the License.
 
 
 
 
-from httplib import HTTPS
 from urlparse import urlparse
 from urlparse import urlparse
 import time
 import time
 import logging
 import logging
-import pprint
-import traceback
 import httplib
 import httplib
 
 
 logger = logging.getLogger()
 logger = logging.getLogger()

+ 0 - 48
ambari-agent/src/main/python/ambari_agent/PackageHandler.py

@@ -1,48 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-import simplejson
-import web
-from mimerender import mimerender
-from Runner import Runner
-
-render_json = lambda **args: simplejson.dumps(args)
-
-class PackageHandler:
-    @mimerender(
-        default = 'json',
-        json = render_json
-    )
-    
-    def GET(self, cmd, packageName):
-        data = []
-        data['cmd'] = cmd
-        data['package'] = { "name" : packageName }
-        dispatcher = Runner()
-        return dispatcher.run(data)
-    
-    def POST(self, cmd):        
-        web.header('Content-Type','application/json')
-        data = web.data()
-        jsonp = simplejson.loads(data)
-        jsonp['cmd']=cmd
-        dispatcher = Runner()
-        return dispatcher.run(jsonp)
-

+ 0 - 38
ambari-agent/src/main/python/ambari_agent/ProcUtil.py

@@ -1,38 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-import sys
-import os
-
-def get_proc_status(pid):
-  pid = int(pid)
-  path = ("/proc/%d/status" % pid)
-  if not os.path.exists(path):
-    return None
-  status_file = open(path)
-  lines = status_file.readlines()
-  for line in lines:
-    if line.startswith("State:"):
-      return line.split(":",1)[1].strip().split(' ')[0].split(" ",1)[0]
-  return None
-    
-if __name__ == '__main__':
-  state = get_proc_status(sys.argv[1])
-  print state

+ 5 - 3
ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py

@@ -21,13 +21,15 @@ import json
 import os.path
 import os.path
 import logging
 import logging
 import subprocess
 import subprocess
+import pprint
+import threading
+from threading import Thread
+
 from manifestGenerator import generateManifest
 from manifestGenerator import generateManifest
 from RepoInstaller import RepoInstaller
 from RepoInstaller import RepoInstaller
-import pprint, threading
 from Grep import Grep
 from Grep import Grep
-from threading import Thread
 import shell
 import shell
-import traceback
+
 
 
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 

+ 4 - 4
ambari-agent/src/main/python/ambari_agent/PythonExecutor.py

@@ -17,14 +17,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 '''
 '''
-import os.path
 import logging
 import logging
 import subprocess
 import subprocess
-import pprint, threading
-from Grep import Grep
+import pprint
+import threading
 from threading import Thread
 from threading import Thread
+from Grep import Grep
 import shell
 import shell
-import traceback
+
 
 
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 

+ 3 - 7
ambari-agent/src/main/python/ambari_agent/Register.py

@@ -18,15 +18,11 @@ See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 '''
 '''
 
 
-import sys, os
-import json
-from Hardware import Hardware
-from ActionQueue import ActionQueue
-from ServerStatus import ServerStatus
-import hostname
+import os
 import time
 import time
-import urllib2
 import subprocess
 import subprocess
+from Hardware import Hardware
+import hostname
 from HostInfo import HostInfo
 from HostInfo import HostInfo
 
 
 
 

+ 3 - 4
ambari-agent/src/main/python/ambari_agent/RepoInstaller.py

@@ -21,13 +21,12 @@ limitations under the License.
 import logging
 import logging
 import os
 import os
 import json
 import json
+from pprint import pformat
+import ast
 from shell import shellRunner
 from shell import shellRunner
 from manifestGenerator import writeImports
 from manifestGenerator import writeImports
-from pprint import pprint, pformat
-import ast
 import AmbariConfig
 import AmbariConfig
-import urlparse, urllib
-import re
+
 
 
 PUPPET_EXT=".pp"
 PUPPET_EXT=".pp"
 
 

+ 0 - 66
ambari-agent/src/main/python/ambari_agent/Runner.py

@@ -1,66 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-import threading
-from daemon import daemonRunner
-from package import packageRunner
-from shell import shellRunner
-
-class Runner(threading.Thread):
-    """ Runs the actions coming from the server """
-    __instance = None
-    lock = None
-    def __init__(self):
-        if Runner.__instance is None:
-          Runner.lock = threading.RLock()
-          Runner.__instance = self
-    
-    def run(self, data):
-        Runner.lock.acquire()
-        try:
-            if data['actionType']=='info':
-                ph = packageRunner()
-                result = ph.info(data['packages'])
-            elif data['actionType']=='install':
-                ph = packageRunner()
-                if 'dry-run' in data:
-                    opt = data['dry-run']
-                else:
-                    opt = 'false'
-                result = ph.install(data['packages'], opt)
-            elif data['actionType']=='remove':
-                ph = packageRunner()
-                if 'dry-run' in data:
-                    opt = data['dry-run']
-                else:
-                    opt = 'false'
-                result = ph.remove(data['packages'], opt)
-            elif data['actionType']=='status':
-                dh = daemonRunner()
-                result = dh.status(data['daemonName'])
-            elif data['actionType']=='start':
-                dh = daemonRunner()
-                result = dh.start(data['daemonName'])
-            elif data['actionType']=='stop':
-                dh = daemonRunner()
-                result = dh.stop(data['daemonName'])
-            return result
-        finally:
-            Runner.lock.release()

+ 0 - 50
ambari-agent/src/main/python/ambari_agent/ServerStatus.py

@@ -1,50 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-from shell import shellRunner
-import logging
-import logging.handlers
-
-logger = logging.getLogger()
-global serverTracker
-
-class ServerStatus:
-  def build(self):
-    sh = shellRunner()
-    list = []
-    servers = sh.getServerTracker()
-    for server in servers:
-      (clusterId, clusterDefinitionRevision, component, role) = server.split("/")
-      result = {
-                 'clusterId'                 : clusterId,
-                 'clusterDefinitionRevision' : clusterDefinitionRevision,
-                 'componentName'             : component,
-                 'roleName'                  : role,
-                 'serverStatus'              : 'STARTED'
-               }
-      list.append(result)
-    return list
-
-def main(argv=None):
-  serverStatus = ServerStatus()
-  print serverStatus.build()
-
-if __name__ == '__main__':
-  main()

+ 1 - 5
ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py

@@ -20,11 +20,7 @@ limitations under the License.
 
 
 import os.path
 import os.path
 import logging
 import logging
-import subprocess
-import pprint, threading
-from Grep import Grep
-from threading import Thread
-import shell
+import threading
 import traceback
 import traceback
 import shutil
 import shutil
 
 

+ 2 - 3
ambari-agent/src/main/python/ambari_agent/StatusCheck.py

@@ -18,13 +18,12 @@ See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 '''
 '''
 
 
-from shell import shellRunner
 import logging
 import logging
-import logging.handlers
-import sys
 import os
 import os
 import re
 import re
 import string
 import string
+from shell import shellRunner
+
 
 
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 

+ 3 - 9
ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py

@@ -20,17 +20,11 @@ limitations under the License.
 import json
 import json
 import os.path
 import os.path
 import logging
 import logging
-import subprocess
-from manifestGenerator import generateManifest
-from RepoInstaller import RepoInstaller
-import pprint, threading
-from Grep import Grep
-from threading import Thread
-import shell
-import traceback
+import pprint
+import re
 from Grep import Grep
 from Grep import Grep
 from StackVersionsFileHandler import StackVersionsFileHandler
 from StackVersionsFileHandler import StackVersionsFileHandler
-import re, json
+
 
 
 logger = logging.getLogger()
 logger = logging.getLogger()
 grep = Grep()
 grep = Grep()

+ 0 - 7
ambari-agent/src/main/python/ambari_agent/__init__.py

@@ -30,10 +30,3 @@ __author__ = [
 __license__ = "Apache License v2.0"
 __license__ = "Apache License v2.0"
 __contributors__ = "see http://incubator.apache.org/ambari/contributors"
 __contributors__ = "see http://incubator.apache.org/ambari/contributors"
 
 
-import logging
-import logging.handlers
-import threading
-import sys
-import time
-import signal
-

+ 0 - 205
ambari-agent/src/main/python/ambari_agent/createDaemon.py

@@ -1,205 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-"""Disk And Execution MONitor (Daemon)
-
-Configurable daemon behaviors:
-
-   1.) The current working directory set to the "/" directory.
-   2.) The current file creation mode mask set to 0.
-   3.) Close all open files (1024). 
-   4.) Redirect standard I/O streams to "/dev/null".
-
-A failed call to fork() now raises an exception.
-
-References:
-   1) Advanced Programming in the Unix Environment: W. Richard Stevens
-   2) Unix Programming Frequently Asked Questions:
-         http://www.erlenstar.demon.co.uk/unix/faq_toc.html
-"""
-
-__author__ = "Chad J. Schroeder"
-__copyright__ = "Copyright (C) 2005 Chad J. Schroeder"
-
-__revision__ = "$Id$"
-__version__ = "0.2"
-
-# Standard Python modules.
-import os               # Miscellaneous OS interfaces.
-import sys              # System-specific parameters and functions.
-
-# Default daemon parameters.
-# File mode creation mask of the daemon.
-UMASK = 0022
-
-# Default working directory for the daemon.
-WORKDIR = "/"
-
-# Default maximum for the number of available file descriptors.
-MAXFD = 1024
-
-# The standard I/O file descriptors are redirected to /dev/null by default.
-if (hasattr(os, "devnull")):
-   REDIRECT_TO = os.devnull
-else:
-   REDIRECT_TO = "/dev/null"
-
-def createDaemon():
-   """Detach a process from the controlling terminal and run it in the
-   background as a daemon.
-   """
-
-   try:
-      # Fork a child process so the parent can exit.  This returns control to
-      # the command-line or shell.  It also guarantees that the child will not
-      # be a process group leader, since the child receives a new process ID
-      # and inherits the parent's process group ID.  This step is required
-      # to insure that the next call to os.setsid is successful.
-      pid = os.fork()
-   except OSError, e:
-      raise Exception, "%s [%d]" % (e.strerror, e.errno)
-
-   if (pid == 0):       # The first child.
-      # To become the session leader of this new session and the process group
-      # leader of the new process group, we call os.setsid().  The process is
-      # also guaranteed not to have a controlling terminal.
-      os.setsid()
-
-      # Is ignoring SIGHUP necessary?
-      #
-      # It's often suggested that the SIGHUP signal should be ignored before
-      # the second fork to avoid premature termination of the process.  The
-      # reason is that when the first child terminates, all processes, e.g.
-      # the second child, in the orphaned group will be sent a SIGHUP.
-      #
-      # "However, as part of the session management system, there are exactly
-      # two cases where SIGHUP is sent on the death of a process:
-      #
-      #   1) When the process that dies is the session leader of a session that
-      #      is attached to a terminal device, SIGHUP is sent to all processes
-      #      in the foreground process group of that terminal device.
-      #   2) When the death of a process causes a process group to become
-      #      orphaned, and one or more processes in the orphaned group are
-      #      stopped, then SIGHUP and SIGCONT are sent to all members of the
-      #      orphaned group." [2]
-      #
-      # The first case can be ignored since the child is guaranteed not to have
-      # a controlling terminal.  The second case isn't so easy to dismiss.
-      # The process group is orphaned when the first child terminates and
-      # POSIX.1 requires that every STOPPED process in an orphaned process
-      # group be sent a SIGHUP signal followed by a SIGCONT signal.  Since the
-      # second child is not STOPPED though, we can safely forego ignoring the
-      # SIGHUP signal.  In any case, there are no ill-effects if it is ignored.
-      #
-      # import signal           # Set handlers for asynchronous events.
-      # signal.signal(signal.SIGHUP, signal.SIG_IGN)
-
-      try:
-         # Fork a second child and exit immediately to prevent zombies.  This
-         # causes the second child process to be orphaned, making the init
-         # process responsible for its cleanup.  And, since the first child is
-         # a session leader without a controlling terminal, it's possible for
-         # it to acquire one by opening a terminal in the future (System V-
-         # based systems).  This second fork guarantees that the child is no
-         # longer a session leader, preventing the daemon from ever acquiring
-         # a controlling terminal.
-         pid = os.fork()        # Fork a second child.
-      except OSError, e:
-         raise Exception, "%s [%d]" % (e.strerror, e.errno)
-
-      if (pid == 0):    # The second child.
-         # Since the current working directory may be a mounted filesystem, we
-         # avoid the issue of not being able to unmount the filesystem at
-         # shutdown time by changing it to the root directory.
-         os.chdir(WORKDIR)
-         # We probably don't want the file mode creation mask inherited from
-         # the parent, so we give the child complete control over permissions.
-         os.umask(UMASK)
-      else:
-         # exit() or _exit()?  See below.
-         os._exit(0)    # Exit parent (the first child) of the second child.
-   else:
-      # exit() or _exit()?
-      # _exit is like exit(), but it doesn't call any functions registered
-      # with atexit (and on_exit) or any registered signal handlers.  It also
-      # closes any open file descriptors.  Using exit() may cause all stdio
-      # streams to be flushed twice and any temporary files may be unexpectedly
-      # removed.  It's therefore recommended that child branches of a fork()
-      # and the parent branch(es) of a daemon use _exit().
-      os._exit(0)       # Exit parent of the first child.
-
-   # Close all open file descriptors.  This prevents the child from keeping
-   # open any file descriptors inherited from the parent.  There is a variety
-   # of methods to accomplish this task.  Three are listed below.
-   #
-   # Try the system configuration variable, SC_OPEN_MAX, to obtain the maximum
-   # number of open file descriptors to close.  If it doesn't exists, use
-   # the default value (configurable).
-   #
-   # try:
-   #    maxfd = os.sysconf("SC_OPEN_MAX")
-   # except (AttributeError, ValueError):
-   #    maxfd = MAXFD
-   #
-   # OR
-   #
-   # if (os.sysconf_names.has_key("SC_OPEN_MAX")):
-   #    maxfd = os.sysconf("SC_OPEN_MAX")
-   # else:
-   #    maxfd = MAXFD
-   #
-   # OR
-   #
-   # Use the getrlimit method to retrieve the maximum file descriptor number
-   # that can be opened by this process.  If there is not limit on the
-   # resource, use the default value.
-   #
-   import resource              # Resource usage information.
-   maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
-   if (maxfd == resource.RLIM_INFINITY):
-      maxfd = MAXFD
-  
-   # Iterate through and close all file descriptors.
-   for fd in range(0, maxfd):
-      try:
-         os.close(fd)
-      except OSError:   # ERROR, fd wasn't open to begin with (ignored)
-         pass
-
-   # Redirect the standard I/O file descriptors to the specified file.  Since
-   # the daemon has no controlling terminal, most daemons redirect stdin,
-   # stdout, and stderr to /dev/null.  This is done to prevent side-effects
-   # from reads and writes to the standard I/O file descriptors.
-
-   # This call to open is guaranteed to return the lowest file descriptor,
-   # which will be 0 (stdin), since it was closed above.
-   os.open(REDIRECT_TO, os.O_RDWR)      # standard input (0)
-
-   # Duplicate standard input to standard output and standard error.
-   os.dup2(0, 1)                        # standard output (1)
-   os.dup2(0, 2)                        # standard error (2)
-
-   return(0)
-
-if __name__ == "__main__":
-
-   retCode = createDaemon()
-
-   sys.exit(retCode)

+ 0 - 37
ambari-agent/src/main/python/ambari_agent/daemon.py

@@ -1,37 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-from shell import shellRunner
-
-class daemonRunner:
-    def start(self, name):
-        sh = shellRunner()
-        script = [ '/etc/init.d/'+name, 'start' ]
-        return sh.run(script)
-
-    def stop(self, name):
-        sh = shellRunner()
-        script = [ '/etc/init.d/'+name, 'stop' ]
-        return sh.run(script)
-
-    def status(self, name):
-        sh = shellRunner()
-        script = [ '/etc/init.d/'+name, 'stop' ]
-        return sh.run(script)

+ 2 - 1
ambari-agent/src/main/python/ambari_agent/hostname.py

@@ -20,8 +20,9 @@ limitations under the License.
 
 
 import socket
 import socket
 import subprocess
 import subprocess
-import AmbariConfig
 import urllib2
 import urllib2
+import AmbariConfig
+
 
 
 def hostname():
 def hostname():
   config = AmbariConfig.config
   config = AmbariConfig.config

+ 0 - 60
ambari-agent/src/main/python/ambari_agent/machine.py

@@ -1,60 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-import sys
-import subprocess
-
-# please keep compatible with Python 2.4 or greater
-def doExec(key, command, preLF=False):
-  try:
-    osStat = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    out, err = osStat.communicate()
-    if 0 != osStat.returncode or 0 == len(out.strip()):
-      print "%s: UNAVAILABLE" % (key)
-    else:
-      if (preLF):
-        print "%s: ok\n %s" % (key, out.strip())
-      else:
-        print "%s: ok %s" % (key, out.strip())
-  except:
-    print "%s: UNAVAILABLE" % (key)
-  
-def main(argv=None):
-  doExec('hostname', ["hostname", "-f"])
-  doExec('ip', ["hostname", "-i"])
-  doExec('cpu', ["sh", "-c", "cat /proc/cpuinfo | grep 'model name' | awk -F': ' '{ print $2; }'"])
-  doExec('memory', ["sh", "-c", "cat /proc/meminfo | grep MemTotal | awk -F': ' '{ print $2/1024/1024 \" GB\"; }'"])
-  doExec('disks', ["df", "-h"], True)
-  doExec('os', ["sh", "-c", "cat /etc/issue.net | head -1"])
-  doExec('iptables', ["iptables", "-vnL"], True)
-  doExec('selinux', ["sh", "-c", "cat /etc/selinux/config | grep ^SELINUX"])
-
-  for REQ in (["yum", "rpm", "openssl", "curl", "wget", "net-snmp", "net-snmp-utils", "ntpd"]):
-   doExec(REQ, ["rpm", "-qa", REQ])
-
-  for OPT in (["ruby", "puppet", "nagios", "ganglia", "passenger", "hadoop"]):
-   doExec(OPT, ["rpm", "-qa", OPT])
-
-  doExec("yum_repos", ["sh", "-c", "yum -C repolist enabled | egrep \"(AMBARI|HDP)\""], True)
-  # for SUSE-based agents
-  doExec("zypper_repos", ["sh", "-c", "zypper repos | egrep \"(AMBARI|HDP)\""], True)
-
-if __name__ == '__main__':
-  main(sys.argv)

+ 3 - 4
ambari-agent/src/main/python/ambari_agent/main.py

@@ -20,21 +20,21 @@ limitations under the License.
 
 
 import logging
 import logging
 import logging.handlers
 import logging.handlers
-import code
 import signal
 import signal
 from optparse import OptionParser
 from optparse import OptionParser
-import sys, traceback
+import sys
+import traceback
 import os
 import os
 import time
 import time
 import ConfigParser
 import ConfigParser
 import ProcessHelper
 import ProcessHelper
-from createDaemon import createDaemon
 from Controller import Controller
 from Controller import Controller
 from shell import killstaleprocesses
 from shell import killstaleprocesses
 import AmbariConfig
 import AmbariConfig
 from security import CertificateManager
 from security import CertificateManager
 from NetUtil import NetUtil
 from NetUtil import NetUtil
 
 
+
 logger = logging.getLogger()
 logger = logging.getLogger()
 agentPid = os.getpid()
 agentPid = os.getpid()
 
 
@@ -136,7 +136,6 @@ def main():
     sys.exit(1)
     sys.exit(1)
   else:
   else:
     # Daemonize current instance of Ambari Agent
     # Daemonize current instance of Ambari Agent
-    #retCode = createDaemon()
     pid = str(os.getpid())
     pid = str(os.getpid())
     file(ProcessHelper.pidfile, 'w').write(pid)
     file(ProcessHelper.pidfile, 'w').write(pid)
 
 

+ 2 - 3
ambari-agent/src/main/python/ambari_agent/manifestGenerator.py

@@ -21,13 +21,12 @@ limitations under the License.
 import json
 import json
 import os.path
 import os.path
 import logging
 import logging
-from uuid import getnode as get_mac
-from shell import shellRunner
 from datetime import datetime
 from datetime import datetime
-import AmbariConfig
 import pprint
 import pprint
+import AmbariConfig
 import hostname
 import hostname
 
 
+
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 
 non_global_configuration_types = ["hdfs-site", "core-site", 
 non_global_configuration_types = ["hdfs-site", "core-site", 

+ 3 - 3
ambari-agent/src/main/python/ambari_agent/security.py

@@ -18,17 +18,17 @@
 
 
 import httplib
 import httplib
 import urllib2
 import urllib2
-from urllib2 import Request
 import socket
 import socket
-import hostname
 import ssl
 import ssl
 import os
 import os
 import logging
 import logging
 from subprocess import Popen, PIPE
 from subprocess import Popen, PIPE
-import AmbariConfig
 import json
 import json
 import pprint
 import pprint
 import traceback
 import traceback
+import hostname
+import AmbariConfig
+
 logger = logging.getLogger()
 logger = logging.getLogger()
 
 
 GEN_AGENT_KEY="openssl req -new -newkey rsa:1024 -nodes -keyout %(keysdir)s/%(hostname)s.key\
 GEN_AGENT_KEY="openssl req -new -newkey rsa:1024 -nodes -keyout %(keysdir)s/%(hostname)s.key\

+ 2 - 4
ambari-agent/src/main/python/ambari_agent/shell.py

@@ -19,10 +19,7 @@ limitations under the License.
 '''
 '''
 
 
 from pwd import getpwnam
 from pwd import getpwnam
-from grp import getgrnam
-import AmbariConfig
 import logging
 import logging
-import logging.handlers
 import subprocess
 import subprocess
 import os
 import os
 import tempfile
 import tempfile
@@ -31,7 +28,8 @@ import sys
 import threading
 import threading
 import time
 import time
 import traceback
 import traceback
-import shutil
+import AmbariConfig
+
 
 
 global serverTracker
 global serverTracker
 serverTracker = {}
 serverTracker = {}

+ 0 - 1
ambari-agent/src/test/python/TestActionQueue.py

@@ -21,7 +21,6 @@ limitations under the License.
 from unittest import TestCase
 from unittest import TestCase
 from ambari_agent.ActionQueue import ActionQueue
 from ambari_agent.ActionQueue import ActionQueue
 from ambari_agent.AmbariConfig import AmbariConfig
 from ambari_agent.AmbariConfig import AmbariConfig
-from ambari_agent.FileUtil import getFilePath
 from ambari_agent.UpgradeExecutor import UpgradeExecutor
 from ambari_agent.UpgradeExecutor import UpgradeExecutor
 from ambari_agent.StackVersionsFileHandler import StackVersionsFileHandler
 from ambari_agent.StackVersionsFileHandler import StackVersionsFileHandler
 import os, errno, time, pprint, tempfile, threading
 import os, errno, time, pprint, tempfile, threading

+ 1 - 7
ambari-agent/src/test/python/TestAgentActions.py

@@ -19,13 +19,7 @@ limitations under the License.
 '''
 '''
 
 
 from unittest import TestCase
 from unittest import TestCase
-import os, errno, getpass
-from ambari_agent.ActionQueue import ActionQueue
-from ambari_agent.AmbariConfig import AmbariConfig
-from ambari_agent.FileUtil import getFilePath
-from ambari_agent import shell
-from ambari_agent.shell import serverTracker
-import time
+
 
 
 class TestAgentActions(TestCase):
 class TestAgentActions(TestCase):
 #This feature is not yet implemented in ActionQueue
 #This feature is not yet implemented in ActionQueue

+ 0 - 61
ambari-agent/src/test/python/TestFileUtil.py

@@ -1,61 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-from unittest import TestCase
-from ambari_agent.FileUtil import writeFile, createStructure, deleteStructure
-import os, errno
-import tempfile
-from ambari_agent  import AmbariConfig
-
-class TestFileUtil(TestCase):
-
-  def test_createStructure(self):
-    tmpdir = tempfile.gettempdir()
-    AmbariConfig.config.set('agent', 'prefix', tmpdir)
-    action = { 'clusterId' : 'abc', 'role' : 'hdfs', 'workDirComponent' : 'abc-hdfs' }
-    result = {}
-    result = createStructure(action, result)
-#    self.assertEqual(result['exitCode'], 0, 'Create cluster structure failed.')
-
-#  def test_writeFile(self):
-    configFile = {
-      "data"       : "test",
-      "owner"      : os.getuid(),
-      "group"      : os.getgid() ,
-      "permission" : 0700,
-      "path"       : os.path.join(tmpdir, "ambari_file_test/_file_write_test"),
-      "umask"      : 022
-    }
-    action = {
-      'clusterId' : 'abc',
-      'role' : 'hdfs',
-      'workDirComponent' : 'abc-hdfs',
-      'file' : configFile
-    }
-    result = { }
-    result = writeFile(action, result)
-    self.assertEqual(result['exitCode'], 0, 'WriteFile test with uid/gid failed.')
-
-#  def test_deleteStructure(self):
-    result = { }
-    action = { 'clusterId' : 'abc', 'role' : 'hdfs', 'workDirComponent' : 'abc-hdfs' }
-    result = deleteStructure(action, result)
-    self.assertEqual(result['exitCode'], 0, 'Delete cluster structure failed.')
-

+ 0 - 29
ambari-agent/src/test/python/TestServerStatus.py

@@ -1,29 +0,0 @@
-#!/usr/bin/env python2.6
-
-'''
-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.
-'''
-
-from unittest import TestCase
-from ambari_agent.ServerStatus import ServerStatus
-
-class TestServerStatus(TestCase):
-  def test_build(self):
-    serverStatus = ServerStatus()
-    result = serverStatus.build()
-    self.assertEqual(result, [], 'List of running servers should be 0.')
-