Repository: ambari
Updated Branches:
  refs/heads/trunk 8073405a4 -> 391cc7a6f


AMBARI-10224: [WinTP2] Merge HDPWIN ZOOKEEPER package scripts to common 
services (jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e4686db5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e4686db5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e4686db5

Branch: refs/heads/trunk
Commit: e4686db52f7bc624634f67524c961cfee89296bc
Parents: 8073405
Author: Jayush Luniya <jlun...@hortonworks.com>
Authored: Fri Mar 27 08:49:55 2015 -0700
Committer: Jayush Luniya <jlun...@hortonworks.com>
Committed: Fri Mar 27 08:49:55 2015 -0700

----------------------------------------------------------------------
 .../3.4.5.2.0/package/scripts/params.py         | 79 +---------------
 .../3.4.5.2.0/package/scripts/params_linux.py   | 98 ++++++++++++++++++++
 .../3.4.5.2.0/package/scripts/params_windows.py | 61 ++++++++++++
 .../3.4.5.2.0/package/scripts/service_check.py  | 16 ++++
 .../3.4.5.2.0/package/scripts/status_params.py  | 22 +++--
 .../3.4.5.2.0/package/scripts/zookeeper.py      | 53 ++++++++---
 .../package/scripts/zookeeper_client.py         | 45 +++++----
 .../package/scripts/zookeeper_server.py         | 53 +++++++----
 .../package/scripts/zookeeper_service.py        | 11 +++
 .../ZOOKEEPER/package/scripts/params.py         | 59 ------------
 .../ZOOKEEPER/package/scripts/service_check.py  | 34 -------
 .../package/scripts/service_mapping.py          | 22 -----
 .../ZOOKEEPER/package/scripts/zookeeper.py      | 63 -------------
 .../package/scripts/zookeeper_client.py         | 43 ---------
 .../package/scripts/zookeeper_server.py         | 51 ----------
 .../package/templates/configuration.xsl.j2      | 42 ---------
 .../ZOOKEEPER/package/templates/zoo.cfg.j2      | 69 --------------
 .../2.0.6/ZOOKEEPER/test_zookeeper_client.py    |  8 +-
 .../2.0.6/ZOOKEEPER/test_zookeeper_server.py    |  7 ++
 .../src/test/python/stacks/utils/RMFTestCase.py |  6 ++
 20 files changed, 329 insertions(+), 513 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params.py
index 4d48399..fbefec9 100644
--- 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params.py
@@ -18,81 +18,10 @@ limitations under the License.
 Ambari Agent
 
 """
+from ambari_commons import OSCheck
 
-from resource_management.libraries.functions.version import 
format_hdp_stack_version, compare_versions
-from resource_management.libraries.functions.default import default
-from resource_management import *
-import status_params
-
-# server configurations
-config = Script.get_config()
-tmp_dir = Script.get_tmp_dir()
-
-stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
-hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
-
-stack_name = default("/hostLevelParams/stack_name", None)
-
-# New Cluster Stack Version that is defined during the RESTART of a Rolling 
Upgrade
-version = default("/commandParams/version", None)
-
-#hadoop params
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
-  role_root = "zookeeper-client"
-  command_role = default("/role", "")
-
-  if command_role == "ZOOKEEPER_SERVER":
-    role_root = "zookeeper-server"
-
-  zk_home = format("/usr/hdp/current/{role_root}")
-  zk_bin = format("/usr/hdp/current/{role_root}/bin")
-  zk_cli_shell = format("/usr/hdp/current/{role_root}/bin/zkCli.sh")
+if OSCheck.is_windows_family():
+  from params_windows import *
 else:
-  zk_home = "/usr"
-  zk_bin = "/usr/lib/zookeeper/bin"
-  zk_cli_shell = "/usr/lib/zookeeper/bin/zkCli.sh"
-
-
-config_dir = "/etc/zookeeper/conf"
-zk_user =  config['configurations']['zookeeper-env']['zk_user']
-hostname = config['hostname']
-user_group = config['configurations']['cluster-env']['user_group']
-zk_env_sh_template = config['configurations']['zookeeper-env']['content']
-
-zk_log_dir = config['configurations']['zookeeper-env']['zk_log_dir']
-zk_data_dir = config['configurations']['zoo.cfg']['dataDir']
-zk_pid_dir = status_params.zk_pid_dir
-zk_pid_file = status_params.zk_pid_file
-zk_server_heapsize = "-Xmx1024m"
+  from params_linux import *
 
-client_port = default('/configurations/zoo.cfg/clientPort', None)
-
-if 'zoo.cfg' in config['configurations']:
-  zoo_cfg_properties_map = config['configurations']['zoo.cfg']
-else:
-  zoo_cfg_properties_map = {}
-zoo_cfg_properties_map_length = len(zoo_cfg_properties_map)
-
-zk_principal_name = 
default("/configurations/zookeeper-env/zookeeper_principal_name", 
"zookee...@example.com")
-zk_principal = zk_principal_name.replace('_HOST',hostname.lower())
-
-java64_home = config['hostLevelParams']['java_home']
-
-zookeeper_hosts = config['clusterHostInfo']['zookeeper_hosts']
-zookeeper_hosts.sort()
-
-zk_keytab_path = 
config['configurations']['zookeeper-env']['zookeeper_keytab_path']
-zk_server_jaas_file = format("{config_dir}/zookeeper_jaas.conf")
-zk_client_jaas_file = format("{config_dir}/zookeeper_client_jaas.conf")
-security_enabled = config['configurations']['cluster-env']['security_enabled']
-
-smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
-smokeuser = config['configurations']['cluster-env']['smokeuser']
-smokeuser_principal = 
config['configurations']['cluster-env']['smokeuser_principal_name']
-kinit_path_local = functions.get_kinit_path()
-
-#log4j.properties
-if (('zookeeper-log4j' in config['configurations']) and ('content' in 
config['configurations']['zookeeper-log4j'])):
-  log4j_props = config['configurations']['zookeeper-log4j']['content']
-else:
-  log4j_props = None

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
new file mode 100644
index 0000000..5d3d9d1
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
@@ -0,0 +1,98 @@
+"""
+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.libraries.functions.version import 
format_hdp_stack_version, compare_versions
+from resource_management.libraries.functions.default import default
+from resource_management import *
+import status_params
+
+# server configurations
+config = Script.get_config()
+tmp_dir = Script.get_tmp_dir()
+
+stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
+hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
+
+stack_name = default("/hostLevelParams/stack_name", None)
+
+# New Cluster Stack Version that is defined during the RESTART of a Rolling 
Upgrade
+version = default("/commandParams/version", None)
+
+#hadoop params
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
+  role_root = "zookeeper-client"
+  command_role = default("/role", "")
+
+  if command_role == "ZOOKEEPER_SERVER":
+    role_root = "zookeeper-server"
+
+  zk_home = format("/usr/hdp/current/{role_root}")
+  zk_bin = format("/usr/hdp/current/{role_root}/bin")
+  zk_cli_shell = format("/usr/hdp/current/{role_root}/bin/zkCli.sh")
+else:
+  zk_home = "/usr"
+  zk_bin = "/usr/lib/zookeeper/bin"
+  zk_cli_shell = "/usr/lib/zookeeper/bin/zkCli.sh"
+
+
+config_dir = "/etc/zookeeper/conf"
+zk_user =  config['configurations']['zookeeper-env']['zk_user']
+hostname = config['hostname']
+user_group = config['configurations']['cluster-env']['user_group']
+zk_env_sh_template = config['configurations']['zookeeper-env']['content']
+
+zk_log_dir = config['configurations']['zookeeper-env']['zk_log_dir']
+zk_data_dir = config['configurations']['zoo.cfg']['dataDir']
+zk_pid_dir = status_params.zk_pid_dir
+zk_pid_file = status_params.zk_pid_file
+zk_server_heapsize = "-Xmx1024m"
+
+client_port = default('/configurations/zoo.cfg/clientPort', None)
+
+if 'zoo.cfg' in config['configurations']:
+  zoo_cfg_properties_map = config['configurations']['zoo.cfg']
+else:
+  zoo_cfg_properties_map = {}
+zoo_cfg_properties_map_length = len(zoo_cfg_properties_map)
+
+zk_principal_name = 
default("/configurations/zookeeper-env/zookeeper_principal_name", 
"zookee...@example.com")
+zk_principal = zk_principal_name.replace('_HOST',hostname.lower())
+
+java64_home = config['hostLevelParams']['java_home']
+
+zookeeper_hosts = config['clusterHostInfo']['zookeeper_hosts']
+zookeeper_hosts.sort()
+
+zk_keytab_path = 
config['configurations']['zookeeper-env']['zookeeper_keytab_path']
+zk_server_jaas_file = format("{config_dir}/zookeeper_jaas.conf")
+zk_client_jaas_file = format("{config_dir}/zookeeper_client_jaas.conf")
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+
+smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
+smokeuser = config['configurations']['cluster-env']['smokeuser']
+smokeuser_principal = 
config['configurations']['cluster-env']['smokeuser_principal_name']
+kinit_path_local = functions.get_kinit_path()
+
+#log4j.properties
+if (('zookeeper-log4j' in config['configurations']) and ('content' in 
config['configurations']['zookeeper-log4j'])):
+  log4j_props = config['configurations']['zookeeper-log4j']['content']
+else:
+  log4j_props = None
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_windows.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_windows.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_windows.py
new file mode 100644
index 0000000..c7302a5
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_windows.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 ambari_commons.str_utils import ensure_double_backslashes
+from resource_management import *
+import status_params
+
+# server configurations
+config = Script.get_config()
+
+# notused zookeeper_home_dir = os.environ["ZOOKEEPER_HOME"]
+config_dir = os.environ["ZOOKEEPER_CONF_DIR"]
+hdp_root = os.environ["HADOOP_NODE_INSTALL_ROOT"]
+zk_user = "hadoop"
+
+# notused zk_log_dir = config['configurations']['zookeeper-env']['zk_log_dir']
+zk_data_dir = 
ensure_double_backslashes(config['configurations']['zoo.cfg']['dataDir'])
+tickTime = config['configurations']['zoo.cfg']['tickTime']
+initLimit = config['configurations']['zoo.cfg']['initLimit']
+syncLimit = config['configurations']['zoo.cfg']['syncLimit']
+clientPort = config['configurations']['zoo.cfg']['clientPort']
+
+if 'zoo.cfg' in config['configurations']:
+  zoo_cfg_properties_map = config['configurations']['zoo.cfg'].copy()
+  # Fix the data dir - ZK won't start unless the backslashes are doubled
+  zoo_cfg_properties_map['dataDir'] = zk_data_dir
+else:
+  zoo_cfg_properties_map = {}
+zoo_cfg_properties_map_length = len(zoo_cfg_properties_map)
+
+zookeeper_hosts = config['clusterHostInfo']['zookeeper_hosts']
+zookeeper_hosts.sort()
+hostname = config['hostname']
+
+_authentication = 
config['configurations']['core-site']['hadoop.security.authentication']
+security_enabled = ( not is_empty(_authentication) and _authentication == 
'kerberos')
+user_group = None
+zookeeper_win_service_name = status_params.zookeeper_win_service_name
+
+#log4j.properties
+if (('zookeeper-log4j' in config['configurations']) and ('content' in 
config['configurations']['zookeeper-log4j'])):
+  log4j_props = config['configurations']['zookeeper-log4j']['content']
+else:
+  log4j_props = None
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/service_check.py
index 4b3f8d4..6ffe5f5 100644
--- 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/service_check.py
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/service_check.py
@@ -20,8 +20,14 @@ Ambari Agent
 """
 
 from resource_management import *
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
 class ZookeeperServiceCheck(Script):
+  pass
+
+@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
+class ZookeeperServiceCheckLinux(ZookeeperServiceCheck):
   def service_check(self, env):
     import params
     env.set_params(params)
@@ -49,5 +55,15 @@ class ZookeeperServiceCheck(Script):
             logoutput=True
     )
 
+@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
+class ZookeeperServiceCheckWindows(ZookeeperServiceCheck):
+  def service_check(self, env):
+    import params
+    env.set_params(params)
+
+    smoke_cmd = os.path.join(params.hdp_root,"Run-SmokeTests.cmd")
+    service = "Zookeeper"
+    Execute(format("cmd /C {smoke_cmd} {service}"), logoutput=True)
+
 if __name__ == "__main__":
   ZookeeperServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/status_params.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/status_params.py
index 55d0a30..5b2c953 100644
--- 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/status_params.py
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/status_params.py
@@ -19,16 +19,20 @@ limitations under the License.
 """
 
 from resource_management import *
+from ambari_commons import OSCheck
 
 config = Script.get_config()
 
-zk_pid_dir = config['configurations']['zookeeper-env']['zk_pid_dir']
-zk_pid_file = format("{zk_pid_dir}/zookeeper_server.pid")
+if OSCheck.is_windows_family():
+  zookeeper_win_service_name = "zkServer"
+else:
+  zk_pid_dir = config['configurations']['zookeeper-env']['zk_pid_dir']
+  zk_pid_file = format("{zk_pid_dir}/zookeeper_server.pid")
 
-# Security related/required params
-hostname = config['hostname']
-security_enabled = config['configurations']['cluster-env']['security_enabled']
-kinit_path_local = functions.get_kinit_path()
-tmp_dir = Script.get_tmp_dir()
-config_dir = "/etc/zookeeper/conf"
-zk_user =  config['configurations']['zookeeper-env']['zk_user']
+  # Security related/required params
+  hostname = config['hostname']
+  security_enabled = 
config['configurations']['cluster-env']['security_enabled']
+  kinit_path_local = functions.get_kinit_path()
+  tmp_dir = Script.get_tmp_dir()
+  config_dir = "/etc/zookeeper/conf"
+  zk_user =  config['configurations']['zookeeper-env']['zk_user']

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
index aa1c891..4bd94bc 100644
--- 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
@@ -22,8 +22,10 @@ import os
 
 from resource_management import *
 import sys
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
-
+@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
 def zookeeper(type = None):
   import params
 
@@ -33,7 +35,7 @@ def zookeeper(type = None):
             group=params.user_group
   )
 
