Selaa lähdekoodia

AMBARI-6176. Integrate python shell into Ambari-shell module(subin)

Subin 11 vuotta sitten
vanhempi
commit
c8eceafc9e
68 muutettua tiedostoa jossa 2093 lisäystä ja 118 poistoa
  1. 25 1
      ambari-client/python-client/src/main/python/ambari_client/ambari_api.py
  2. 10 3
      ambari-client/python-client/src/main/python/ambari_client/core/http_client.py
  3. 53 0
      ambari-client/python-client/src/main/python/ambari_client/model/blueprint.py
  4. 5 2
      ambari-client/python-client/src/main/python/ambari_client/model/host.py
  5. 2 0
      ambari-client/python-client/src/main/python/ambari_client/model/paths.py
  6. 40 2
      ambari-client/python-client/src/main/python/ambari_client/model/status.py
  7. 26 13
      ambari-client/python-client/src/main/python/ambari_client/model/utils.py
  8. 142 0
      ambari-shell/ambari-groovy-shell/pom.xml
  9. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/AmbariShell.java
  10. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/BasicCommands.java
  11. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/BlueprintCommands.java
  12. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/ClusterCommands.java
  13. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/ElephantCommand.java
  14. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/HostCommands.java
  15. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/completion/Blueprint.java
  16. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/completion/Host.java
  17. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/configuration/ConverterConfiguration.java
  18. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/configuration/ShellConfiguration.java
  19. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/converter/BlueprintConverter.java
  20. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/converter/HostConverter.java
  21. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/customization/AmbariBanner.java
  22. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/customization/AmbariHistory.java
  23. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/customization/AmbariPrompt.java
  24. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/AbstractFlash.java
  25. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/FlashService.java
  26. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/FlashType.java
  27. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/InstallProgress.java
  28. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/AmbariContext.java
  29. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/Focus.java
  30. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/FocusType.java
  31. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/Hints.java
  32. 0 0
      ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/support/TableRenderer.java
  33. 0 0
      ambari-shell/ambari-groovy-shell/src/main/resources/elephant.txt
  34. 0 0
      ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/commands/BlueprintCommandsTest.java
  35. 0 0
      ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/commands/ClusterCommandsTest.java
  36. 0 0
      ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/commands/HostCommandsTest.java
  37. 0 0
      ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/customization/AmbariPromptTest.java
  38. 0 0
      ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/model/AmbariContextTest.java
  39. 0 0
      ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/support/TableRendererTest.java
  40. 0 0
      ambari-shell/ambari-groovy-shell/src/test/resources/2columns
  41. 0 0
      ambari-shell/ambari-groovy-shell/src/test/resources/3columns
  42. 0 0
      ambari-shell/ambari-groovy-shell/src/test/resources/testBlueprint.json
  43. 62 0
      ambari-shell/ambari-python-shell/conf/unix/ambari-shell
  44. 19 0
      ambari-shell/ambari-python-shell/conf/unix/ambari-shell.ini
  45. 237 0
      ambari-shell/ambari-python-shell/pom.xml
  46. 22 0
      ambari-shell/ambari-python-shell/src/main/package/deb/control/control
  47. 15 0
      ambari-shell/ambari-python-shell/src/main/package/deb/control/postinst
  48. 15 0
      ambari-shell/ambari-python-shell/src/main/package/deb/control/postrm
  49. 15 0
      ambari-shell/ambari-python-shell/src/main/package/deb/control/posttrm
  50. 15 0
      ambari-shell/ambari-python-shell/src/main/package/deb/control/preinst
  51. 15 0
      ambari-shell/ambari-python-shell/src/main/package/deb/control/prerm
  52. 16 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/__init__.py
  53. 412 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/ambari_shell.py
  54. 16 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/__init__.py
  55. 21 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/blueprint.py
  56. 81 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/connect_cluster.py
  57. 34 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/create_cluster.py
  58. 125 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/service.py
  59. 77 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/shell_config.py
  60. 155 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/show.py
  61. 16 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/__init__.py
  62. 128 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/displayutils.py
  63. 69 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/osutils.py
  64. 100 0
      ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/pluginutils.py
  65. 40 0
      ambari-shell/ambari-python-shell/src/main/python/setup.py
  66. 34 0
      ambari-shell/ambari-python-shell/src/packages/tarball/all.xml
  67. 20 0
      ambari-shell/assemblies/client.xml
  68. 31 97
      ambari-shell/pom.xml

+ 25 - 1
ambari-client/python-client/src/main/python/ambari_client/ambari_api.py

@@ -18,7 +18,7 @@
 import logging
 from ambari_client.core.http_client import HttpClient
 from ambari_client.core.rest_resource import RestResource
-from ambari_client.model import blueprint, stack, cluster, host
+from ambari_client.model import blueprint, stack, cluster, host, status
 
 __docformat__ = "epytext"
 
@@ -66,6 +66,13 @@ class AmbariClient(RestResource):
             if port is None:
                 port = 8080
 
+        if not http_header:
+            http_header = {'X-Requested-By': 'pythonclient'}
+        elif 'X-Requested-By' not in http_header.keys():
+            http_header.update({'X-Requested-By': 'pythonclient'})
+        else:
+            pass
+
         host_url = "%s://%s:%s/api/v%s" % (protocol, host_name, port, version)
         if client is None:
             client = HttpClient(host_url, user_name, password)
@@ -224,6 +231,15 @@ class AmbariClient(RestResource):
         """
         return cluster._task_status(self, cluster_name, requestid)
 
+    def get_requests(self, cluster_name, noOfrequest=3):
+        """
+        get components from stack
+        @param version: The HDP version.
+        @param service_name: service name
+        @return: A ConfigModel object
+        """
+        return status._get_N_requests(self, cluster_name, noOfrequest)
+
     def get_blueprint(self, blueprint_name=None):
         """
         get blueprint
@@ -232,6 +248,14 @@ class AmbariClient(RestResource):
         """
         return blueprint.get_blueprint(self, blueprint_name)
 
+    def get_cluster_blueprint(self, cluster_name):
+        """
+        get blueprint
+        @param cluster_name:cluster_name name.
+        @return: A BlueprintModel object
+        """
+        return blueprint.get_cluster_blueprint(self, cluster_name)
+
     def delete_blueprint(self, blueprint_name=None):
         """
         get blueprint

+ 10 - 3
ambari-client/python-client/src/main/python/ambari_client/core/http_client.py

@@ -103,6 +103,13 @@ class HttpClient(object):
         self.c.setopt(pycurl.WRITEFUNCTION, buf.write)
         self.c.setopt(pycurl.SSL_VERIFYPEER, 0)
 
+        # make sure options are reset from previous requests or your GET might
+        # become a DELETE
+        self.c.setopt(pycurl.CUSTOMREQUEST, None)
+        self.c.setopt(pycurl.HTTPGET, 0)
+        self.c.setopt(pycurl.NOBODY, 0)
+        self.c.setopt(pycurl.POST, 0)
+
         LOG.debug("invoke : url = " + str(url))
         # set http_method
         if http_method == "GET":
@@ -121,9 +128,9 @@ class HttpClient(object):
         if http_method in ('POST', 'PUT'):
             LOG.debug("data..........." + str(payload))
             data = json.dumps(payload)
-            #data= data.decode('unicode-escape')
-            #LOG.debug( "after unicode decode")
-            #LOG.debug( data)
+            # data= data.decode('unicode-escape')
+            # LOG.debug( "after unicode decode")
+            # LOG.debug( data)
             data = self._to_bytestring(data)
             LOG.debug("after _to_bytestring")
             LOG.debug(data)

+ 53 - 0
ambari-client/python-client/src/main/python/ambari_client/model/blueprint.py

@@ -15,6 +15,7 @@
 #  limitations under the License.
 
 import logging
+import json
 from ambari_client.model.base_model import BaseModel, ModelList
 from ambari_client.model import paths, utils, status
 
