You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2014/12/19 07:21:59 UTC

[10/12] ambari git commit: AMBARI-8779: Common Services: Refactor HDP-2.1 FALCON, STORM, TEZ services (Jayush Luniya)

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/status_params.py
new file mode 100644
index 0000000..5eaa446
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/status_params.py
@@ -0,0 +1,36 @@
+#!/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.
+
+"""
+from resource_management import *
+
+config = Script.get_config()
+
+pid_dir = config['configurations']['storm-env']['storm_pid_dir']
+pid_nimbus = format("{pid_dir}/nimbus.pid")
+pid_supervisor = format("{pid_dir}/supervisor.pid")
+pid_drpc = format("{pid_dir}/drpc.pid")
+pid_ui = format("{pid_dir}/ui.pid")
+pid_logviewer = format("{pid_dir}/logviewer.pid")
+pid_rest_api = format("{pid_dir}/restapi.pid")
+pid_files = {"logviewer":pid_logviewer,
+             "ui": pid_ui,
+             "nimbus": pid_nimbus,
+             "supervisor": pid_supervisor,
+             "drpc": pid_drpc,
+             "rest_api": pid_rest_api}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/storm.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/storm.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/storm.py
new file mode 100644
index 0000000..3b71751
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/storm.py
@@ -0,0 +1,98 @@
+#!/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.
+
+"""
+
+from resource_management import *
+from yaml_utils import escape_yaml_propetry
+import sys
+
+def storm():
+  import params
+
+  Directory(params.log_dir,
+            owner=params.storm_user,
+            group=params.user_group,
+            mode=0775,
+            recursive=True
+  )
+
+  Directory([params.pid_dir, params.local_dir, params.conf_dir],
+            owner=params.storm_user,
+            group=params.user_group,
+            recursive=True,
+            recursive_permission=True
+  )
+
+  File(format("{conf_dir}/config.yaml"),
+       content=Template("config.yaml.j2"),
+       owner=params.storm_user,
+       group=params.user_group
+  )
+
+  configurations = params.config['configurations']['storm-site']
+  
+  File(format("{conf_dir}/storm.yaml"),
+       content=Template(
+                        "storm.yaml.j2", 
+                         extra_imports=[escape_yaml_propetry], 
+                        configurations = configurations),
+       owner=params.storm_user,
+       group=params.user_group
+  )
+
+  if params.has_metric_collector:
+    File(format("{conf_dir}/storm-metrics2.properties"),
+        owner=params.storm_user,
+        group=params.user_group,
+        content=Template("storm-metrics2.properties.j2")
+    )
+
+  File(format("{conf_dir}/storm-env.sh"),
+    owner=params.storm_user,
+    content=InlineTemplate(params.storm_env_sh_template)
+  )
+
+  if params.security_enabled:
+    TemplateConfig(format("{conf_dir}/storm_jaas.conf"),
+                   owner=params.storm_user
+    )
+    if params.hdp_stack_version != "" and compare_versions(params.hdp_stack_version, '2.2') >= 0:
+      TemplateConfig(format("{conf_dir}/client_jaas.conf"),
+                     owner=params.storm_user
+      )
+      minRuid = configurations['_storm.min.ruid'] if configurations.has_key('_storm.min.ruid') else ''
+      
+      min_user_ruid = int(minRuid) if minRuid.isdigit() else _find_real_user_min_uid()
+      
+      File(format("{conf_dir}/worker-launcher.cfg"),
+           content=Template("worker-launcher.cfg.j2", min_user_ruid = min_user_ruid),
+           owner='root',
+           group=params.user_group
+      )
+    
+
+'''
+Finds minimal real user UID
+'''
+def _find_real_user_min_uid():
+  with open('/etc/login.defs') as f:
+    for line in f:
+      if line.strip().startswith('UID_MIN') and len(line.split()) == 2 and line.split()[1].isdigit():
+        return int(line.split()[1])
+  raise Fail("Unable to find UID_MIN in file /etc/login.defs. Expecting format e.g.: 'UID_MIN    500'")  

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
new file mode 100644
index 0000000..1ebe187
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
@@ -0,0 +1,61 @@
+#!/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 sys
+from resource_management import *
+from storm import storm
+from service import service
+
+
+class Supervisor(Script):
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    storm()
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env)
+
+    service("supervisor", action="start")
+    service("logviewer", action="start")
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+
+    service("supervisor", action="stop")
+    service("logviewer", action="stop")
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+
+    check_process_status(status_params.pid_supervisor)
+
+
+if __name__ == "__main__":
+  Supervisor().execute()
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor_prod.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor_prod.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor_prod.py
new file mode 100644
index 0000000..7aecdc5
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor_prod.py
@@ -0,0 +1,57 @@
+#!/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 sys
+from resource_management import *
+from storm import storm
+from service import service
+from supervisord_service import supervisord_service, supervisord_check_status
+
+
+class Supervisor(Script):
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    storm()
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env)
+
+    supervisord_service("supervisor", action="start")
+    service("logviewer", action="start")
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+
+    supervisord_service("supervisor", action="stop")
+    service("logviewer", action="stop")
+
+  def status(self, env):
+    supervisord_check_status("supervisor")
+
+if __name__ == "__main__":
+  Supervisor().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisord_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisord_service.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisord_service.py
new file mode 100644
index 0000000..6a5ea0b
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisord_service.py
@@ -0,0 +1,32 @@
+#!/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.
+
+"""
+
+from resource_management import *
+
+def supervisord_service(component_name, action):
+  Execute(format("supervisorctl {action} storm-{component_name}"),
+    wait_for_finish=False
+  )
+
+def supervisord_check_status(component_name):
+  try:
+    Execute(format("supervisorctl status storm-{component_name} | grep RUNNING"))
+  except Fail:
+    raise ComponentIsNotRunning() 

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
new file mode 100644
index 0000000..6a9d923
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
@@ -0,0 +1,58 @@
+#!/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 sys
+from resource_management import *
+from storm import storm
+from service import service
+from service_check import ServiceCheck
+
+
+class UiServer(Script):
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+
+    storm()
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env)
+
+    service("ui", action="start")
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+
+    service("ui", action="stop")
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+    check_process_status(status_params.pid_ui)
+
+if __name__ == "__main__":
+  UiServer().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py
new file mode 100644
index 0000000..8187666
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py
@@ -0,0 +1,49 @@
+#!/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 re
+
+def escape_yaml_propetry(value):
+  unquouted = False
+  unquouted_values = ["null","Null","NULL","true","True","TRUE","false","False","FALSE","YES","Yes","yes","NO","No","no","ON","On","on","OFF","Off","off"]
+  if value in unquouted_values:
+    unquouted = True
+
+  # if is list [a,b,c]
+  if re.match('^\w*\[.+\]\w*$', value):
+    unquouted = True
+    
+  try:
+    int(value)
+    unquouted = True
+  except ValueError:
+    pass
+  
+  try:
+    float(value)
+    unquouted = True
+  except ValueError:
+    pass
+  
+  if not unquouted:
+    value = value.replace("'","''")
+    value = "'"+value+"'"
+    
+  return value
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/client_jaas.conf.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/client_jaas.conf.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/client_jaas.conf.j2
new file mode 100644
index 0000000..e8dc122
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/client_jaas.conf.j2
@@ -0,0 +1,24 @@
+{#
+# 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.
+#}
+
+StormClient {
+   com.sun.security.auth.module.Krb5LoginModule required
+   useTicketCache=true
+   renewTicket=true
+   serviceName="{{nimbus_bare_jaas_principal}}";
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/config.yaml.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/config.yaml.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/config.yaml.j2
new file mode 100644
index 0000000..445df31
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/config.yaml.j2
@@ -0,0 +1,65 @@
+{#
+# 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.
+#}
+
+# 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.
+
+nimbusHost: {{nimbus_host}}
+nimbusPort: {{nimbus_port}}
+
+# HTTP-specific options.
+http:
+
+  # The port on which the HTTP server listens for service requests.
+  port: {{rest_api_port}}
+
+  # The port on which the HTTP server listens for administrative requests.
+  adminPort: {{rest_api_admin_port}}
+
+{% if ganglia_installed %}
+enableGanglia: {{ganglia_installed}}
+
+# ganglia configuration (necessary if ganglia reporting is enabled)
+ganglia:
+
+  # how often to report to ganglia metrics (in seconds)
+  reportInterval: {{ganglia_report_interval}}
+
+  # the hostname of the gmond server where storm cluster metrics will be sent
+  host: "{{ganglia_server}}"
+
+  # address mode
+  # default is MULTICAST
+  addressMode: "UNICAST"
+
+  # an <IP>:<HOSTNAME> pair to spoof
+  # this allows us to simulate storm cluster metrics coming from a specific host
+  #spoof: "192.168.1.1:storm"
+{% endif %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm-metrics2.properties.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm-metrics2.properties.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm-metrics2.properties.j2
new file mode 100644
index 0000000..6d333d5
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm-metrics2.properties.j2
@@ -0,0 +1,21 @@
+{#
+# 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.
+#}
+
+collector={{metric_collector_host}}:8188
+maxRowCacheSize=10000
+sendInterval=59000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm.yaml.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm.yaml.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm.yaml.j2
new file mode 100644
index 0000000..e6eed41
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm.yaml.j2
@@ -0,0 +1,66 @@
+{#
+# 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.
+#}
+{% macro replace_jaas_placeholder(name) -%}
+{% if name.find('_JAAS_PLACEHOLDER') > -1 -%}
+    {%- if security_enabled -%}
+        {{ name.replace('_JAAS_PLACEHOLDER', '-Djava.security.auth.login.config=' +conf_dir + '/storm_jaas.conf') }}
+    {%- else -%}
+        {{ name.replace('_JAAS_PLACEHOLDER', '') }}
+    {%- endif -%}
+{%- else -%}
+    {{name}}
+{%- endif -%}
+{%- endmacro %}
+
+{% for key, value in configurations|dictsort if not key.startswith('_') %}
+{{key}} : {{ escape_yaml_propetry(replace_jaas_placeholder(value)) }}
+{% endfor %}
+
+{% if stack_is_hdp22_or_further %}
+storm.thrift.transport : "{% if security_enabled %}{{configurations['_storm.thrift.secure.transport']}}{% else %}{{configurations['_storm.thrift.nonsecure.transport']}}{% endif %}"  
+{% endif %}
+
+{% if security_enabled and stack_is_hdp22_or_further %}
+#
+# Kerberos security section. For the reference please use: https://github.com/hortonworks/storm/blob/champlain/SECURITY.md for details
+#
+
+storm.principal.tolocal: "backtype.storm.security.auth.KerberosPrincipalToLocal"
+storm.zookeeper.superACL: "sasl:{{storm_bare_jaas_principal}}"
+java.security.auth.login.config: "{{conf_dir}}/storm_jaas.conf"
+nimbus.admins:
+  - "{{storm_user}}"
+nimbus.supervisor.users:
+  - "{{storm_user}}"
+nimbus.authorizer: "backtype.storm.security.auth.authorizer.SimpleACLAuthorizer"
+drpc.authorizer: "backtype.storm.security.auth.authorizer.DRPCSimpleACLAuthorizer"
+
+ui.filter: "org.apache.hadoop.security.authentication.server.AuthenticationFilter"
+ui.filter.params:
+  "type": "kerberos"
+  "kerberos.principal": "{{storm_ui_jaas_principal}}"
+  "kerberos.keytab": "{{storm_ui_keytab_path}}"
+  "kerberos.name.rules": "DEFAULT"
+supervisor.enable: true
+{% endif %}
+
+{% if has_metric_collector %}
+topology.metrics.consumer.register:
+  - class: "org.apache.hadoop.metrics2.sink.storm.StormTimelineMetricsSink"
+    parallelism.hint: 1
+{% endif %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm_jaas.conf.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm_jaas.conf.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm_jaas.conf.j2
new file mode 100644
index 0000000..75cf178
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/storm_jaas.conf.j2
@@ -0,0 +1,45 @@
+{#
+# 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.
+#}
+{% if stack_is_hdp22_or_further %}
+StormServer {
+   com.sun.security.auth.module.Krb5LoginModule required
+   useKeyTab=true
+   keyTab="{{nimbus_keytab_path}}"
+   storeKey=true
+   useTicketCache=false
+   principal="{{nimbus_jaas_principal}}";
+};
+StormClient {
+   com.sun.security.auth.module.Krb5LoginModule required
+   useKeyTab=true
+   keyTab="{{storm_keytab_path}}"
+   storeKey=true
+   useTicketCache=false
+   serviceName="{{nimbus_bare_jaas_principal}}"
+   principal="{{storm_jaas_principal}}";
+};
+{% endif %}
+Client {
+   com.sun.security.auth.module.Krb5LoginModule required
+   useKeyTab=true
+   keyTab="{{storm_keytab_path}}"
+   storeKey=true
+   useTicketCache=false
+   serviceName="zookeeper"
+   principal="{{storm_jaas_principal}}";
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/worker-launcher.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/worker-launcher.cfg.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/worker-launcher.cfg.j2
new file mode 100644
index 0000000..2228601
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/templates/worker-launcher.cfg.j2
@@ -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 language governing permissions and
+# limitations under the License.
+#}
+storm.worker-launcher.group={{user_group}}
+min.user.id={{min_user_ruid}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-env.xml b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-env.xml
new file mode 100644
index 0000000..a1eac56
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-env.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<configuration>
+  <property>
+    <name>tez_user</name>
+    <value>tez</value>
+    <property-type>USER</property-type>
+    <description></description>
+  </property>
+
+  <!-- tez-env.sh -->
+  <property>
+    <name>content</name>
+    <description>This is the jinja template for tez-env.sh file</description>
+    <value>
+# Tez specific configuration
+export TEZ_CONF_DIR={{config_dir}}
+
+# Set HADOOP_HOME to point to a specific hadoop install directory
+export HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}
+
+# The java implementation to use.
+export JAVA_HOME={{java64_home}}
+    </value>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml
new file mode 100644
index 0000000..218c508
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml
@@ -0,0 +1,215 @@
+<?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.
+-->
+
+<configuration supports_final="true">
+
+  <property>
+    <name>tez.lib.uris</name>
+    <value>hdfs:///apps/tez/,hdfs:///apps/tez/lib/</value>
+    <description>The location of the Tez libraries which will be localized for DAGs</description>
+  </property>
+
+  <property>
+    <name>tez.am.log.level</name>
+    <value>INFO</value>
+    <description>Root Logging level passed to the Tez app master</description>
+  </property>
+
+  <property>
+    <name>tez.staging-dir</name>
+    <value>/tmp/${user.name}/staging</value>
+    <description>The staging dir used while submitting DAGs</description>
+  </property>
+
+  <property>
+    <name>tez.am.resource.memory.mb</name>
+    <value>1536</value>
+    <description>The amount of memory to be used by the AppMaster</description>
+  </property>
+
+  <!-- tez picks the java opts from yarn.app.mapreduce.am.command-opts for MR tasks. Likewise for the AM memory MB -->
+  <property>
+    <name>tez.am.java.opts</name>
+    <value>-server -Xmx1024m -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC</value>
+    <description>Java options for the Tez AppMaster process. The -Xmx parameter value is generally 0.8 times tez.am.resource.memory.mb config.</description>
+  </property>
+
+  <property>
+    <name>tez.am.shuffle-vertex-manager.min-src-fraction</name>
+    <value>0.2</value>
+    <description>In case of a ScatterGather connection, the fraction of source tasks which should
+      complete before tasks for the current vertex are schedule
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.shuffle-vertex-manager.max-src-fraction</name>
+    <value>0.4</value>
+    <description>In case of a ScatterGather connection, once this fraction of source tasks have
+      completed, all tasks on the current vertex can be scheduled. Number of tasks ready for
+      scheduling on the current vertex scales linearly between min-fraction and max-fraction
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.am-rm.heartbeat.interval-ms.max</name>
+    <value>250</value>
+    <description>The maximum heartbeat interval between the AM and RM in milliseconds</description>
+  </property>
+
+  <property>
+    <name>tez.am.grouping.split-waves</name>
+    <value>1.4</value>
+    <description>The multiplier for available queue capacity when determining number of tasks for
+      a Vertex. 1.4 with 100% queue available implies generating a number of tasks roughly equal
+      to 140% of the available containers on the queue
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.grouping.min-size</name>
+    <value>16777216</value>
+    <description>Lower bound on the size (in bytes) of a grouped split, to avoid generating
+      too many splits
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.grouping.max-size</name>
+    <value>1073741824</value>
+    <description>Upper bound on the size (in bytes) of a grouped split, to avoid generating
+      excessively large split
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.container.reuse.enabled</name>
+    <value>true</value>
+    <description>Configuration to specify whether container should be reused</description>
+  </property>
+
+  <property>
+    <name>tez.am.container.reuse.rack-fallback.enabled</name>
+    <value>true</value>
+    <description>Whether to reuse containers for rack local tasks. Active only if reuse is enabled
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.container.reuse.non-local-fallback.enabled</name>
+    <value>true</value>
+    <description>Whether to reuse containers for non-local tasks. Active only if reuse is enabled
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.container.session.delay-allocation-millis</name>
+    <value>10000</value>
+    <!-- TODO This value may change -->
+    <description>The amount of time to hold on to a container if no task can be assigned to
+      it immediately. Only active when reuse is enabled. Set to -1 to never release a container
+      in a session
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.container.reuse.locality.delay-allocation-millis</name>
+    <value>250</value>
+    <description>The amount of time to wait before assigning a container to the next level of
+      locality. NODE -> RACK -> NON_LOCAL
+    </description>
+  </property>
+
+  <property>
+    <name>tez.task.get-task.sleep.interval-ms.max</name>
+    <value>200</value>
+    <description>The maximum amount of time, in seconds, to wait before a task asks an AM for
+      another task
+    </description>
+  </property>
+
+  <property>
+    <name>tez.am.env</name>
+    <value>LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/Linux-amd64-64</value>
+    <description>
+        Additional execution environment entries for tez. This is not an additive property. You must preserve the original value if
+        you want to have access to native libraries.
+    </description>
+  </property>
+
+  <!-- Client Submission timeout value when submitting DAGs to a session -->
+  <property>
+    <name>tez.session.client.timeout.secs</name>
+    <value>180</value>
+    <description>Time (in seconds) to wait for AM to come up when trying to submit a DAG from
+      the client
+    </description>
+  </property>
+
+  <property>
+    <name>tez.session.am.dag.submit.timeout.secs</name>
+    <value>300</value>
+    <description>Time (in seconds) for which the Tez AM should wait for a DAG to be submitted
+      before shutting down
+    </description>
+  </property>
+
+
+  <!-- Configuration for runtime components -->
+
+  <!-- These properties can be set on a per edge basis by configuring the payload for each
+       edge independently. -->
+
+  <property>
+    <name>tez.runtime.intermediate-output.should-compress</name>
+    <value>false</value>
+    <description>Whether intermediate output should be compressed or not</description>
+  </property>
+
+  <property>
+    <name>tez.runtime.intermediate-output.compress.codec</name>
+    <value>org.apache.hadoop.io.compress.SnappyCodec</value>
+    <description>The coded to be used if compressing intermediate output. Only
+      applicable if tez.runtime.intermediate-output.should-compress is enabled.
+    </description>
+  </property>
+
+  <property>
+    <name>tez.runtime.intermediate-input.is-compressed</name>
+    <value>false</value>
+    <description>Whether intermediate input is compressed</description>
+  </property>
+
+  <property>
+    <name>tez.runtime.intermediate-input.compress.codec</name>
+    <value>org.apache.hadoop.io.compress.SnappyCodec</value>
+    <description>The coded to be used when reading intermediate compressed input.
+    Only applicable if tez.runtime.intermediate-input.is-compressed is enabled.</description>
+  </property>
+
+  <!-- Configuration for ATS integration -->
+
+  <property>
+    <name>tez.yarn.ats.enabled</name>
+    <value>true</value>
+    <description>Whether to send history events to YARN Application Timeline Server</description>
+  </property>
+
+</configuration>
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/metainfo.xml b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/metainfo.xml
new file mode 100644
index 0000000..641de86
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/metainfo.xml
@@ -0,0 +1,73 @@
+<?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.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>TEZ</name>
+      <displayName>Tez</displayName>
+      <comment>Tez is the next generation Hadoop Query Processing framework written on top of YARN.</comment>
+      <version>0.4.0.2.1</version>
+      <components>
+        <component>
+          <name>TEZ_CLIENT</name>
+          <displayName>Tez Client</displayName>
+          <cardinality>1+</cardinality>
+          <category>CLIENT</category>
+          <commandScript>
+            <script>scripts/tez_client.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+          <configFiles>
+            <configFile>
+              <type>xml</type>
+              <fileName>tez-site.xml</fileName>
+              <dictionaryName>tez-site</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>env</type>
+              <fileName>tez-env.sh</fileName>
+              <dictionaryName>tez-env</dictionaryName>
+            </configFile>
+          </configFiles>
+        </component>
+      </components>
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>any</osFamily>
+          <packages>
+            <package>
+              <name>tez</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+      
+      <requiredServices>
+        <service>YARN</service>
+      </requiredServices>
+
+      <configuration-dependencies>
+        <config-type>tez-site</config-type>
+        <config-type>tez-env</config-type>
+      </configuration-dependencies>
+
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py
new file mode 100644
index 0000000..31162cd
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py
@@ -0,0 +1,67 @@
+#!/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.
+
+"""
+
+from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions
+from resource_management import *
+
+# server configurations
+config = Script.get_config()
+
+# This is expected to be of the form #.#.#.#
+hdp_stack_version = str(config['hostLevelParams']['stack_version'])
+hdp_stack_version = format_hdp_stack_version(hdp_stack_version)
+
+# New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade
+version = default("/commandParams/version", None)
+
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
+  hadoop_bin_dir = "/usr/hdp/current/hadoop-client/bin"
+else:
+  hadoop_bin_dir = "/usr/bin"
+hadoop_conf_dir = "/etc/hadoop/conf"
+
+kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name']
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+
+config_dir_prefix = "/etc/tez"
+config_dir = format("{config_dir_prefix}/conf")
+
+hadoop_home = '/usr'
+java64_home = config['hostLevelParams']['java_home']
+
+tez_user = config['configurations']['tez-env']['tez_user']
+user_group = config['configurations']['cluster-env']['user_group']
+tez_env_sh_template = config['configurations']['tez-env']['content']
+
+import functools
+# Create partial functions with common arguments for every HdfsDirectory call
+# to create hdfs directory we need to call params.HdfsDirectory in code
+HdfsDirectory = functools.partial(
+  HdfsDirectory,
+  conf_dir=hadoop_conf_dir,
+  hdfs_user=hdfs_principal_name if security_enabled else hdfs_user,
+  security_enabled=security_enabled,
+  keytab=hdfs_user_keytab,
+  kinit_path_local=kinit_path_local,
+  bin_dir=hadoop_bin_dir
+)

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez.py
new file mode 100644
index 0000000..bb8b7c2
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez.py
@@ -0,0 +1,61 @@
+"""
+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.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+
+def tez():
+  import params
+
+  Directory(params.config_dir_prefix,
+            mode=0755
+  )
+  Directory(params.config_dir,
+            owner = params.tez_user,
+            group = params.user_group,
+            recursive = True
+  )
+
+  XmlConfig( "tez-site.xml",
+             conf_dir = params.config_dir,
+             configurations = params.config['configurations']['tez-site'],
+             configuration_attributes=params.config['configuration_attributes']['tez-site'],
+             owner = params.tez_user,
+             group = params.user_group,
+             mode = 0664
+  )
+
+  File(format("{config_dir}/tez-env.sh"),
+       owner=params.tez_user,
+       content=InlineTemplate(params.tez_env_sh_template)
+  )
+
+
+def tez_TemplateConfig(name):
+  import params
+
+  if not isinstance(name, list):
+    name = [name]
+
+  for x in name:
+    TemplateConfig(format("{config_dir}/{x}"),
+                   owner = params.tez_user
+    )
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
new file mode 100644
index 0000000..04cfb90
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
@@ -0,0 +1,49 @@
+"""
+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.
+
+Ambari Agent
+
+"""
+
+import sys
+from resource_management import *
+from tez import tez
+
+class TezClient(Script):
+
+  def pre_rolling_restart(self, env):
+    import params
+    env.set_params(params)
+
+    if params.version and compare_versions(format_hdp_stack_version(params.version), '2.2.0.0') >= 0:
+      Execute(format("hdp-select set hadoop-client {version}"))
+
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    tez()
+
+  def status(self, env):
+    raise ClientComponentHasNoStatus()
+
+
+if __name__ == "__main__":
+  TezClient().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/alerts.json b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/alerts.json
deleted file mode 100644
index c34093f..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/alerts.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
-  "FALCON": {
-    "service": [],
-    "FALCON_SERVER": [
-      {
-        "name": "falcon_server_process",
-        "label": "Falcon Server Process",
-        "description": "This host-level alert is triggered if the individual Falcon server process cannot be established to be up and listening on the network.",
-        "interval": 1,
-        "scope": "ANY",
-        "source": {
-          "type": "PORT",
-          "uri": "{{falcon-env/falcon_port}}",
-          "default_port": 15000,
-          "reporting": {
-            "ok": {
-              "text": "TCP OK - {0:.3f}s response on port {1}"
-            },
-            "warning": {
-              "text": "TCP OK - {0:.3f}s response on port {1}",
-              "value": 1.5
-            },
-            "critical": {
-              "text": "Connection failed: {0} to {1}:{2}",
-              "value": 5.0
-            }
-          }
-        }
-      },
-      {
-        "name": "falcon_server_webui",
-        "label": "Falcon Server Web UI",
-        "description": "This host-level alert is triggered if the Falcon Server Web UI is unreachable.",
-        "interval": 1,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{falcon-env/falcon_port}}",
-            "default_port": 15000
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.4f} seconds"
-            },
-            "warning":{
-              "text": "HTTP {0} response in {2:.4f} seconds"
-            },
-            "critical": {
-              "text": "Connection failed to {1}"
-            }
-          }
-        }
-      }
-    ]
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-env.xml
deleted file mode 100644
index 0eaad86..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-env.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-<configuration>
-  <property>
-    <name>falcon_user</name>
-    <value>falcon</value>
-    <property-type>USER</property-type>
-    <description>Falcon user.</description>
-  </property>
-  <property>
-    <name>falcon_port</name>
-    <value>15000</value>
-    <description>Port the Falcon Server listens on.</description>
-  </property>
-  <property>
-    <name>falcon_log_dir</name>
-    <value>/var/log/falcon</value>
-    <description>Falcon log directory.</description>
-  </property>
-  <property>
-    <name>falcon_pid_dir</name>
-    <value>/var/run/falcon</value>
-    <description>Falcon pid-file directory.</description>
-  </property>
-  <property>
-    <name>falcon_local_dir</name>
-    <value>/hadoop/falcon</value>
-    <description>Directory where Falcon data, such as activemq data, is stored.</description>
-  </property>
-  <!--embeddedmq properties-->
-  <property>
-    <name>falcon.embeddedmq.data</name>
-    <value>/hadoop/falcon/embeddedmq/data</value>
-    <description>Directory in which embeddedmq data is stored.</description>
-  </property>
-  <property>
-    <name>falcon.embeddedmq</name>
-    <value>true</value>
-    <description>Whether embeddedmq is enabled or not.</description>
-  </property>
-  <property>
-    <name>falcon.emeddedmq.port</name>
-    <value>61616</value>
-    <description>Port that embeddedmq will listen on.</description>
-  </property>
-  
-  <!-- falcon-env.sh -->
-  <property>
-    <name>content</name>
-    <description>This is the jinja template for falcon-env.sh file</description>
-    <value>
-# The java implementation to use. If JAVA_HOME is not found we expect java and jar to be in path
-export JAVA_HOME={{java_home}}
-
-# any additional java opts you want to set. This will apply to both client and server operations
-#export FALCON_OPTS=
-
-# any additional java opts that you want to set for client only
-#export FALCON_CLIENT_OPTS=
-
-# java heap size we want to set for the client. Default is 1024MB
-#export FALCON_CLIENT_HEAP=
-
-# any additional opts you want to set for prisim service.
-#export FALCON_PRISM_OPTS=
-
-# java heap size we want to set for the prisim service. Default is 1024MB
-#export FALCON_PRISM_HEAP=
-
-# any additional opts you want to set for falcon service.
-export FALCON_SERVER_OPTS="-Dfalcon.embeddedmq={{falcon_embeddedmq_enabled}} -Dfalcon.emeddedmq.port={{falcon_emeddedmq_port}}"
-
-# java heap size we want to set for the falcon server. Default is 1024MB
-#export FALCON_SERVER_HEAP=
-
-# What is is considered as falcon home dir. Default is the base location of the installed software
-#export FALCON_HOME_DIR=
-
-# Where log files are stored. Defatult is logs directory under the base install location
-export FALCON_LOG_DIR={{falcon_log_dir}}
-
-# Where pid files are stored. Defatult is logs directory under the base install location
-export FALCON_PID_DIR={{falcon_pid_dir}}
-
-# where the falcon active mq data is stored. Defatult is logs/data directory under the base install location
-export FALCON_DATA_DIR={{falcon_embeddedmq_data}}
-
-# Where do you want to expand the war file. By Default it is in /server/webapp dir under the base install dir.
-#export FALCON_EXPANDED_WEBAPP_DIR=
-    </value>
-  </property>  
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-runtime.properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-runtime.properties.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-runtime.properties.xml
deleted file mode 100644
index 94c8755..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-runtime.properties.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-<configuration supports_final="false">
-  <property>
-    <name>*.domain</name>
-    <value>${falcon.app.type}</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.log.cleanup.frequency.minutes.retention</name>
-    <value>hours(6)</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.log.cleanup.frequency.hours.retention</name>
-    <value>minutes(1)</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.log.cleanup.frequency.days.retention</name>
-    <value>days(7)</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.log.cleanup.frequency.months.retention</name>
-    <value>months(3)</value>
-    <description></description>
-  </property>
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-startup.properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-startup.properties.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-startup.properties.xml
deleted file mode 100644
index 7459429..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/falcon-startup.properties.xml
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-<configuration supports_final="false">
-  <!--advanced properties-->
-  <property>
-    <name>*.workflow.engine.impl</name>
-    <value>org.apache.falcon.workflow.engine.OozieWorkflowEngine</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.oozie.process.workflow.builder</name>
-    <value>org.apache.falcon.workflow.OozieProcessWorkflowBuilder</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.oozie.feed.workflow.builder</name>
-    <value>org.apache.falcon.workflow.OozieFeedWorkflowBuilder</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.SchedulableEntityManager.impl</name>
-    <value>org.apache.falcon.resource.SchedulableEntityManager</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.ConfigSyncService.impl</name>
-    <value>org.apache.falcon.resource.ConfigSyncService</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.ProcessInstanceManager.impl</name>
-    <value>org.apache.falcon.resource.InstanceManager</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.catalog.service.impl</name>
-    <value>org.apache.falcon.catalog.HiveCatalogService</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.application.services</name>
-    <value>org.apache.falcon.security.AuthenticationInitializationService,\
-      org.apache.falcon.service.ProcessSubscriberService,\
-      org.apache.falcon.entity.store.ConfigurationStore,\
-      org.apache.falcon.rerun.service.RetryService,\
-      org.apache.falcon.rerun.service.LateRunService,\
-      org.apache.falcon.service.LogCleanupService
-    </value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.configstore.listeners</name>
-    <value>org.apache.falcon.entity.v0.EntityGraph,\
-      org.apache.falcon.entity.ColoClusterRelation,\
-      org.apache.falcon.group.FeedGroupMap,\
-      org.apache.falcon.service.SharedLibraryHostingService
-    </value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.broker.impl.class</name>
-    <value>org.apache.activemq.ActiveMQConnectionFactory</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.shared.libs</name>
-    <value>activemq-core,ant,geronimo-j2ee-management,hadoop-distcp,jms,json-simple,oozie-client,spring-jms</value>
-    <description></description>
-  </property>
-  <!--common properties-->
-  <property>
-    <name>*.domain</name>
-    <value>${falcon.app.type}</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.config.store.uri</name>
-    <value>file:///hadoop/falcon/store</value>
-    <description>Location to store user entity configurations</description>
-  </property>
-  <property>
-    <name>*.system.lib.location</name>
-    <value>${falcon.home}/server/webapp/${falcon.app.type}/WEB-INF/lib</value>
-    <description>Location of libraries that is shipped to Hadoop</description>
-  </property>
-  <property>
-    <name>*.retry.recorder.path</name>
-    <value>${falcon.log.dir}/retry</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.falcon.cleanup.service.frequency</name>
-    <value>days(1)</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.broker.url</name>
-    <value>tcp://localhost:61616</value>
-    <description>Default Active MQ url</description>
-  </property>
-  <property>
-    <name>*.broker.ttlInMins</name>
-    <value>4320</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.entity.topic</name>
-    <value>FALCON.ENTITY.TOPIC</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.max.retry.failure.count</name>
-    <value>1</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.internal.queue.size</name>
-    <value>1000</value>
-    <description></description>
-  </property>
-  <!--properties without default values-->
-  <property>
-    <name>*.falcon.http.authentication.cookie.domain</name>
-    <value>EXAMPLE.COM</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.blacklisted.users</name>
-    <value></value>
-    <description>Comma separated list of black listed users</description>
-  </property>
-  <!--authentication properties-->
-  <property>
-    <name>*.falcon.authentication.type</name>
-    <value>simple</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.type</name>
-    <value>simple</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.token.validity</name>
-    <value>36000</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.signature.secret</name>
-    <value>falcon</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.simple.anonymous.allowed</name>
-    <value>true</value>
-    <description>Indicates if anonymous requests are allowed when using 'simple' authentication</description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.kerberos.name.rules</name>
-    <value>DEFAULT</value>
-    <description>The kerberos names rules is to resolve kerberos principal names, refer to Hadoop's KerberosName for more details.</description>
-  </property>
-  <!--kerberos params, must be set during security enabling-->
-  <property>
-    <name>*.falcon.service.authentication.kerberos.principal</name>
-    <value>falcon/_HOST@EXAMPLE.COM</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.falcon.service.authentication.kerberos.keytab</name>
-    <value>/etc/security/keytabs/falcon.service.keytab</value>
-    <description></description>
-  </property>
-  <property>
-    <name>*.dfs.namenode.kerberos.principal</name>
-    <value>nn/_HOST@EXAMPLE.COM</value>
-    <description>name node principal to talk to config store</description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.kerberos.principal</name>
-    <value>HTTP/_HOST@EXAMPLE.COM</value>
-    <description>Indicates the Kerberos principal to be used for HTTP endpoint</description>
-  </property>
-  <property>
-    <name>*.falcon.http.authentication.kerberos.keytab</name>
-    <value>/etc/security/keytabs/spnego.service.keytab</value>
-    <description>Location of the keytab file with the credentials for the HTTP principal</description>
-  </property>
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/oozie-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/oozie-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/oozie-site.xml
deleted file mode 100644
index c6962f3..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/configuration/oozie-site.xml
+++ /dev/null
@@ -1,176 +0,0 @@
-<?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.
--->
-
-<configuration supports_final="true">
-  <property>
-    <name>oozie.service.ELService.ext.functions.coord-job-submit-instances</name>
-    <value>
-      now=org.apache.oozie.extensions.OozieELExtensions#ph1_now_echo,
-      today=org.apache.oozie.extensions.OozieELExtensions#ph1_today_echo,
-      yesterday=org.apache.oozie.extensions.OozieELExtensions#ph1_yesterday_echo,
-      currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_currentMonth_echo,
-      lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_lastMonth_echo,
-      currentYear=org.apache.oozie.extensions.OozieELExtensions#ph1_currentYear_echo,
-      lastYear=org.apache.oozie.extensions.OozieELExtensions#ph1_lastYear_echo,
-      formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo,
-      latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo,
-      future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo
-    </value>
-    <description>
-      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
-      This property is a convenience property to add extensions to the built in executors without having to
-      include all the built in ones.
-    </description>
-  </property>
-
-  <property>
-    <name>oozie.service.ELService.ext.functions.coord-action-create-inst</name>
-    <value>
-      now=org.apache.oozie.extensions.OozieELExtensions#ph2_now_inst,
-      today=org.apache.oozie.extensions.OozieELExtensions#ph2_today_inst,
-      yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday_inst,
-      currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth_inst,
-      lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth_inst,
-      currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear_inst,
-      lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear_inst,
-      latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo,
-      future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo,
-      formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime,
-      user=org.apache.oozie.coord.CoordELFunctions#coord_user
-    </value>
-    <description>
-      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
-      This property is a convenience property to add extensions to the built in executors without having to
-      include all the built in ones.
-    </description>
-  </property>
-
-  <property>
-    <name>oozie.service.ELService.ext.functions.coord-action-create</name>
-    <value>
-      now=org.apache.oozie.extensions.OozieELExtensions#ph2_now,
-      today=org.apache.oozie.extensions.OozieELExtensions#ph2_today,
-      yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday,
-      currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth,
-      lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth,
-      currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear,
-      lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear,
-      latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo,
-      future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo,
-      formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime,
-      user=org.apache.oozie.coord.CoordELFunctions#coord_user
-    </value>
-    <description>
-      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
-      This property is a convenience property to add extensions to the built in executors without having to
-      include all the built in ones.
-    </description>
-  </property>
-
-  <property>
-    <name>oozie.service.ELService.ext.functions.coord-job-submit-data</name>
-    <value>
-      now=org.apache.oozie.extensions.OozieELExtensions#ph1_now_echo,
-      today=org.apache.oozie.extensions.OozieELExtensions#ph1_today_echo,
-      yesterday=org.apache.oozie.extensions.OozieELExtensions#ph1_yesterday_echo,
-      currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_currentMonth_echo,
-      lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_lastMonth_echo,
-      currentYear=org.apache.oozie.extensions.OozieELExtensions#ph1_currentYear_echo,
-      lastYear=org.apache.oozie.extensions.OozieELExtensions#ph1_lastYear_echo,
-      dataIn=org.apache.oozie.extensions.OozieELExtensions#ph1_dataIn_echo,
-      instanceTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_nominalTime_echo_wrap,
-      formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo,
-      dateOffset=org.apache.oozie.coord.CoordELFunctions#ph1_coord_dateOffset_echo,
-      user=org.apache.oozie.coord.CoordELFunctions#coord_user
-    </value>
-    <description>
-      EL constant declarations, separated by commas, format is [PREFIX:]NAME=CLASS#CONSTANT.
-      This property is a convenience property to add extensions to the built in executors without having to
-      include all the built in ones.
-    </description>
-  </property>
-
-  <property>
-    <name>oozie.service.ELService.ext.functions.coord-action-start</name>
-    <value>
-      now=org.apache.oozie.extensions.OozieELExtensions#ph2_now,
-      today=org.apache.oozie.extensions.OozieELExtensions#ph2_today,
-      yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday,
-      currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth,
-      lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth,
-      currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear,
-      lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear,
-      latest=org.apache.oozie.coord.CoordELFunctions#ph3_coord_latest,
-      future=org.apache.oozie.coord.CoordELFunctions#ph3_coord_future,
-      dataIn=org.apache.oozie.extensions.OozieELExtensions#ph3_dataIn,
-      instanceTime=org.apache.oozie.coord.CoordELFunctions#ph3_coord_nominalTime,
-      dateOffset=org.apache.oozie.coord.CoordELFunctions#ph3_coord_dateOffset,
-      formatTime=org.apache.oozie.coord.CoordELFunctions#ph3_coord_formatTime,
-      user=org.apache.oozie.coord.CoordELFunctions#coord_user
-    </value>
-    <description>
-      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
-      This property is a convenience property to add extensions to the built in executors without having to
-      include all the built in ones.
-    </description>
-  </property>
-
-  <property>
-    <name>oozie.service.ELService.ext.functions.coord-sla-submit</name>
-    <value>
-      instanceTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_nominalTime_echo_fixed,
-      user=org.apache.oozie.coord.CoordELFunctions#coord_user
-    </value>
-    <description>
-      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
-    </description>
-  </property>
-
-  <property>
-    <name>oozie.service.ELService.ext.functions.coord-sla-create</name>
-    <value>
-      instanceTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_nominalTime,
-      user=org.apache.oozie.coord.CoordELFunctions#coord_user
-    </value>
-    <description>
-      EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
-    </description>
-  </property>
-  
-  <property>
-    <name>oozie.service.HadoopAccessorService.supported.filesystems</name>
-    <value>*</value>
-    <description>
-      Enlist the different filesystems supported for federation. If wildcard "*" is specified, then ALL file schemes will be allowed.
-    </description>
-  </property>
-  
-  <!--web ui should add following properties to oozie site accordingly to FALCON_USER-->
-  <!--<property>-->
-    <!--<name>oozie.service.ProxyUserService.proxyuser.#FALCON_USER#.hosts</name>-->
-    <!--<value>*</value>-->
-    <!--<description>Falcon proxyuser hosts</description>-->
-  <!--</property>-->
-
-  <!--<property>-->
-    <!--<name>oozie.service.ProxyUserService.proxyuser.#FALCON_USER#.groups</name>-->
-    <!--<value>*</value>-->
-    <!--<description>Falcon proxyuser groups</description>-->
-  <!--</property>-->
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/metainfo.xml
index 78336e6..78cf5d4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/metainfo.xml
@@ -20,98 +20,7 @@
   <services>
     <service>
       <name>FALCON</name>
-      <displayName>Falcon</displayName>
-      <comment>Data management and processing platform</comment>
-      <version>0.5.0.2.1</version>
-      <components>
-        <component>
-          <name>FALCON_CLIENT</name>
-          <displayName>Falcon Client</displayName>
-          <category>CLIENT</category>
-          <cardinality>1+</cardinality>
-          <commandScript>
-            <script>scripts/falcon_client.py</script>
-            <scriptType>PYTHON</scriptType>
-            <timeout>600</timeout>
-          </commandScript>
-          <configFiles>
-            <configFile>
-              <type>env</type>
-              <fileName>falcon-env.sh</fileName>
-              <dictionaryName>falcon-env</dictionaryName>
-            </configFile>
-            <configFile>
-              <type>properties</type>
-              <fileName>runtime.properties</fileName>
-              <dictionaryName>falcon-runtime.properties</dictionaryName>
-            </configFile>
-            <configFile>
-              <type>properties</type>
-              <fileName>startup.properties</fileName>
-              <dictionaryName>falcon-startup.properties</dictionaryName>
-            </configFile>
-          </configFiles>
-        </component>
-        <component>
-          <name>FALCON_SERVER</name>
-          <displayName>Falcon Server</displayName>
-          <category>MASTER</category>
-          <cardinality>1</cardinality>
-          <dependencies>
-            <dependency>
-              <name>OOZIE/OOZIE_SERVER</name>
-              <scope>cluster</scope>
-              <auto-deploy>
-                <enabled>true</enabled>
-              </auto-deploy>
-            </dependency>
-            <dependency>
-              <name>OOZIE/OOZIE_CLIENT</name>
-              <scope>cluster</scope>
-              <auto-deploy>
-                <enabled>true</enabled>
-              </auto-deploy>
-            </dependency>
-          </dependencies>
-          <commandScript>
-            <script>scripts/falcon_server.py</script>
-            <scriptType>PYTHON</scriptType>
-            <timeout>600</timeout>
-          </commandScript>
-        </component>
-      </components>
-
-      <osSpecifics>
-        <osSpecific>
-          <osFamily>any</osFamily>
-          <packages>
-            <package>
-              <name>falcon</name>
-            </package>
-          </packages>
-        </osSpecific>
-      </osSpecifics>
-
-      <commandScript>
-        <script>scripts/service_check.py</script>
-        <scriptType>PYTHON</scriptType>
-        <timeout>300</timeout>
-      </commandScript>
-      
-      <requiredServices>
-        <service>OOZIE</service>
-      </requiredServices>
-
-      <configuration-dependencies>
-        <config-type>falcon-env</config-type>
-        <config-type>falcon-startup.properties</config-type>
-        <config-type>falcon-runtime.properties</config-type>
-      </configuration-dependencies>
-
-      <excluded-config-types>
-        <config-type>oozie-site</config-type>
-      </excluded-config-types>
-
+      <extends>common-services/FALCON/0.5.0.2.1</extends>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon.py b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon.py
deleted file mode 100644
index a903e5c..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon.py
+++ /dev/null
@@ -1,124 +0,0 @@
-"""
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-"""
-
-from resource_management import *
-import os.path
-
-def falcon(type, action = None):
-  import params
-  if action == 'config':
-    Directory(params.falcon_pid_dir,
-              owner=params.falcon_user
-    )
-    Directory(params.falcon_log_dir,
-              owner=params.falcon_user,
-              recursive=True
-    )
-    Directory(params.falcon_webapp_dir,
-              owner=params.falcon_user
-    )
-    Directory(params.falcon_home,
-              owner=params.falcon_user
-    )
-    Directory(params.falcon_conf_dir_prefix,
-              mode=0755
-    )
-    Directory(params.falcon_conf_dir,
-              owner=params.falcon_user,
-              recursive=True
-    )
-    File(params.falcon_conf_dir + '/falcon-env.sh',
-         content=InlineTemplate(params.falcon_env_sh_template),
-         owner=params.falcon_user
-    )
-    File(params.falcon_conf_dir + '/client.properties',
-         content=Template('client.properties.j2'),
-         mode=0644,
-         owner=params.falcon_user
-    )
-    PropertiesFile(params.falcon_conf_dir + '/runtime.properties',
-                   properties=params.falcon_runtime_properties,
-                   mode=0644,
-                   owner=params.falcon_user
-    )
-    PropertiesFile(params.falcon_conf_dir + '/startup.properties',
-                   properties=params.falcon_startup_properties,
-                   mode=0644,
-                   owner=params.falcon_user
-    )
-
-    if params.falcon_graph_storage_directory:
-      Directory(params.falcon_graph_storage_directory,
-                owner=params.falcon_user,
-                group=params.user_group,
-                mode=0775,
-                recursive=True,
-                recursive_permission=True
-      )
-
-    if params.falcon_graph_serialize_path:
-      Directory(params.falcon_graph_serialize_path,
-                owner=params.falcon_user,
-                group=params.user_group,
-                mode=0775,
-                recursive=True,
-                recursive_permission=True
-      )
-
-  if type == 'server':
-    if action == 'config':
-      if params.store_uri[0:4] == "hdfs":
-        params.HdfsDirectory(params.store_uri,
-                             action="create_delayed",
-                             owner=params.falcon_user,
-                             mode=0755
-        )
-      params.HdfsDirectory(params.flacon_apps_dir,
-                           action="create_delayed",
-                           owner=params.falcon_user,
-                           mode=0777#TODO change to proper mode
-      )
-      params.HdfsDirectory(None, action="create")
-      Directory(params.falcon_local_dir,
-                owner=params.falcon_user,
-                recursive=True,
-                recursive_permission=True
-      )
-      if params.falcon_embeddedmq_enabled == True:
-        Directory(os.path.abspath(os.path.join(params.falcon_embeddedmq_data, "..")),
-                  owner=params.falcon_user
-        )
-        Directory(params.falcon_embeddedmq_data,
-                  owner=params.falcon_user,
-                  recursive=True
-        )
-
-    if action == 'start':
-      Execute(format('{falcon_home}/bin/falcon-start -port {falcon_port}'),
-              user=params.falcon_user,
-              path=params.hadoop_bin_dir
-      )
-    if action == 'stop':
-      Execute(format('{falcon_home}/bin/falcon-stop'),
-              user=params.falcon_user,
-              path=params.hadoop_bin_dir
-      )
-      File(params.server_pid_file,
-           action='delete'
-      )

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab3dbc8/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon_client.py b/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon_client.py
deleted file mode 100644
index fd8c005..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/FALCON/package/scripts/falcon_client.py
+++ /dev/null
@@ -1,38 +0,0 @@
-"""
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-"""
-
-from resource_management import *
-from falcon import falcon
-
-class FalconClient(Script):
-  def install(self, env):
-    self.install_packages(env)
-    self.configure(env)
-
-  def configure(self, env):
-    import params
-
-    env.set_params(params)
-    falcon('client', action='config')
-
-  def status(self, env):
-    raise ClientComponentHasNoStatus()
-
-if __name__ == "__main__":
-  FalconClient().execute()