-  File(format("{config_dir}/zookeeper-env.sh"),
+  File(os.path.join(params.config_dir, "zookeeper-env.sh"),
        content=InlineTemplate(params.zk_env_sh_template),
        owner=params.zk_user,
        group=params.user_group
@@ -65,20 +67,20 @@ def zookeeper(type = None):
   if type == 'server':
     myid = str(sorted(params.zookeeper_hosts).index(params.hostname) + 1)
 
-    File(format("{zk_data_dir}/myid"),
+    File(os.path.join(params.zk_data_dir, "myid"),
          mode = 0644,
          content = myid
     )
 
   if (params.log4j_props != None):
-    File(format("{params.config_dir}/log4j.properties"),
+    File(os.path.join(params.config_dir, "log4j.properties"),
          mode=0644,
          group=params.user_group,
          owner=params.zk_user,
          content=params.log4j_props
     )
-  elif (os.path.exists(format("{params.config_dir}/log4j.properties"))):
-    File(format("{params.config_dir}/log4j.properties"),
+  elif (os.path.exists(os.path.join(params.config_dir, "log4j.properties"))):
+    File(os.path.join(params.config_dir, "log4j.properties"),
          mode=0644,
          group=params.user_group,
          owner=params.zk_user
@@ -91,21 +93,50 @@ def zookeeper(type = None):
     else:
       configFile("zookeeper_client_jaas.conf", 
template_name="zookeeper_client_jaas.conf.j2")
 
-  File(format("{config_dir}/zoo_sample.cfg"),
+  File(os.path.join(params.config_dir, "zoo_sample.cfg"),
        owner=params.zk_user,
        group=params.user_group
   )
 
+@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+def zookeeper(type = None):
+  import params
+  configFile("zoo.cfg", template_name="zoo.cfg.j2", mode="f")
+  configFile("configuration.xsl", template_name="configuration.xsl.j2", 
mode="f")
+
+  Directory(params.zk_data_dir,
+            owner=params.zk_user,
+            mode="(OI)(CI)F",
+            recursive=True
+  )
+  if (params.log4j_props != None):
+    File(os.path.join(params.config_dir, "log4j.properties"),
+         mode="f",
+         owner=params.zk_user,
+         content=params.log4j_props
+    )
+  elif (os.path.exists(os.path.join(params.config_dir, "log4j.properties"))):
+    File(os.path.join(params.config_dir, "log4j.properties"),
+         mode="f",
+         owner=params.zk_user
+    )
+  if type == 'server':
+    myid = str(sorted(params.zookeeper_hosts).index(params.hostname) + 1)
+    File(os.path.join(params.zk_data_dir, "myid"),
+         owner=params.zk_user,
+         mode = "f",
+         content = myid
+    )
 
-def configFile(name, template_name=None):
+def configFile(name, template_name=None, mode=None):
   import params
 
-  File(format("{config_dir}/{name}"),
+  File(os.path.join(params.config_dir, name),
        content=Template(template_name),
        owner=params.zk_user,
-       group=params.user_group
+       group=params.user_group,
+       mode=mode
   )
 
 
 
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
index dcaaab6..92264ab 100644
--- 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
@@ -23,31 +23,17 @@ import sys
 from resource_management import *
 from resource_management.libraries.functions.version import compare_versions, 
format_hdp_stack_version
 from resource_management.libraries.functions.format import format
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
 from zookeeper import zookeeper
 
 class ZookeeperClient(Script):
-
-  def get_stack_to_component(self):
-    return {"HDP": "zookeeper-client"}
-
-  def install(self, env):
-    self.install_packages(env)
-    self.configure(env)
-
   def configure(self, env):
     import params
     env.set_params(params)
-
     zookeeper(type='client')
-
-  def pre_rolling_restart(self, env):
-    Logger.info("Executing Rolling Upgrade pre-restart")
-    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 zookeeper-client {version}"))
+    pass
 
   def start(self, env, rolling_restart=False):
     import params
@@ -63,5 +49,30 @@ class ZookeeperClient(Script):
   def status(self, env):
     raise ClientComponentHasNoStatus()
 
+@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
+class ZookeeperClientLinux(ZookeeperClient):
+  def get_stack_to_component(self):
+    return {"HDP": "zookeeper-client"}
+
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def pre_rolling_restart(self, env):
+    Logger.info("Executing Rolling Upgrade pre-restart")
+    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 zookeeper-client {version}"))
+
+@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
+class ZookeeperClientWindows(ZookeeperClient):
+  def install(self, env):
+    # client checks env var to determine if it is installed
+    if not os.environ.has_key("ZOOKEEPER_HOME"):
+      self.install_packages(env)
+    self.configure(env)
+
 if __name__ == "__main__":
   ZookeeperClient().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
index 72a8f0b..b2946f4 100644
--- 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
@@ -19,6 +19,7 @@ Ambari Agent
 
 """
 import random
+import sys
 
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.functions import get_unique_id_and_date
@@ -34,10 +35,31 @@ from resource_management.libraries.functions.format import 
format
 from resource_management.libraries.functions.validate import 
call_and_match_output
 from zookeeper import zookeeper
 from zookeeper_service import zookeeper_service
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyImpl
 
 
 class ZookeeperServer(Script):
 
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    zookeeper(type='server')
+
+  def start(self, env, rolling_restart=False):
+    import params
+    env.set_params(params)
+    self.configure(env)
+    zookeeper_service(action = 'start')
+
+  def stop(self, env, rolling_restart=False):
+    import params
+    env.set_params(params)
+    zookeeper_service(action = 'stop')
+
+@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
+class ZookeeperServerLinux(ZookeeperServer):
+
   def get_stack_to_component(self):
     return {"HDP": "zookeeper-server"}
 
@@ -45,11 +67,6 @@ class ZookeeperServer(Script):
     self.install_packages(env)
     self.configure(env)
 
-  def configure(self, env):
-    import params
-    env.set_params(params)
-    zookeeper(type='server')
-
   def pre_rolling_restart(self, env):
     Logger.info("Executing Rolling Upgrade pre-restart")
     import params
@@ -58,12 +75,6 @@ class ZookeeperServer(Script):
     if params.version and 
compare_versions(format_hdp_stack_version(params.version), '2.2.0.0') >= 0:
       Execute(format("hdp-select set zookeeper-server {version}"))
 
-  def start(self, env, rolling_restart=False):
-    import params
-    env.set_params(params)
-    self.configure(env)
-    zookeeper_service(action = 'start')
-
   def post_rolling_restart(self, env):
     Logger.info("Executing Rolling Upgrade post-restart")
     import params
@@ -87,11 +98,6 @@ class ZookeeperServer(Script):
       if code == 0 and out:
         Logger.info(out)
 
-  def stop(self, env, rolling_restart=False):
-    import params
-    env.set_params(params)
-    zookeeper_service(action = 'stop')
-
   def status(self, env):
     import status_params
     env.set_params(status_params)
@@ -99,7 +105,6 @@ class ZookeeperServer(Script):
 
   def security_status(self, env):
     import status_params
-
     env.set_params(status_params)
 
     if status_params.security_enabled:
@@ -150,5 +155,19 @@ class ZookeeperServer(Script):
       self.put_structured_out({"securityState": "UNSECURED"})
 
 
+@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
+class ZookeeperServerWindows(ZookeeperServer):
+  def install(self, env):
+    from resource_management.libraries.functions.windows_service_utils import 
check_windows_service_exists
+    import params
+    if not check_windows_service_exists(params.zookeeper_win_service_name):
+      self.install_packages(env)
+    self.configure(env)
+
+  def status(self, env):
+    from resource_management.libraries.functions.windows_service_utils import 
check_windows_service_status
+    import status_params
+    check_windows_service_status(status_params.zookeeper_win_service_name)
+
 if __name__ == "__main__":
   ZookeeperServer().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_service.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_service.py
 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_service.py
index 2be70cc..59ad417 100644
--- 
a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_service.py
+++ 
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_service.py
@@ -20,7 +20,10 @@ Ambari Agent
 """
 
 from resource_management import *
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
+@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
 def zookeeper_service(action='start'):
   import params
 
@@ -48,3 +51,11 @@ def zookeeper_service(action='start'):
             user=params.zk_user
     )
     Execute(rm_pid)
+
+@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+def zookeeper_service(action='start'):
+  import params
+  if action == 'start':
+    Service(params.zookeeper_win_service_name, action="start")
+  elif action == 'stop':
+    Service(params.zookeeper_win_service_name, action="stop")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/params.py
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/params.py
deleted file mode 100644
index de5b9bb..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/params.py
+++ /dev/null
@@ -1,59 +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.
-
-Ambari Agent
-
-"""
-from ambari_commons.str_utils import ensure_double_backslashes
-
-from resource_management import *
-
-# server configurations
-config = Script.get_config()
-
-# notused zookeeper_home_dir = os.environ["ZOOKEEPER_HOME"]
-zookeeper_conf_dir = os.environ["ZOOKEEPER_CONF_DIR"]
-hdp_root = os.environ["HADOOP_NODE_INSTALL_ROOT"]
-zk_user = "hadoop"
-
-# notused zk_log_dir = config['configurations']['zookeeper-env']['zk_log_dir']
-zk_data_dir = 
ensure_double_backslashes(config['configurations']['zoo.cfg']['dataDir'])
-tickTime = config['configurations']['zoo.cfg']['tickTime']
-initLimit = config['configurations']['zoo.cfg']['initLimit']
-syncLimit = config['configurations']['zoo.cfg']['syncLimit']
-clientPort = config['configurations']['zoo.cfg']['clientPort']
-
-if 'zoo.cfg' in config['configurations']:
-  zoo_cfg_properties_map = config['configurations']['zoo.cfg'].copy()
-  # Fix the data dir - ZK won't start unless the backslashes are doubled
-  zoo_cfg_properties_map['dataDir'] = zk_data_dir
-else:
-  zoo_cfg_properties_map = {}
-zoo_cfg_properties_map_length = len(zoo_cfg_properties_map)
-
-zookeeper_hosts = config['clusterHostInfo']['zookeeper_hosts']
-zookeeper_hosts.sort()
-hostname = config['hostname']
-
-_authentication = 
config['configurations']['core-site']['hadoop.security.authentication']
-security_enabled = ( not is_empty(_authentication) and _authentication == 
'kerberos')
-
-#log4j.properties
-if (('zookeeper-log4j' in config['configurations']) and ('content' in 
config['configurations']['zookeeper-log4j'])):
-  log4j_props = config['configurations']['zookeeper-log4j']['content']
-else:
-  log4j_props = None

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_check.py
deleted file mode 100644
index 4cff7c9..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_check.py
+++ /dev/null
@@ -1,34 +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.
-
-Ambari Agent
-
-"""
-
-from resource_management import *
-
-class ZookeeperServiceCheck(Script):
-  def service_check(self, env):
-    import params
-    env.set_params(params)
-
-    smoke_cmd = os.path.join(params.hdp_root,"Run-SmokeTests.cmd")
-    service = "Zookeeper"
-    Execute(format("cmd /C {smoke_cmd} {service}"), logoutput=True)
-
-if __name__ == "__main__":
-  ZookeeperServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_mapping.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_mapping.py
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_mapping.py
deleted file mode 100644
index 5fc6da2..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/service_mapping.py
+++ /dev/null
@@ -1,22 +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.
-
-Ambari Agent
-
-"""
-
-zookeeper_win_service_name = "zkServer"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper.py
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper.py
deleted file mode 100644
index 2cacd57..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper.py
+++ /dev/null
@@ -1,63 +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.
-
-Ambari Agent
-
-"""
-import os
-
-from resource_management import *
-import sys
-
-
-def zookeeper(type = None):
-  import params
-  configFile("zoo.cfg", template_name="zoo.cfg.j2")
-  configFile("configuration.xsl", template_name="configuration.xsl.j2")
-
-  Directory(params.zk_data_dir,
-            owner=params.zk_user,
-            mode="(OI)(CI)F",
-            recursive=True
-  )
-  if (params.log4j_props != None):
-    File(os.path.join(params.zookeeper_conf_dir, "log4j.properties"),
-         mode="f",
-         owner=params.zk_user,
-         content=params.log4j_props
-    )
-  elif (os.path.exists(os.path.join(params.zookeeper_conf_dir, 
"log4j.properties"))):
-    File(format("{params.zookeeper_conf_dir}/log4j.properties"),
-         mode="f",
-         owner=params.zk_user
-    )
-  if type == 'server':
-    myid = str(sorted(params.zookeeper_hosts).index(params.hostname) + 1)
-    File(format("{zk_data_dir}/myid"),
-         owner=params.zk_user,
-         mode = "f",
-         content = myid
-    )
-
-def configFile(name, template_name=None):
-  import params
-
-  File(os.path.join(params.zookeeper_conf_dir, name),
-       content=Template(template_name),
-       owner=params.zk_user,
-       mode="f"
-  )

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_client.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_client.py
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_client.py
deleted file mode 100644
index 663766f..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_client.py
+++ /dev/null
@@ -1,43 +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.
-
-Ambari Agent
-
-"""
-
-import sys
-from resource_management import *
-from zookeeper import zookeeper
-import os
-
-class ZookeeperClient(Script):
-  def install(self, env):
-    # client checks env var to determine if it is installed
-    if not os.environ.has_key("ZOOKEEPER_HOME"):
-      self.install_packages(env)
-    self.configure(env)
-
-  def configure(self, env):
-    import params
-    env.set_params(params)
-    zookeeper(type='client')
-
-  def status(self, env):
-    raise ClientComponentHasNoStatus()
-
-if __name__ == "__main__":
-  ZookeeperClient().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_server.py
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_server.py
deleted file mode 100644
index d2ad45d..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/scripts/zookeeper_server.py
+++ /dev/null
@@ -1,51 +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.
-
-Ambari Agent
-
-"""
-
-import sys
-from resource_management import *
-from zookeeper import zookeeper
-import service_mapping
-
-class ZookeeperServer(Script):
-  def install(self, env):
-    if not 
check_windows_service_exists(service_mapping.zookeeper_win_service_name):
-      self.install_packages(env)
-    self.configure(env)
-
-  def configure(self, env):
-    import params
-    env.set_params(params)
-    zookeeper(type='server')
-
-  def start(self, env):
-    import params
-    self.configure(env)
-    Service(service_mapping.zookeeper_win_service_name, action="start")
-
-  def stop(self, env):
-    import params
-    Service(service_mapping.zookeeper_win_service_name, action="stop")
-
-  def status(self, env):
-    check_windows_service_status(service_mapping.zookeeper_win_service_name)
-
-if __name__ == "__main__":
-  ZookeeperServer().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/configuration.xsl.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/configuration.xsl.j2
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/configuration.xsl.j2
deleted file mode 100644
index 8830c45..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/configuration.xsl.j2
+++ /dev/null
@@ -1,42 +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.
-#}
-
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
-<xsl:output method="html"/>
-<xsl:template match="configuration">
-<html>
-<body>
-<table border="1">
-<tr>
- <td>name</td>
- <td>value</td>
- <td>description</td>
-</tr>
-<xsl:for-each select="property">
-  <tr>
-     <td><a name="{name}"><xsl:value-of select="name"/></a></td>
-     <td><xsl:value-of select="value"/></td>
-     <td><xsl:value-of select="description"/></td>
-  </tr>
-</xsl:for-each>
-</table>
-</body>
-</html>
-</xsl:template>
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/zoo.cfg.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/zoo.cfg.j2
 
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/zoo.cfg.j2
deleted file mode 100644
index beb4730..0000000
--- 
a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/package/templates/zoo.cfg.j2
+++ /dev/null
@@ -1,69 +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.
-#}
-
-#
-#
-# 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.
-#
-#
-#
-
-# The number of milliseconds of each tick
-tickTime={{tickTime}}
-# The number of ticks that the initial
-# synchronization phase can take
-initLimit={{initLimit}}
-# The number of ticks that can pass between
-# sending a request and getting an acknowledgement
-syncLimit={{syncLimit}}
-# the directory where the snapshot is stored.
-dataDir={{zk_data_dir}}
-# the port at which the clients will connect
-clientPort={{clientPort}}
-{% for host in zookeeper_hosts %}
-server.{{loop.index}}={{host}}:2888:3888
-{% endfor %}
-
-{% if security_enabled %}
-authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
-jaasLoginRenew=3600000
-kerberos.removeHostFromPrincipal=true
-kerberos.removeRealmFromPrincipal=true
-{% endif %}
-
-{% if zoo_cfg_properties_map_length > 0 %}
-# Custom properties
-{% endif %}
-{% for key, value in zoo_cfg_properties_map.iteritems() %}
-{{key}}={{value}}
-{% endfor %}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py 
b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
index 68ab79e..bebec4f 100644
--- 
a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
+++ 
b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
@@ -21,6 +21,7 @@ from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
 
 @patch("os.path.exists", new = MagicMock(return_value=True))
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 class TestZookeeperClient(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5.2.0/package"
   STACK_VERSION = "2.0.6"
@@ -48,11 +49,13 @@ class TestZookeeperClient(RMFTestCase):
       owner = 'zookeeper',
       content = Template('zoo.cfg.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('File', '/etc/zookeeper/conf/configuration.xsl',
       owner = 'zookeeper',
       content = Template('configuration.xsl.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('Directory', '/var/run/zookeeper',
       owner = 'zookeeper',
@@ -106,11 +109,13 @@ class TestZookeeperClient(RMFTestCase):
       owner = 'zookeeper',
       content = Template('zoo.cfg.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('File', '/etc/zookeeper/conf/configuration.xsl',
       owner = 'zookeeper',
       content = Template('configuration.xsl.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('Directory', '/var/run/zookeeper',
       owner = 'zookeeper',
@@ -139,9 +144,10 @@ class TestZookeeperClient(RMFTestCase):
       owner = 'zookeeper',
       content = Template('zookeeper_client_jaas.conf.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('File', '/etc/zookeeper/conf/zoo_sample.cfg',
       owner = 'zookeeper',
       group = 'hadoop',
     )
-    self.assertNoMoreResources()
\ No newline at end of file
+    self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py 
b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
index 4b9721a..61b3f40 100644
--- 
a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
+++ 
b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
@@ -21,6 +21,7 @@ from mock.mock import MagicMock, patch
 from stacks.utils.RMFTestCase import *
 
 @patch("os.path.exists", new = MagicMock(return_value=True))
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 class TestZookeeperServer(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5.2.0/package"
   STACK_VERSION = "2.0.6"
@@ -127,11 +128,13 @@ class TestZookeeperServer(RMFTestCase):
       owner = 'zookeeper',
       content = Template('zoo.cfg.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('File', '/etc/zookeeper/conf/configuration.xsl',
       owner = 'zookeeper',
       content = Template('configuration.xsl.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('Directory', '/var/run/zookeeper',
       owner = 'zookeeper',
@@ -180,11 +183,13 @@ class TestZookeeperServer(RMFTestCase):
       owner = 'zookeeper',
       content = Template('zoo.cfg.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('File', '/etc/zookeeper/conf/configuration.xsl',
       owner = 'zookeeper',
       content = Template('configuration.xsl.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('Directory', '/var/run/zookeeper',
       owner = 'zookeeper',
@@ -217,11 +222,13 @@ class TestZookeeperServer(RMFTestCase):
       owner = 'zookeeper',
       content = Template('zookeeper_jaas.conf.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('File', 
'/etc/zookeeper/conf/zookeeper_client_jaas.conf',
       owner = 'zookeeper',
       content = Template('zookeeper_client_jaas.conf.j2'),
       group = 'hadoop',
+      mode = None,
     )
     self.assertResourceCalled('File', '/etc/zookeeper/conf/zoo_sample.cfg',
       owner = 'zookeeper',

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4686db5/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py 
b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
index b7e58b4..dc2d861 100644
--- a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
+++ b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
@@ -119,6 +119,12 @@ class RMFTestCase(TestCase):
     if 'params' in sys.modules:  
       del(sys.modules["params"])
 
+    if 'params_windows' in sys.modules:
+      del(sys.modules["params_windows"])
+
+    if 'params_linux' in sys.modules:
+      del(sys.modules["params_linux"])
+
     # Reload status_params import, otherwise it won't change properties during 
next import
     if 'status_params' in sys.modules:
       del(sys.modules["status_params"])

Reply via email to