@@ -46,6 +47,33 @@ def get_blueprint(resource_root, blueprint_name):
             "Blueprints")
 
 
+def get_cluster_blueprint(resource_root, cluster_name):
+    """
+    Get all Blueprint
+    @param root_resource: The root Resource .
+    @param name: blueprint_name
+    @return: A list of BlueprintModel objects.
+    """
+    resp = resource_root.get(paths.BLUEPRINT_CLUSTER_PATH % cluster_name)
+    result = json.dumps(resp)
+    resp_dictt = json.loads(result)
+    objects = [
+        utils.ModelUtils.create_model(
+            BlueprintHostModel,
+            x,
+            resource_root,
+            "NO_KEY") for x in resp_dictt['host_groups']]
+    LOG.debug(objects)
+
+    bluep = utils.ModelUtils.create_model(
+        BlueprintModel,
+        resp,
+        resource_root,
+        "Blueprints")
+
+    return bluep, ModelList(objects)
+
+
 def delete_blueprint(resource_root, blueprint_name):
     """
     Delete a blueprint by name
@@ -93,6 +121,31 @@ class BlueprintModel(BaseModel):
         return "<<BlueprintModel>> blueprint_name = %s " % (
             self.blueprint_name)
 
+    def _get_cluster_name(self):
+        if self.clusterRef:
+            return self.clusterRef.cluster_name
+        return None
+
+
+class BlueprintHostModel(BaseModel):
+
+    """
+    The BlueprintHostModel class
+    """
+    RO_ATTR = ('blueprint_name',)
+    RW_ATTR = ('name', 'components', 'cardinality')
+    REF_ATTR = ()
+
+    def __init__(self, resource_root, name, components, cardinality):
+        utils.retain_self_helper(BaseModel, **locals())
+
+    def __str__(self):
+        return "<<BlueprintHostModel>> name = %s ,components =%s" % (
+            self.name, str(self.components))
+
+    def to_json(self):
+        pass
+
 
 class BlueprintConfigModel(BaseModel):
 

+ 5 - 2
ambari-client/python-client/src/main/python/ambari_client/model/host.py

@@ -219,8 +219,11 @@ def _bootstrap_hosts(root_resource, hosts_list, ssh_key, ssh_user):
     @param hosts_list list of host_names.
     @return: A  StatusModel object.
     """
-    payload_dic = {"verbose":True, "sshKey": ssh_key.encode(
-        'string_escape')  , "hosts":str(hosts_list) , "user": ssh_user }
+    payload_dic = {
+        "verbose": True,
+        "sshKey": ssh_key,
+        "hosts": str(hosts_list),
+        "user": ssh_user}
     resp = root_resource.post(
         paths.BOOTSTRAP_PATH,
         payload_dic,

+ 2 - 0
ambari-client/python-client/src/main/python/ambari_client/model/paths.py

@@ -40,6 +40,7 @@ HOSTS_ASSIGN_ROLE = "/clusters/%s/hosts?Hosts/host_name=%s"
 BOOTSTRAP_PATH = "/bootstrap"
 REQUEST_STATUS_PATH = "/clusters/%s/requests/%s?fields=tasks/Tasks/status"
 REQUEST_PATH = "clusters/%s/requests/%s"
+REQUEST_N_PATH = "clusters/%s/requests?to=end&page_size=%s&fields=Requests"
 
 CONFIGURATION_PATH = "/clusters/%s/configurations?type=%s&tag=%s"
 CONFIGURATION_ALL_PATH = "/clusters/%s/configurations?type=%s"
@@ -57,3 +58,4 @@ TASKS_PATH = "clusters/%s/requests/%s/tasks?fields=*"
 
 BLUEPRINT_ALL_PATH = "blueprints?fields=*"
 BLUEPRINT_PATH = "blueprints/%s"
+BLUEPRINT_CLUSTER_PATH = "clusters/%s?format=blueprint"

+ 40 - 2
ambari-client/python-client/src/main/python/ambari_client/model/status.py

@@ -15,7 +15,7 @@
 #  limitations under the License.
 
 import logging
-from ambari_client.model.base_model import BaseModel
+from ambari_client.model.base_model import BaseModel, ModelList
 from ambari_client.model import paths, utils
 
 
@@ -32,7 +32,7 @@ class StatusModel(BaseModel):
     REF_ATTR = ('cluster_name',)
 
     def __init__(self, resource_root, status, requestId=None, message=None):
-        #BaseModel.__init__(self, **locals())
+        # BaseModel.__init__(self, **locals())
         utils.retain_self_helper(BaseModel, **locals())
 
     def __str__(self):
@@ -72,3 +72,41 @@ class StatusModel(BaseModel):
             return self.status
         else:
             None
+
+
+def _get_N_requests(resource_root, cluster_name, noOfrequest):
+    """
+    Get all services in a cluster.
+    @param cluster_name :Cluster name.
+    @return: A  ModelList object.
+    """
+    path = paths.REQUEST_N_PATH % (cluster_name, noOfrequest)
+    dic = resource_root.get(path)
+    return utils.ModelUtils.get_model_list(
+        ModelList,
+        RequestModel,
+        dic,
+        resource_root,
+        "Requests")
+
+
+class RequestModel(BaseModel):
+
+    """
+    The RequestModel class
+    """
+    RO_ATTR = ("request_context",)
+    RW_ATTR = ('id', 'request_status')
+    REF_ATTR = ('cluster_name',)
+
+    def __init__(self, resource_root, id, request_status=None):
+        # BaseModel.__init__(self, **locals())
+        utils.retain_self_helper(BaseModel, **locals())
+
+    def __str__(self):
+        return "<<RequestModel>> id = %s ; request_status = %s" % (
+            self.id, self.request_status)
+
+    def is_error(self):
+        return (
+            self.status != 200 and self.status != 201 and self.status != 202)

+ 26 - 13
ambari-client/python-client/src/main/python/ambari_client/model/utils.py

@@ -162,12 +162,20 @@ class ModelUtils(object):
         rw_dict = {}
         LOG.debug("model_dict =   " + str(model_dict))
 
+        # extract model /keyword
         if isinstance(model_dict, dict) and RESOURCE_KEY_WORD in model_dict:
             model_dict = model_dict[RESOURCE_KEY_WORD]
-            LOG.debug(
-                "model_dict has %s ;subset = %s" %
-                (RESOURCE_KEY_WORD, str(
-                    model_dict.items())))
+            if not isinstance(model_dict, list):
+                LOG.debug(
+                    "model_dict has %s ;subset = %s" %
+                    (RESOURCE_KEY_WORD, str(
+                        model_dict.items())))
+            else:
+                LOG.debug(
+                    "model_dict is list and has %s ;subset = %s" %
+                    (RESOURCE_KEY_WORD, str(
+                        model_dict)))
+        # check for Requests
         if isinstance(model_dict, dict) and "Requests" in model_dict:
             model_dict = model_dict["Requests"]
             LOG.debug(
@@ -175,12 +183,17 @@ class ModelUtils(object):
                 (str(
                     model_dict.items())))
 
-        for k, v in model_dict.items():
-            LOG.debug("key = %s ; value = %s " % (str(k), str(v)))
-            if k in model_cls.RW_ATTR:
-                LOG.debug(k + " is there in RW_ATTR")
-                rw_dict[k] = v
-                del model_dict[k]
+        # check for composition i.e list of Models
+        if isinstance(model_dict, list):
+            LOG.debug(
+                "model_dict is list")
+        else:
+            for k, v in model_dict.items():
+                LOG.debug("key = %s ; value = %s " % (str(k), str(v)))
+                if k in model_cls.RW_ATTR:
+                    LOG.debug(k + " is there in RW_ATTR")
+                    rw_dict[k] = v
+                    del model_dict[k]
 
         rw_dict = get_unicode_kw(rw_dict)
         obj = model_cls(resource_root, **rw_dict)
@@ -238,7 +251,7 @@ def get_REF_object(ref_class_name):
 
 
 def get_unicode(v):
-    #import unicodedata
+    # import unicodedata
     if v:
         if isinstance(v, unicode):
             v = unicodedata.normalize('NFKD', v).encode('ascii', 'ignore')
@@ -249,8 +262,8 @@ def get_unicode(v):
 
 
 def retain_self_helper(memclass, self=None, **kwargs):
-        # print locals()
-        #from ambari_client.model.base_model import  BaseModel
+    # print locals()
+        # from ambari_client.model.base_model import  BaseModel
     memclass.__init__(self, **kwargs)
 
 

+ 142 - 0
ambari-shell/ambari-groovy-shell/pom.xml

@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<!-- Licensed 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.
+  See accompanying LICENSE file. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.ambari</groupId>
+    <artifactId>ambari-shell</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+    <relativePath>../../ambari-shell</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ambari</groupId>
+  <artifactId>ambari-groovy-shell</artifactId>
+  <packaging>jar</packaging>
+  <name>Ambari Groovy Shell</name>
+  <version>1.3.0-SNAPSHOT</version>
+  <description>Ambari Groovy Shell</description>
+   <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <start-class>org.apache.ambari.shell.AmbariShell</start-class>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.shell</groupId>
+      <artifactId>spring-shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.github.lalyos</groupId>
+      <artifactId>jfiglet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ambari</groupId>
+      <artifactId>groovy-client</artifactId>
+      <version>1.3.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>1.9.5</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jline</groupId>
+      <artifactId>jline</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.jackson</groupId>
+      <artifactId>jackson-mapper-asl</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.0</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/resources/elephant.txt</exclude>
+            <exclude>src/test/resources/2columns</exclude>
+            <exclude>src/test/resources/3columns</exclude>
+            <exclude>src/test/resources/testBlueprint.json</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>test</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <skipAssembly>true</skipAssembly>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.0.2.RELEASE</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <mainClass>${start-class}</mainClass>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <controlDir>${basedir}/../../ambari-project/src/main/package/deb/control</controlDir>
+          <skip>true</skip>
+          <submodules>false</submodules>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/AmbariShell.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/AmbariShell.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/commands/BasicCommands.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/BasicCommands.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/commands/BlueprintCommands.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/BlueprintCommands.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/commands/ClusterCommands.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/ClusterCommands.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/commands/ElephantCommand.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/ElephantCommand.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/commands/HostCommands.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/commands/HostCommands.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/completion/Blueprint.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/completion/Blueprint.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/completion/Host.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/completion/Host.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/configuration/ConverterConfiguration.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/configuration/ConverterConfiguration.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/configuration/ShellConfiguration.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/configuration/ShellConfiguration.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/converter/BlueprintConverter.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/converter/BlueprintConverter.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/converter/HostConverter.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/converter/HostConverter.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/customization/AmbariBanner.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/customization/AmbariBanner.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/customization/AmbariHistory.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/customization/AmbariHistory.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/customization/AmbariPrompt.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/customization/AmbariPrompt.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/flash/AbstractFlash.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/AbstractFlash.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/flash/FlashService.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/FlashService.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/flash/FlashType.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/FlashType.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/flash/InstallProgress.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/flash/InstallProgress.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/model/AmbariContext.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/AmbariContext.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/model/Focus.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/Focus.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/model/FocusType.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/FocusType.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/model/Hints.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/model/Hints.java


+ 0 - 0
ambari-shell/src/main/java/org/apache/ambari/shell/support/TableRenderer.java → ambari-shell/ambari-groovy-shell/src/main/java/org/apache/ambari/shell/support/TableRenderer.java


+ 0 - 0
ambari-shell/src/main/resources/elephant.txt → ambari-shell/ambari-groovy-shell/src/main/resources/elephant.txt


+ 0 - 0
ambari-shell/src/test/java/org/apache/ambari/shell/commands/BlueprintCommandsTest.java → ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/commands/BlueprintCommandsTest.java


+ 0 - 0
ambari-shell/src/test/java/org/apache/ambari/shell/commands/ClusterCommandsTest.java → ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/commands/ClusterCommandsTest.java


+ 0 - 0
ambari-shell/src/test/java/org/apache/ambari/shell/commands/HostCommandsTest.java → ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/commands/HostCommandsTest.java


+ 0 - 0
ambari-shell/src/test/java/org/apache/ambari/shell/customization/AmbariPromptTest.java → ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/customization/AmbariPromptTest.java


+ 0 - 0
ambari-shell/src/test/java/org/apache/ambari/shell/model/AmbariContextTest.java → ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/model/AmbariContextTest.java


+ 0 - 0
ambari-shell/src/test/java/org/apache/ambari/shell/support/TableRendererTest.java → ambari-shell/ambari-groovy-shell/src/test/java/org/apache/ambari/shell/support/TableRendererTest.java


+ 0 - 0
ambari-shell/src/test/resources/2columns → ambari-shell/ambari-groovy-shell/src/test/resources/2columns


+ 0 - 0
ambari-shell/src/test/resources/3columns → ambari-shell/ambari-groovy-shell/src/test/resources/3columns


+ 0 - 0
ambari-shell/src/test/resources/testBlueprint.json → ambari-shell/ambari-groovy-shell/src/test/resources/testBlueprint.json


+ 62 - 0
ambari-shell/ambari-python-shell/conf/unix/ambari-shell

@@ -0,0 +1,62 @@
+#!/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
+
+
+# Because Ambari rpm unpacks modules here on all systems
+PARAM="$@"
+export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH
+SHELL_SCRIPT=/usr/lib/python2.6/site-packages/ambari_shell/ambari_shell.py
+OK=1
+NOTOK=0
+if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.7
+fi
+
+if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.6
+fi
+
+if [ "x$PYTHON" == "x" ]; then
+  PYTHON=/usr/bin/python
+fi
+
+export PYTHON=$PYTHON
+
+
+
+# check for version
+check_python_version ()
+{
+  echo "Verifying Python version compatibility..."
+  majversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f1`
+  minversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f2`
+  numversion=$(( 10 * $majversion + $minversion))
+  if (( $numversion < 26 )); then
+    echo "ERROR: Found Python version $majversion.$minversion. Ambari Agent requires Python version > 2.6"
+    return $NOTOK
+  fi
+  echo "Using python " $PYTHON
+  return $OK
+}
+
+retcode=0
+check_python_version
+if [ "$?" -eq "$NOTOK" ]; then
+	 exit -1
+fi
+$PYTHON $SHELL_SCRIPT $PARAM
+
+exit $retcode

+ 19 - 0
ambari-shell/ambari-python-shell/conf/unix/ambari-shell.ini

@@ -0,0 +1,19 @@
+# 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
+
+[python_shell]
+loglevel=debug
+log_folder=/var/log/ambari-shell/
+cliplugin_folder=/root/workspace/python_shell/plugins
+default_plugin_folder=/usr/lib/python2.6/site-packages/ambari_shell/plugins

+ 237 - 0
ambari-shell/ambari-python-shell/pom.xml

@@ -0,0 +1,237 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <!--
+   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 Licenseam for the specific language governing permissions and
+   limitations under the License.
+-->
+  <parent>
+    <groupId>org.apache.ambari</groupId>
+    <artifactId>ambari-shell</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+    <relativePath>../../ambari-shell</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ambari</groupId>
+  <artifactId>ambari-python-shell</artifactId>
+  <packaging>pom</packaging>
+  <version>1.3.0-SNAPSHOT</version>
+  <name>Ambari Python Shell</name>
+  <description>Ambari Python Shell</description>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <final.name>${project.artifactId}-${project.version}</final.name>
+    <package.release>1</package.release>
+    <package.prefix>/usr</package.prefix>
+    <package.log.dir>/var/log/ambari-shell</package.log.dir>
+    <package.pid.dir>/var/run/ambari-shell</package.pid.dir>
+    <skipTests>false</skipTests>
+    <install.dir>/usr/lib/python2.6/site-packages/ambari_shell</install.dir>
+    <lib.dir>/usr/lib/ambari-shell/lib</lib.dir>
+    <python.ver>python &gt;= 2.6</python.ver>
+    <deb.python.ver>python (&gt;= 2.6)</deb.python.ver>
+    <deb.architecture>amd64</deb.architecture>
+    <deb.dependency.list>openssl, zlibc, ${deb.python.ver}</deb.dependency.list>
+  </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.0</version>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <tarLongFileMode>gnu</tarLongFileMode>
+          <descriptors>
+            <descriptor>src/packages/tarball/all.xml</descriptor>
+          </descriptors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>build-tarball</id>
+            <phase>prepare-package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <configuration>
+              <executable>${project.basedir}/../../ambari-common/src/main/unix/ambari-python-wrap</executable>
+              <workingDirectory>src/test/python</workingDirectory>
+              <arguments>
+                <argument>unitTests.py</argument>
+              </arguments>
+              <environmentVariables>
+                <PYTHONPATH>${project.basedir}/../../ambari-common/src/test/python:${project.basedir}/../../ambari-client/python-client/src/test/python:${project.basedir}/../../ambari-client/python-client/src/main/python/ambari_client:${project.basedir}/src/main/python/ambari_shell:${project.basedir}/src/test/python/utils:$PYTHONPATH</PYTHONPATH>
+              </environmentVariables>
+              <skip>${skipTests}</skip>
+            </configuration>
+            <id>python-test</id>
+            <phase>test</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+          </execution>
+          <execution>
+            <configuration>
+              <executable>${project.basedir}/../../ambari-common/src/main/unix/ambari-python-wrap</executable>
+              <workingDirectory>target/ambari-python-shell-${project.version}</workingDirectory>
+              <arguments>
+                <argument>${project.basedir}/src/main/python/setup.py</argument>
+                <argument>clean</argument>
+                <argument>bdist_dumb</argument>
+              </arguments>
+              <environmentVariables>
+                <PYTHONPATH>target/python-client-${project.version}:$PYTHONPATH</PYTHONPATH>
+              </environmentVariables>
+            </configuration>
+            <id>python-package</id>
+            <phase>package</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rpm-maven-plugin</artifactId>
+        <version>2.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>rpm</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <copyright>2012, Apache Software Foundation</copyright>
+          <group>Development</group>
+          <description>Maven Recipe: RPM Package.</description>
+          <requires>
+            <require>openssl</require>
+            <require>zlib</require>
+            <require>${python.ver}</require>
+          </requires>
+          <needarch>x86_64</needarch>
+          <autoRequires>false</autoRequires>
+          <mappings>
+             <mapping>
+              <directory>/etc/ambari-shell/conf</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <sources>
+                <source>
+                  <location>conf/unix/ambari-shell.ini</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>/usr/sbin</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <source>
+                  <location>conf/unix/ambari-shell</location>
+                  <filter>true</filter>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${package.log.dir}</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+            </mapping>
+            <mapping>
+              <directory>${install.dir}</directory>
+              <sources>
+                <source>
+                  <location>${project.build.directory}/${project.artifactId}-${project.version}/ambari_shell</location>
+                </source>
+              </sources>
+            </mapping>
+          </mappings>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/examples/*</exclude>
+            <exclude>src/test/python/dummy*.txt</exclude>
+            <exclude>src/main/python/ambari_client/imports.txt</exclude>
+            <exclude>src/main/puppet/modules/stdlib/**</exclude>
+            <exclude>**/*.erb</exclude>
+            <exclude>**/*.json</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>test</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.vafer</groupId>
+        <artifactId>jdeb</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>jdeb</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <controlDir>${basedir}/src/main/package/deb/control</controlDir>
+          <deb>${basedir}/target/${artifactId}_${package-version}-${package-release}.deb</deb>
+          <dataSet>
+            <data>
+              <src>${project.build.directory}/${project.artifactId}-${project.version}/ambari_shell</src>
+              <type>directory</type>
+              <mapper>
+                <type>perm</type>
+                <prefix>${install.dir}</prefix>
+              </mapper>
+            </data>
+          </dataSet>
+        </configuration>
+      </plugin>
+    </plugins>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.wagon</groupId>
+        <artifactId>wagon-ssh-external</artifactId>
+      </extension>
+    </extensions>
+  </build>
+</project>

+ 22 - 0
ambari-shell/ambari-python-shell/src/main/package/deb/control/control

@@ -0,0 +1,22 @@
+# 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
+Package: [[artifactId]]
+Version: [[package-version]]-[[package-release]]
+Section: [[deb.section]]
+Priority: [[deb.priority]]
+Depends: [[deb.dependency.list]]
+Architecture: [[deb.architecture]]
+Description: [[description]]
+Maintainer: [[deb.publisher]]

+ 15 - 0
ambari-shell/ambari-python-shell/src/main/package/deb/control/postinst

@@ -0,0 +1,15 @@
+#!/bin/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

+ 15 - 0
ambari-shell/ambari-python-shell/src/main/package/deb/control/postrm

@@ -0,0 +1,15 @@
+#!/bin/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

+ 15 - 0
ambari-shell/ambari-python-shell/src/main/package/deb/control/posttrm

@@ -0,0 +1,15 @@
+#!/bin/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

+ 15 - 0
ambari-shell/ambari-python-shell/src/main/package/deb/control/preinst

@@ -0,0 +1,15 @@
+#!/bin/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

+ 15 - 0
ambari-shell/ambari-python-shell/src/main/package/deb/control/prerm

@@ -0,0 +1,15 @@
+#!/bin/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

+ 16 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/__init__.py

@@ -0,0 +1,16 @@
+#
+#  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.

+ 412 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/ambari_shell.py

@@ -0,0 +1,412 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+import logging
+import logging.handlers
+import sys
+import signal
+import json
+import time
+import pdb
+import os
+import stat
+import cmd
+import string
+import bz2
+import datetime
+# import traceback
+import getpass
+import argparse
+import readline
+import ConfigParser
+import StringIO
+import subprocess
+import textwrap
+
+import utils.displayutils
+import utils.osutils
+import utils.pluginutils
+from ambari_client.ambari_api import AmbariClient
+
+
+configFile = "/etc/ambari-shell/conf/ambari-shell.ini"
+
+
+formatstr = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d - %(message)s"
+LOG_MAX_BYTES = 10000000
+LOG_BACKUP = 2
+
+SHELL_CONFIG = {
+    'clustername': None,
+    'hostname': 'localhost',
+    'port': 8080,
+    'username': 'admin',
+    'password': 'admin',
+    'display_type': 'table',
+    'client': None,
+    'configFile': configFile}
+
+########################################################################
+#
+# Utility methods
+#
+########################################################################
+
+
+def exit_gracefully(signum, frame):
+    # restore the original signal handler as otherwise evil things will happen
+    # in raw_input when CTRL+C is pressed, and our signal handler is not
+    # re-entrant
+    signal.signal(signal.SIGINT, original_sigint)
+    print "\nExiting"
+    sys.exit(1)
+
+    # restore the exit gracefully handler here
+    signal.signal(signal.SIGINT, exit_gracefully)
+
+
+def exit_gracefully1(signum, frame):
+    # restore the original signal handler as otherwise evil things will happen
+    # in raw_input when CTRL+C is pressed, and our signal handler is not
+    # re-entrant
+    signal.signal(signal.SIGQUIT, original_sigint)
+    print "\nExiting"
+    sys.exit(1)
+
+    # restore the exit gracefully handler here
+    signal.signal(signal.SIGQUIT, exit_gracefully)
+
+
+def resolve_config():
+    try:
+        config = ConfigParser.RawConfigParser()
+        if os.path.exists(configFile):
+            print "looking  from " + configFile
+            config.read(configFile)
+        else:
+            raise Exception("No config found")
+    except Exception as err:
+        logging.warn(err)
+    print "found " + configFile
+    return config
+
+
+def get_log_level(loglevel):
+    loglev = loglevel.upper()
+    if loglev == "DEBUG":
+        return logging.DEBUG
+    elif loglev == "INFO":
+        return logging.INFO
+    elif loglev == "WARNING":
+        return logging.WARNING
+    elif loglev == "CRITICAL":
+        return logging.CRITICAL
+    elif loglev == "ERROR":
+        return logging.ERROR
+    elif loglev == "FATAL":
+        return logging.FATAL
+    else:
+        return logging.NOTSET
+
+
+def setup_logging(loglevel, logPath="./"):
+    try:
+        logging.root
+        curTimestamp = str(datetime.datetime.now())
+        ct = curTimestamp.split('.')[0]
+        curTime = ct.replace(':', '-')
+        datee = curTime.split(' ')[0]
+        timee = curTime.split(' ')[1]
+        # Set Log directory and log file name. Each run generates a new log
+        # file
+
+        logFile = logPath + 'ambaricli_' + datee + "_" + timee + '.log'
+        fh = open(logFile, 'w')
+        fh.write('*****************************************************\n')
+        fh.write('                Amabri Python CLI Log\n')
+        t = '                Timestamp: ' + ct + '\n'
+        fh.write(t)
+        fh.write('*****************************************************\n\n\n')
+        fh.close()
+        # Set the config for logging
+        logging.basicConfig(
+            filename=logFile,
+            format='%(asctime)s : %(levelname)s: %(message)s',
+            level=get_log_level(loglevel))
+    except IOError as e:
+        errStr = "  I/O error({0}): {1}".format(e.errno, e.strerror)
+        print errStr
+        sys.exit(1)
+    except Exception as exception:
+        print exception
+        sys.exit(1)
+
+
+def getLogLevel(configg):
+    loglevel = "debug"
+    try:
+        loglevel = configg.get('python_shell', 'loglevel')
+    except Exception:
+        logging.error("No loglevel found ")
+        return loglevel
+    return loglevel
+
+
+def getLogPath(configg):
+    logPath = "./"
+    try:
+        logPath = configg.get('python_shell', 'log_folder')
+    except Exception:
+        logging.error("No log_folder found")
+        return logPath
+    return logPath
+
+
+def getPluginPath(configg):
+    cliplugin_path = "./"
+    try:
+        cliplugin_path = configg.get('python_shell', 'cliplugin_folder')
+    except Exception:
+        logging.error("No cliplugin_folder found")
+        return cliplugin_path
+    return cliplugin_path
+
+
+def getDefaultPluginPath(configg):
+    cliplugin_path = "./"
+    try:
+        cliplugin_path = configg.get('python_shell', 'default_plugin_folder')
+    except Exception:
+        logging.error("No default_plugin_folder found")
+        return cliplugin_path
+    return cliplugin_path
+
+
+def getCommandsDict(ppath, cliplugin_path):
+    default_dictt = utils.pluginutils.getPlugins(ppath)
+    logging.debug("pluginutils returned default plugins >> %s ", default_dictt)
+    dictt = utils.pluginutils.getPlugins(cliplugin_path)
+    logging.debug("pluginutils returned >> %s ", dictt)
+    if(not set(default_dictt).isdisjoint(set(dictt))):
+        common_commands = set(default_dictt).intersection(set(dictt))
+        common_commands = " & ".join(str(x) for x in common_commands)
+        logging.error(
+            "ERROR :plugins folder has duplicate commands already present in default commands")
+        logging.error(common_commands)
+        print "ERROR :plugins folder has duplicate command already present in default commands"
+        print "pls remove following commands from plugin folder >" + str(common_commands)
+        sys.exit(1)
+    default_dictt.update(dictt)
+    return default_dictt
+
+
+class CmdBase(cmd.Cmd):
+
+    """CLI .
+    """
+
+    intro = utils.displayutils.shellBanner()
+    prompt = 'ambari>'
+    http_proxy = ''
+    https_proxy = ''
+    # headers
+    doc_header = "Commands"
+    undoc_header = "Other Commands"
+
+    def __init__(self):
+        cmd.Cmd.__init__(self)
+
+    def do_EOF(self, line):
+        logging.info("====== do_EOF ======")
+        return True
+
+    def do_exit(self, line):
+        logging.info("====== do_exit ======")
+        return True
+
+    def postloop(self):
+        logging.info("====== exit ======")
+
+#    def parseline(self, line):
+#        print 'parseline(%s) =>' % line,
+#        ret = cmd.Cmd.parseline(self, line)
+#        print ret
+#        return ret
+
+    def emptyline(self):
+        # print 'emptyline()'
+        # return cmd.Cmd.emptyline(self)
+        return
+
+    def default(self, line):
+        """Called on an input line when the command prefix is not recognized.
+
+        If this method is not overridden, it prints an error message and
+        returns.
+
+        """
+        self.stdout.write(
+            '*** Unknown command *** : %s \n type "help" to list all commands \n' %
+            line)
+
+
+class AmbariShell(CmdBase):
+
+    COMPONENTS = {}
+    SERVICES = None
+    CLUSTERS = None
+
+    def __init__(self):
+        CmdBase.__init__(self)
+        self.config = None
+        self.global_shell_config = SHELL_CONFIG
+
+    def preloop(self):
+        "Checks if the cluster was pre-defined"
+        self._set_prompt()
+
+    def _set_prompt(self):
+        if self.global_shell_config['clustername']:
+            self.prompt = "ambari-" + \
+                str(self.global_shell_config['clustername']) + ">"
+            logging.debug("found a cluster >" +
+                          str(self.global_shell_config['clustername']))
+        else:
+            self.prompt = 'ambari>'
+
+    def postcmd(self, stop, line):
+        # print 'postcmd(%s, %s)' % (stop, line)
+        self._set_prompt()
+        return cmd.Cmd.postcmd(self, stop, line)
+
+    def setConfig(self, customConfig):
+        self.config = customConfig
+
+    # core code should begin here
+
+    def generate_output(self, headers, rows):
+        if self.global_shell_config['display_type'] == "table":
+            print utils.displayutils.display_table(headers, rows)
+
+        if self.global_shell_config['display_type'] == "csv":
+            utils.displayutils.createCSV(headers, rows)
+
+        if self.global_shell_config['display_type'] == "xml":
+            print utils.displayutils.createXML(headers, rows)
+
+#
+# The "main" function
+
+
+def main():
+    parser = argparse.ArgumentParser(description='Ambari CLI')
+    parser.add_argument('-H', '--host', action='store', dest='host')
+    parser.add_argument(
+        '-p',
+        '--port',
+        action='store',
+        dest='port',
+        type=int,
+        default=8080)
+    parser.add_argument(
+        '-u',
+        '--user',
+        action='store',
+        dest='user',
+        default='admin')
+    parser.add_argument(
+        '-c',
+        '--clustername',
+        action='store',
+        dest='clustername')
+    parser.add_argument(
+        '--password',
+        action='store',
+        dest='password',
+        default='admin')
+    parser.add_argument(
+        '-d',
+        '--display_type',
+        action='store',
+        dest='display_type',
+        default='table')
+    parser.add_argument('-r', '--run', action='store', dest='run')
+    args = parser.parse_args()
+
+    # Check if a username was suplied, if not, prompt the user
+    if not args.host:
+        args.host = raw_input("Enter Ambari Server host: ")
+
+    if args.host:
+        SHELL_CONFIG['hostname'] = args.host
+    if args.clustername:
+        SHELL_CONFIG['clustername'] = args.clustername
+    if args.display_type:
+        SHELL_CONFIG['display_type'] = args.display_type
+
+    headers_dict = {'X-Requested-By': 'mycompany'}
+    client = AmbariClient(
+        SHELL_CONFIG['hostname'],
+        SHELL_CONFIG['port'],
+        SHELL_CONFIG['username'],
+        SHELL_CONFIG['password'],
+        version=1,
+        http_header=headers_dict)
+    SHELL_CONFIG['client'] = client
+
+    # do some plumbing
+    config = resolve_config()
+    logPath = getLogPath(config)
+    loglevel = getLogLevel(config)
+    cliplugin_path = getPluginPath(config)
+    dpath = getDefaultPluginPath(config)
+    setup_logging(loglevel, logPath)
+    # get ready to create a shell
+    utils.osutils.doclearScreen()
+    shell = AmbariShell()
+    logging.info("cliplugin_folder =  %s", getPluginPath(config))
+    logging.info("SHELL_CONFIG =  %s", str(SHELL_CONFIG))
+    # Get all commands
+
+    commands_dictt = getCommandsDict(dpath, cliplugin_path)
+    for k, v in commands_dictt.items():
+        setattr(AmbariShell, str(k), v)
+    shell.setConfig(config)
+
+    # Check if user is attempting non-interactive shell
+    if args.run:
+        print args.run
+        for command in args.run.split(';'):
+            shell.onecmd(command)
+            sys.exit(0)
+    else:
+        try:
+            shell.cmdloop()
+        except KeyboardInterrupt:
+            sys.stdout.write("\n")
+            sys.exit(0)
+    logging.info("finished")
+
+
+if __name__ == '__main__':
+    original_sigint = signal.getsignal(signal.SIGINT)
+    signal.signal(signal.SIGINT, exit_gracefully)
+    signal.signal(signal.SIGQUIT, exit_gracefully1)
+    signal.signal(signal.SIGTERM, exit_gracefully1)
+    main()

+ 16 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/__init__.py

@@ -0,0 +1,16 @@
+#
+#  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.

+ 21 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/blueprint.py

@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+import logging
+import textwrap
+
+LOG = logging.getLogger(__name__)

+ 81 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/connect_cluster.py

@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+import logging
+import textwrap
+
+LOG = logging.getLogger(__name__)
+
+
+def do_connect_cluster(self, cluster):
+
+    if not cluster:
+        self.help_connect_cluster()
+        return None
+
+    if not self.CLUSTERS:
+        clusters = [str(c.cluster_name).encode('ascii', 'ignore')
+                    for c in self.global_shell_config['client'].get_all_clusters()]
+        self.CLUSTERS = clusters
+
+    if cluster not in self.CLUSTERS:
+        print "ERROR ! cluster %s not found " % str(cluster)
+        print "        valid clusters are " + str(self.CLUSTERS)
+        return None
+    if self.global_shell_config['clustername']:
+        LOG.debug("old cluster = " + self.global_shell_config['clustername'])
+        self.global_shell_config['clustername'] = str(cluster)
+    else:
+        self.global_shell_config['clustername'] = cluster
+    self.prompt = "ambari-" + \
+        str(self.global_shell_config['clustername']) + ">"
+
+
+def help_connect_cluster(self):
+    print '\n'.join([' Usage:', '     connect_cluster <cluster_name>'])
+
+
+def do_disconnect_cluster(self, line):
+
+    if self.global_shell_config['clustername']:
+        LOG.debug("old cluster = " + self.global_shell_config['clustername'])
+    self.global_shell_config['clustername'] = None
+    self.prompt = "ambari>"
+
+
+def help_disconnect_cluster(self):
+    print '\n'.join([' Usage:', '     disconnect_cluster'])
+
+
+def complete_connect_cluster(self, pattern, line, start_index, end_index):
+    if not self.CLUSTERS:
+        clusters = [
+            (c.cluster_name).encode(
+                'ascii',
+                'ignore') for c in self.global_shell_config['client'].get_all_clusters()]
+        self.CLUSTERS = clusters
+
+    LOG.debug(
+        ("self.CLUSTERS = %s pattern = %s ") %
+        (str(
+            self.CLUSTERS),
+            pattern))
+    if pattern:
+        return [
+            c for c in self.CLUSTERS if c.startswith(pattern)]
+    else:
+        return self.CLUSTERS

+ 34 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/create_cluster.py

@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the  License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+import logging
+import textwrap
+
+
+LOG = logging.getLogger(__name__)
+
+
+def do_create_cluster(self, line):
+    #  logging = self.LOG
+    print "TODO"
+    self.prompt = "ambari>"
+
+
+def help_create_cluster(self):
+    print '\n'.join([' Usage:', '     create_cluster <cluster_name>'])

+ 125 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/service.py

@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+import logging
+import textwrap
+
+
+LOG = logging.getLogger(__name__)
+
+
+def do_start_service(self, service):
+    if not service:
+        self.help_stop_service()
+        return None
+    clustername = self.global_shell_config['clustername']
+    if not clustername:
+        print("Error! No cluster currently selected")
+        return None
+
+    if self.t_service_action(service=service, action="start"):
+        print("%s is being started" % (service))
+    else:
+        print("Error! cannot start service")
+    return
+
+
+def do_stop_service(self, service):
+    if not service:
+        self.help_start_service()
+        return None
+
+    clustername = self.global_shell_config['clustername']
+    if not clustername:
+        print("Error! No cluster currently selected")
+        return None
+
+    if self.t_service_action(service=service, action="stop"):
+        print("%s is being stopped" % (service))
+    else:
+        print("Error! cannot stop service")
+        return
+
+
+def help_stop_service(self):
+    print textwrap.dedent("""
+    Usage:
+        > stop_service <service_name>
+    """)
+
+
+def help_start_service(self):
+    print textwrap.dedent("""
+    Usage:
+        > start_service <service_name>
+    """)
+
+
+def complete_start_service(self, pattern, line, start_index, end_index):
+    return self.services_complete(pattern, line, start_index, end_index)
+
+
+def complete_stop_service(self, pattern, line, start_index, end_index):
+    client = self.global_shell_config['client']
+    clustername = self.global_shell_config['clustername']
+    if not clustername:
+        return None
+    else:
+        if not self.SERVICES:
+            services = [
+                s.service_name for s in client.get_cluster(clustername).get_all_services()]
+            self.SERVICES = services
+
+    if pattern:
+        return [s for s in self.SERVICES if s.startswith(pattern)]
+    else:
+        return self.SERVICES
+
+
+def services_complete(self, pattern, line, start_index, end_index, append=[]):
+    client = self.global_shell_config['client']
+    clustername = self.global_shell_config['clustername']
+    if not clustername:
+        return None
+    else:
+        if not self.SERVICES:
+            services = [
+                s.service_name for s in client.get_cluster(clustername).get_all_services()]
+            self.SERVICES = services
+
+    if pattern:
+        return [s for s in self.SERVICES + append if s.startswith(pattern)]
+    else:
+        return self.SERVICES + append
+
+
+def t_service_action(self, service, action):
+    try:
+        client = self.global_shell_config['client']
+        cluster = self.global_shell_config['clustername']
+        service = client.get_cluster(cluster).get_service(service)
+    except Exception:
+        print("Service not found")
+        return None
+
+    if action == "start":
+        service.start(message='started by Ambari python CLI')
+    if action == "stop":
+        service.stop(message='stopped by Ambari python CLI')
+    return True

+ 77 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/shell_config.py

@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+import logging
+import textwrap
+
+LOG = logging.getLogger(__name__)
+
+
+def do_get_shell_config(self, config_name):
+    rows = []
+    headers = ["KEY", "VAlUE"]
+    if not config_name:
+        for i in self.global_shell_config.items():
+            rows.append([i[0], i[1]])
+    else:
+        if config_name in self.global_shell_config.keys():
+            rows.append([config_name, self.global_shell_config[config_name]])
+
+    self.generate_output(headers, rows)
+
+
+def do_set_shell_config(self, config=None):
+    kv = config.split(" ")
+    if len(kv) != 2:
+        self.help_set_shell_config()
+        return
+    config_name = kv[0]
+    config_value = kv[1]
+    if config_name in self.global_shell_config.keys():
+        self.global_shell_config[config_name] = config_value
+
+    self.do_get_shell_config(config_name=None)
+
+
+def help_get_shell_config(self):
+    print textwrap.dedent("""
+    Usage:
+        > get_shell_config <config_name>     get all shell config
+    """)
+
+
+def help_set_shell_config(self):
+    print textwrap.dedent("""
+    Usage:
+        > set_shell_config <config_name> <config_value>     sets shell config
+    """)
+
+
+def complete_get_shell_config(self, pattern, line, start_index, end_index):
+    if pattern:
+        return [
+            c for c in self.global_shell_config.keys() if c.startswith(pattern)]
+    else:
+        return self.CLUSTERS
+
+
+def complete_set_shell_config(self, pattern, line, start_index, end_index):
+    if pattern:
+        return [
+            c for c in self.global_shell_config.keys() if c.startswith(pattern)]
+    else:
+        return self.CLUSTERS

+ 155 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/plugins/show.py

@@ -0,0 +1,155 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+import logging
+import textwrap
+
+LOG = logging.getLogger(__name__)
+
+
+def help_show(self):
+    print textwrap.dedent("""
+    Usage:
+        > show clusters     list clusters
+        > show hosts        list hosts
+        > show stacks       list stacks
+        > show services     list services
+        > show requests     list previous requests
+        > show blueprints   list blueprints
+    """)
+
+
+def do_show(self, option):
+    """
+    Usage:
+        > show clusters     list clusters
+        > show hosts        list hosts
+        > show stacks       list stacks
+        > show services     list services
+        > show requests     list previous requests
+        > show blueprints   list blueprints
+    """
+    headers = []
+    rows = []
+    options = [
+        "clusters",
+        "stacks",
+        "status",
+        "services",
+        "hosts",
+        "requests",
+        "blueprints"]
+
+    if not option:
+        self.help_show()
+        return
+
+    if option not in options:
+        self.default(option)
+        return
+
+    client = self.global_shell_config['client']
+    clustername = self.global_shell_config['clustername']
+    # show clusters
+    if option == "clusters":
+        "Display list of clusters on system"
+        headers = ["CLUSTER NAME"]
+        clusters = client.get_all_clusters()
+        for cluster in clusters:
+            rows.append([cluster.cluster_name])
+
+    # show clusters
+    if option == "stacks":
+        "Display list of stacks on system"
+        headers = ["STACK NAME"]
+        stacks = client.get_stacks(True)
+        for stack in stacks:
+            rows.append([stack.stack_version])
+
+    if option == "blueprints":
+        "Display list of blueprints on system"
+        headers = ["BLUEPRINT NAME", "VERSION"]
+        blues = client.get_blueprint()
+        for b in blues:
+            rows.append([b.blueprint_name, b.stack_version])
+
+    if option == "status":
+        "Display list of stacks on system"
+        headers = ["HOST_NAME", "ROLE", "STATUS"]
+        if not clustername:
+            print("Error! No cluster currently selected")
+            return
+        else:
+            tasks = client.get_task_status(clustername, 2)
+            for task in tasks:
+                rows.append([task.host_name, task.role, task.status])
+
+    # show hosts
+    if option == "hosts":
+        "Display a list of hosts avaiable on the system"
+        headers = ["HOSTNAME", "IP ADDRESS"]
+        if not clustername:
+            for host in client.get_all_hosts():
+                rows.append([host.host_name, host.ip])
+        else:
+            c = client.get_cluster(clustername)
+            for host in c.get_all_hosts():
+                rows.append([host.host_name, host.ip])
+
+    if option == "requests":
+        headers = ["REQUEST-ID", "STATUS"]
+        if not clustername:
+            print("Error! No cluster currently selected")
+            return
+        else:
+            c = client.get_cluster(clustername)
+            for req in client.get_requests(clustername):
+                rows.append([req.id, req.request_status])
+
+    # show services
+    if option == "services":
+        "Show list of services on the cluster"
+        headers = ["SERVICE", "STATUS"]
+
+        if not clustername:
+            print("Error! No cluster currently selected")
+            return
+        else:
+            c = client.get_cluster(clustername)
+            for service in c.get_all_services():
+                rows.append([service.service_name, service.state])
+
+    self.generate_output(headers, rows)
+
+
+def complete_show(self, pattern, line, start_index, end_index):
+    show_commands = [
+        "clusters",
+        "hosts",
+        "services",
+        "stacks",
+        "blueprints",
+        "requests"]
+    if pattern:
+        return [c for c in show_commands if c.startswith(pattern)]
+    else:
+        return show_commands
+
+if __name__ == '__main__':
+    do_show(None, None)

+ 16 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/__init__.py

@@ -0,0 +1,16 @@
+#
+#  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.

+ 128 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/displayutils.py

@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import logging
+import textwrap
+import cStringIO
+import operator
+from xml.etree import ElementTree as etree
+from functools import reduce
+
+
+LOG = logging.getLogger(__name__)
+
+
+class bcolors:
+    HEADER = '\033[95m'
+    OKBLUE = '\033[94m'
+    OKGREEN = '\033[92m'
+    WARNING = '\033[93m'
+    FAIL = '\033[91m'
+    ENDC = '\033[0m'
+
+    def disable(self):
+        self.HEADER = ''
+        self.OKBLUE = ''
+        self.OKGREEN = ''
+        self.WARNING = ''
+        self.FAIL = ''
+
+
+__header__ = textwrap.dedent("""
+   ___         __            _
+  / _ | __ _  / /  ___ _____(_)
+ / __ |/  ' \/ _ \/ _ `/ __/ /
+/_/ |_/_/_/_/_.__/\_,_/_/ /_/  CLI v%s
+""" % str(1))
+
+
+def shellBanner():
+    """
+     Prints the CLI Banner.
+    """
+    return __header__ + textwrap.dedent(
+        """
+    ====================================
+        Welcome to Ambari python CLI
+        type 'help' to list all commands..
+    ====================================
+    """)
+
+
+def createXML(headers, rows):
+    root = etree.Element('xmloutput')
+    for r in rows:
+        for h, relemt in zip(headers, r):
+
+            child = etree.Element(h.lower().replace(' ', '_'))
+            child.text = str(relemt)
+            root.append(child)
+
+    # pretty string
+    s = etree.tostring(root)
+    return s
+
+
+def createCSV(headers, rows):
+    headers = [x.lower().replace(' ', '_') for x in headers]
+    print(','.join(headers))
+    for r in rows:
+        print(','.join(r))
+
+
+def display_table(headers, rows):
+
+    delimiter = '='
+    delimiter1 = ' | '
+    output = cStringIO.StringIO()
+    temp_rows = [tuple(headers)] + rows
+    row_tuple = [(row,) for row in temp_rows]
+    # get max width
+    verticalrows = map(None, *reduce(operator.add, row_tuple))
+
+    if not rows:
+        widthList = [len(str(x)) for x in headers]
+        row_width = sum(widthList)
+    else:
+        widthList = [max([len(str(x)) for x in column])
+                     for column in verticalrows]
+        row_width = sum(widthList)
+    header_line = delimiter * \
+        (row_width + len(delimiter1) * (len(widthList) - 1))
+
+    i = 0
+    for rr in row_tuple:
+        for row in rr:
+            print >> output, delimiter1.join(
+                [(str(x)).ljust(width) for (x, width) in zip(row, widthList)])
+        if i == 0:
+            print >> output, header_line
+            i = 9999
+    return output.getvalue()
+
+
+if __name__ == '__main__':
+    print createXML(['STACK NAME', ], [[u'HDP']])
+    createCSV(['STACK NAME', ], [[u'HDP']])
+    headers = ['First Name', 'Last Name', 'Age']
+    data = \
+        '''Sam ,Browne,21
+       Jhon,Browne,23
+       Adam,senio,21'''
+    rows = [row.strip().split(',') for row in data.splitlines()]
+    print display_table(headers, rows)

+ 69 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/osutils.py

@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import logging
+import os
+import sys
+import platform
+
+LOG = logging.getLogger(__name__)
+
+
+def clearScreen(operatingSys):
+    """
+    Function to clear the screen
+    Input   : OS
+    """
+    logging.info('Entering..')
+
+    if operatingSys == 'Windows':
+        cmdClear = 'CLS'
+    elif operatingSys == 'Linux':
+        cmdClear = 'clear'
+    elif operatingSys == 'Darwin':
+        cmdClear = 'clear'
+    logging.debug('Running command : %s', cmdClear)
+    os.system(cmdClear)
+    logging.info('Exiting..')
+
+
+def getOperatingSystem():
+    logging.info('Entering..')
+    operatingSys = platform.system()
+    # sprint operatingSys
+    if not operatingSys:
+        logging.error('Operating system is NULL.')
+        return False, ''
+    else:
+        logging.debug('Got operating system : %s', operatingSys)
+        logging.info('Exiting..')
+        return True, operatingSys
+
+
+def doclearScreen():
+    # Determine the OS
+    result, operatingSys = getOperatingSystem()
+    if not result:
+        logging.error('Failed to determine Operating System. Exiting.')
+        sys.exit(1)
+    # clear the Screen
+    clearScreen(operatingSys)
+
+
+if __name__ == '__main__':
+    pass

+ 100 - 0
ambari-shell/ambari-python-shell/src/main/python/ambari_shell/utils/pluginutils.py

@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import logging
+import os
+import sys
+import inspect
+
+LOG = logging.getLogger(__name__)
+#------------------------------------------------------------------------------
+'''
+Function that searches for all plugins from a file
+Input   : folder
+Output  : dict
+'''
+#------------------------------------------------------------------------------
+
+
+def get_plugins(module):
+    logging.debug('[Module: %s]\n' % module.__name__)
+
+    plugin_method_map = {}
+    count = 0
+
+    for name in dir(module):
+        obj = getattr(module, name)
+        if inspect.isclass(obj):
+            count += 1
+        elif (inspect.ismethod(obj) or inspect.isfunction(obj)):
+            if obj.__name__.startswith("do_") or obj.__name__.startswith(
+                    "help_") or obj.__name__.startswith("complete_") or obj.__name__.startswith("t_"):
+                logging.debug("%s ,%s ", obj.__name__, obj)
+                plugin_method_map.update({obj.__name__: obj})
+                count += 1
+            elif inspect.isbuiltin(obj):
+                count += 1
+    logging.debug(plugin_method_map)
+    if count == 0:
+        logging.debug('(No members)')
+
+    return plugin_method_map
+
+
+def import_modules(dirr):
+    module_list = []
+    for f in os.listdir(os.path.abspath(dirr)):
+        module_name, ext = os.path.splitext(f)
+        if ext == '.py' and module_name != "ambari_shell":
+            logging.debug('imported module: %s' % (module_name))
+            module = __import__(module_name)
+            module_list.append(module)
+
+    return module_list
+
+
+def getPlugins(foldername):
+    if os.path.isdir(foldername):
+        sys.path.append(foldername)
+        logging.debug('%s is a directory!' % (foldername))
+
+    mod_list = import_modules(foldername)
+    logging.debug(mod_list)
+
+    plugin_method_map = {}
+    for m in mod_list:
+        dictt = get_plugins(m)
+        if dictt:
+            plugin_method_map.update(dictt)
+
+    return plugin_method_map
+
+
+def getPluginsFromModules(modulename):
+    module = __import__(modulename)
+    logging.debug(module)
+
+    plugin_method_map = {}
+    dictt = get_plugins(module)
+    if dictt:
+        plugin_method_map.update(dictt)
+
+    return plugin_method_map
+
+if __name__ == "__main__":
+    print getPlugins("plug")

+ 40 - 0
ambari-shell/ambari-python-shell/src/main/python/setup.py

@@ -0,0 +1,40 @@
+#  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 setuptools import setup, find_packages
+
+from sys import version_info, platform
+
+if version_info[:2] > (2, 5):
+    install_requires = []
+else:
+    install_requires = ['simplejson >= 2.0.0']
+
+# Python 2.6 and below requires argparse
+if version_info[:2] < (2, 7):
+    install_requires += ['argparse']
+
+install_requires += ['ambari_client']
+setup(
+  name='ambari_shell',
+  author_email="ambari-dev@incubator.apache.org",
+  version="1.6.0-SNAPSHOT",
+  packages=['ambari_shell'],
+  install_requires=install_requires,
+  description='Ambari Python Shell',
+  license='Apache License 2.0'
+)

+ 34 - 0
ambari-shell/ambari-python-shell/src/packages/tarball/all.xml

@@ -0,0 +1,34 @@
+<?xml version="1.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.
+-->
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
+  <!--This 'all' id is not appended to the produced bundle because we do this:
+    http://maven.apache.org/plugins/maven-assembly-plugin/faq.html#required-classifiers
+  -->
+  <formats>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <fileSets>
+    <fileSet>
+      <directory>src/main/python</directory>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+  </fileSets>
+</assembly>

+ 20 - 0
ambari-shell/assemblies/client.xml

@@ -0,0 +1,20 @@
+<?xml version="1.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.
+-->
+<assembly>
+</assembly>

+ 31 - 97
ambari-shell/pom.xml

@@ -1,14 +1,23 @@
 <?xml version="1.0"?>
-<!-- Licensed 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.
-  See accompanying LICENSE file. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <!--
+   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.
+-->
+
   <parent>
     <groupId>org.apache.ambari</groupId>
     <artifactId>ambari-project</artifactId>
@@ -18,106 +27,33 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.ambari</groupId>
   <artifactId>ambari-shell</artifactId>
-  <packaging>jar</packaging>
-  <name>Ambari Shell</name>
+  <packaging>pom</packaging>
   <version>1.3.0-SNAPSHOT</version>
+  <name>Ambari Shell</name>
   <description>Ambari Shell</description>
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <start-class>org.apache.ambari.shell.AmbariShell</start-class>
-  </properties>
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.shell</groupId>
-      <artifactId>spring-shell</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter-test</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.github.lalyos</groupId>
-      <artifactId>jfiglet</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.3</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.ambari</groupId>
-      <artifactId>groovy-client</artifactId>
-      <version>1.3.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <version>1.9.5</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>jline</groupId>
-      <artifactId>jline</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-mapper-asl</artifactId>
-    </dependency>
-  </dependencies>
+  <modules>
+    <module>ambari-python-shell</module>
+    <module>ambari-groovy-shell</module>
+  </modules>
   <build>
     <plugins>
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.0</version>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>src/main/resources/elephant.txt</exclude>
-            <exclude>src/test/resources/2columns</exclude>
-            <exclude>src/test/resources/3columns</exclude>
-            <exclude>src/test/resources/testBlueprint.json</exclude>
-          </excludes>
-        </configuration>
-        <executions>
-          <execution>
-            <phase>test</phase>
-            <goals>
-              <goal>check</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>
-          <skipAssembly>true</skipAssembly>
+          <tarLongFileMode>gnu</tarLongFileMode>
+          <descriptors>
+            <descriptor>assemblies/client.xml</descriptor>
+          </descriptors>
         </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-maven-plugin</artifactId>
-        <version>1.0.2.RELEASE</version>
         <executions>
           <execution>
+            <id>build-tarball</id>
+            <phase>prepare-package</phase>
             <goals>
-              <goal>repackage</goal>
+              <goal>single</goal>
             </goals>
           </execution>
         </executions>
-        <configuration>
-          <mainClass>${start-class}</mainClass>
-        </configuration>
       </plugin>
       <plugin>
         <groupId>org.vafer</groupId>
@@ -132,9 +68,7 @@
           </execution>
         </executions>
         <configuration>
-          <controlDir>${basedir}/../../ambari-project/src/main/package/deb/control</controlDir>
-          <skip>true</skip>
-          <submodules>false</submodules>
+          <controlDir>${basedir}/../ambari-project/src/main/package/deb/control</controlDir>
         </configuration>
       </plugin>
     </plugins>