Pārlūkot izejas kodu

AMBARI-9270 - Add SLIDER, KNOX service to HDPWIN 2.2

Artem Baranchuk 10 gadi atpakaļ
vecāks
revīzija
4497f00cc7
22 mainītis faili ar 541 papildinājumiem un 40 dzēšanām
  1. 5 2
      ambari-common/src/main/python/resource_management/libraries/functions/install_hdp_msi.py
  2. 37 0
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox.py
  3. 54 2
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
  4. 5 5
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/ldap.py
  5. 6 20
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params.py
  6. 47 0
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
  7. 42 0
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_windows.py
  8. 11 0
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/service_check.py
  9. 22 0
      ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/service_mapping.py
  10. 6 3
      ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params.py
  11. 30 0
      ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
  12. 34 0
      ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_windows.py
  13. 11 2
      ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/service_check.py
  14. 21 1
      ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider.py
  15. 13 4
      ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
  16. 1 1
      ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/after-INSTALL/templates/Run-SmokeTests.ps1
  17. 38 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/configuration/gateway-site.xml
  18. 48 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/configuration/knox-env.xml
  19. 29 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/configuration/ranger-knox-plugin-properties.xml
  20. 26 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/metainfo.xml
  21. 29 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/SLIDER/configurations/slider-client.xml
  22. 26 0
      ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/SLIDER/metainfo.xml

+ 5 - 2
ambari-common/src/main/python/resource_management/libraries/functions/install_hdp_msi.py

@@ -115,10 +115,13 @@ def _ensure_services_created(hadoop_password):
 
 
 # creating symlinks to services folders to avoid using stack-dependent paths
-def _create_symlinks():
+def _create_symlinks(stack_version):
   # folders
   Execute("cmd /c mklink /d %HADOOP_NODE%\\hadoop %HADOOP_HOME%")
   Execute("cmd /c mklink /d %HADOOP_NODE%\\hive %HIVE_HOME%")
+  hdp_stack_version = format_hdp_stack_version(stack_version)
+  if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
+    Execute("cmd /c mklink /d %HADOOP_NODE%\\knox %KNOX_HOME%")
   # files pairs (symlink_path, path_template_to_target_file), use * to replace file version
   links_pairs = [
     ("%HADOOP_HOME%\\share\\hadoop\\tools\\lib\\hadoop-streaming.jar",
@@ -192,7 +195,7 @@ def install_windows_msi(msi_url, save_dir, save_file, hadoop_password, stack_ver
     reload_windows_env()
     # create additional services manually due to hdp.msi limitaitons
     _ensure_services_created(hadoop_password)
-    _create_symlinks()
+    _create_symlinks(stack_version)
     # finalizing install
     _write_marker()
     _validate_msi_install()

+ 37 - 0
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox.py

@@ -17,9 +17,46 @@ limitations under the License.
 
 """
 
+import os
 from resource_management import *
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
+@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+def knox():
+  import params
+
+  XmlConfig("gateway-site.xml",
+            conf_dir=params.knox_conf_dir,
+            configurations=params.config['configurations']['gateway-site'],
+            configuration_attributes=params.config['configuration_attributes']['gateway-site'],
+            owner=params.knox_user
+  )
+
+  File(os.path.join(params.knox_conf_dir, "gateway-log4j.properties"),
+       owner=params.knox_user,
+       content=params.gateway_log4j
+  )
+
+  File(os.path.join(params.knox_conf_dir, "topologies", "default.xml"),
+       group=params.knox_group,
+       owner=params.knox_user,
+       content=InlineTemplate(params.topology_template)
+  )
+
+  if params.security_enabled:
+    TemplateConfig( os.path.join(knox_conf_dir, "krb5JAASLogin.conf"),
+        owner = params.knox_user,
+        template_tag = None
+    )
+
+  if not os.path.isfile(params.knox_master_secret_path):
+    cmd = format('cmd /C {knox_client_bin} create-master --master {knox_master_secret!p}')
+    Execute(cmd)
+    cmd = format('cmd /C {knox_client_bin} create-cert --hostname {knox_host_name_in_cluster}')
+    Execute(cmd)
 
+@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
 def knox():
     import params
 

+ 54 - 2
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py

@@ -23,16 +23,21 @@ from resource_management.libraries.functions.security_commons import build_expec
   FILE_TYPE_XML
 import sys
 import upgrade
-
+import os
 from knox import knox
 from ldap import ldap
 from setup_ranger_knox import setup_ranger_knox
+import service_mapping
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
 class KnoxGateway(Script):
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def get_stack_to_component(self):
     return {"HDP": "knox-server"}
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def install(self, env):
     self.install_packages(env)
     import params
@@ -42,12 +47,24 @@ class KnoxGateway(Script):
          action = "delete",
     )
 
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+  def install(self, env):
+    import params
+    env.set_params(params)
+    if not check_windows_service_exists(service_mapping.knox_geteway_win_service_name):
+      self.install_packages(env)
+
+    File(os.path.join(params.knox_conf_dir, 'topologies', 'sandbox.xml'),
+         action = "delete",
+    )
+
   def configure(self, env):
     import params
     env.set_params(params)
     knox()
     ldap()
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def pre_rolling_restart(self, env):
     import params
     env.set_params(params)
@@ -56,7 +73,7 @@ class KnoxGateway(Script):
       upgrade.backup_data()
       Execute(format("hdp-select set knox-server {version}"))
 
-
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def start(self, env, rolling_restart=False):
     import params
     env.set_params(params)
@@ -70,6 +87,15 @@ class KnoxGateway(Script):
             not_if=no_op_test
     )
 
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env)
+    # setup_ranger_knox(env)
+    Service(service_mapping.knox_geteway_win_service_name, action="start")
+
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)
@@ -81,18 +107,29 @@ class KnoxGateway(Script):
     )
     Execute (format("rm -f {knox_pid_file}"))
 
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+  def stop(self, env):
+    import params
+    env.set_params(params)
+    Service(service_mapping.knox_geteway_win_service_name, action="stop")
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def status(self, env):
     import status_params
     env.set_params(status_params)
     check_process_status(status_params.knox_pid_file)
 
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+  def status(self, env):
+    import params
+    check_windows_service_status(service_mapping.knox_geteway_win_service_name)
 
   def configureldap(self, env):
     import params
     env.set_params(params)
     ldap()
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def startdemoldap(self, env):
     import params
     env.set_params(params)
@@ -105,6 +142,14 @@ class KnoxGateway(Script):
             not_if=no_op_test
     )
 
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+  def startdemoldap(self, env):
+    import params
+    env.set_params(params)
+    self.configureldap(env)
+    Service(service_mapping.knox_ldap_win_service_name, action="start")
+
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def stopdemoldap(self, env):
     import params
     env.set_params(params)
@@ -116,6 +161,13 @@ class KnoxGateway(Script):
             )
     Execute (format("rm -f {ldap_pid_file}"))
 
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+  def stopdemoldap(self, env):
+    import params
+    env.set_params(params)
+    Service(service_mapping.knox_ldap_win_service_name, action="stop")
+
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def security_status(self, env):
     import status_params
 

+ 5 - 5
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/ldap.py

@@ -17,21 +17,21 @@ limitations under the License.
 
 """
 
+import os
 from resource_management import *
 
-
 def ldap():
     import params
 
-    File(format("{params.knox_conf_dir}/ldap-log4j.properties"),
-         mode=0644,
+    File(os.path.join(params.knox_conf_dir, 'ldap-log4j.properties'),
+         mode=params.mode,
          group=params.knox_group,
          owner=params.knox_user,
          content=params.ldap_log4j
     )
 
-    File(format("{params.knox_conf_dir}/users.ldif"),
-         mode=0644,
+    File(os.path.join(params.knox_conf_dir, 'users.ldif'),
+         mode=params.mode,
          group=params.knox_group,
          owner=params.knox_user,
          content=params.users_ldif

+ 6 - 20
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params.py

@@ -23,6 +23,12 @@ from resource_management.libraries.functions.version import format_hdp_stack_ver
 from resource_management.libraries.functions.default import default
 from resource_management import *
 import status_params
+from ambari_commons import OSCheck
+
+if OSCheck.is_windows_family():
+  from params_windows import *
+else:
+  from params_linux import *
 
 config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -34,19 +40,6 @@ version = default("/commandParams/version", None)
 stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
 hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
 
-if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
-  knox_bin = '/usr/hdp/current/knox-server/bin/gateway.sh'
-  ldap_bin = '/usr/hdp/current/knox-server/bin/ldap.sh'
-  knox_client_bin = '/usr/hdp/current/knox-server/bin/knoxcli.sh'
-  knox_data_dir = '/usr/hdp/current/knox-server/data'
-  knox_conf_dir = '/usr/hdp/current/knox-server/conf'
-else:
-  knox_bin = '/usr/bin/gateway'
-  ldap_bin = '/usr/lib/knox/bin/ldap.sh'
-  knox_client_bin = '/usr/lib/knox/bin/knoxcli.sh'
-  knox_data_dir = '/usr/lib/knox/data'
-  knox_conf_dir = '/usr/lib/knox/conf'
-
 namenode_hosts = default("/clusterHostInfo/namenode_host", None)
 if type(namenode_hosts) is list:
     namenode_host = namenode_hosts[0]
@@ -117,17 +110,10 @@ if has_oozie:
 
 
 # server configurations
-knox_conf_dir = '/etc/knox/conf'
-knox_data_dir = '/var/lib/knox/data'
-knox_logs_dir = '/var/log/knox'
 knox_pid_dir = status_params.knox_pid_dir
-knox_user = default("/configurations/knox-env/knox_user", "knox")
-knox_group = default("/configurations/knox-env/knox_group", "knox")
 knox_pid_file = status_params.knox_pid_file
 ldap_pid_file = status_params.ldap_pid_file
 knox_master_secret = config['configurations']['knox-env']['knox_master_secret']
-knox_master_secret_path = '/var/lib/knox/data/security/master'
-knox_cert_store_path = '/var/lib/knox/data/security/keystores/gateway.jks'
 knox_host_name = config['clusterHostInfo']['knox_gateway_hosts'][0]
 knox_host_name_in_cluster = config['hostname']
 knox_host_port = config['configurations']['gateway-site']['gateway.port']

+ 47 - 0
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py

@@ -0,0 +1,47 @@
+"""
+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.libraries.functions.default import default
+from resource_management import *
+from ambari_commons import OSCheck
+
+# server configurations
+config = Script.get_config()
+
+knox_master_secret_path = '/var/lib/knox/data/security/master'
+knox_cert_store_path = '/var/lib/knox/data/security/keystores/gateway.jks'
+
+knox_user = default("/configurations/knox-env/knox_user", "knox")
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
+  knox_bin = '/usr/hdp/current/knox-server/bin/gateway.sh'
+  ldap_bin = '/usr/hdp/current/knox-server/bin/ldap.sh'
+  knox_client_bin = '/usr/hdp/current/knox-server/bin/knoxcli.sh'
+else:
+  knox_bin = '/usr/bin/gateway'
+  ldap_bin = '/usr/lib/knox/bin/ldap.sh'
+  knox_client_bin = '/usr/lib/knox/bin/knoxcli.sh'
+
+knox_group = default("/configurations/knox-env/knox_group", "knox")
+mode = 0644
+
+# server configurations
+knox_conf_dir = '/etc/knox/conf'
+knox_data_dir = '/var/lib/knox/data'
+knox_logs_dir = '/var/log/knox'

+ 42 - 0
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_windows.py

@@ -0,0 +1,42 @@
+#!/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 *
+import os
+
+# server configurations
+config = Script.get_config()
+
+hdp_root = os.path.abspath(os.path.join(os.environ["HADOOP_HOME"],".."))
+knox_home = os.environ['KNOX_HOME']
+knox_conf_dir = os.environ['KNOX_CONF_DIR']
+knox_logs_dir = os.environ['KNOX_LOG_DIR']
+knox_bin = os.path.join(knox_home, 'bin', 'gateway.exe')
+ldap_bin = os.path.join(knox_home, 'bin', 'ldap.exe')
+knox_client_bin = os.path.join(knox_home, 'bin', 'knoxcli.cmd')
+knox_data_dir = os.path.join(knox_home, 'data')
+
+knox_master_secret_path = os.path.join(knox_data_dir, 'security', 'master')
+knox_cert_store_path = os.path.join(knox_data_dir, 'security', 'keystores', 'gateway.jks')
+
+knox_user = 'hadoop'
+hdfs_user = "hadoop"
+knox_group = None
+mode = None

+ 11 - 0
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/service_check.py

@@ -20,9 +20,20 @@ limitations under the License.
 
 from resource_management import *
 import sys
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
 class KnoxServiceCheck(Script):
 
+    @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+    def service_check(self, env):
+      import params
+      env.set_params(params)
+      smoke_cmd = os.path.join(params.hdp_root, "Run-SmokeTests.cmd")
+      service = "KNOX"
+      Execute(format("cmd /C {smoke_cmd} {service}"), logoutput=True, user=params.hdfs_user)
+
+    @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
     def service_check(self, env):
         import params
         env.set_params(params)

+ 22 - 0
ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/service_mapping.py

@@ -0,0 +1,22 @@
+# !/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.
+
+"""
+
+knox_geteway_win_service_name = "gateway"
+knox_ldap_win_service_name = "ldap"

+ 6 - 3
ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params.py

@@ -21,6 +21,12 @@ limitations under the License.
 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 *
+from ambari_commons import OSCheck
+
+if OSCheck.is_windows_family():
+  from params_windows import *
+else:
+  from params_linux import *
 
 # server configurations
 config = Script.get_config()
@@ -39,7 +45,6 @@ if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
 else:
   slider_bin_dir = "/usr/lib/slider/bin"
 
-slider_conf_dir = "/etc/slider/conf"
 hadoop_conf_dir = "/etc/hadoop/conf"
 smokeuser = config['configurations']['cluster-env']['smokeuser']
 smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
@@ -51,5 +56,3 @@ slider_env_sh_template = config['configurations']['slider-env']['content']
 java64_home = config['hostLevelParams']['java_home']
 log4j_props = config['configurations']['slider-log4j']['content']
 slider_cmd = format("{slider_bin_dir}/slider")
-storm_slider_conf_dir= '/usr/hdp/current/storm-slider-client/conf'
-slider_home_dir= '/usr/hdp/current/slider-client'

+ 30 - 0
ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py

@@ -0,0 +1,30 @@
+"""
+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.libraries.functions.default import default
+from resource_management import *
+from ambari_commons import OSCheck
+
+# server configurations
+config = Script.get_config()
+
+slider_conf_dir = "/etc/slider/conf"
+storm_slider_conf_dir = '/usr/hdp/current/storm-slider-client/conf'
+slider_home_dir = '/usr/hdp/current/slider-client'

+ 34 - 0
ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_windows.py

@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management import *
+import os
+
+# server configurations
+config = Script.get_config()
+
+hdp_root = os.path.abspath(os.path.join(os.environ["HADOOP_HOME"],".."))
+slider_home = os.environ['SLIDER_HOME']
+slider_conf_dir = os.path.join(slider_home, 'conf')
+storm_slider_conf_dir = os.path.join(os.environ['STORM_HOME'], 'conf')
+slider_home_dir = slider_home
+
+slider_user = 'hadoop'
+hdfs_user = "hadoop"

+ 11 - 2
ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/service_check.py

@@ -19,14 +19,23 @@ limitations under the License.
 """
 
 from resource_management import *
-
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
 class SliderServiceCheck(Script):
+
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
   def service_check(self, env):
     import params
-
     env.set_params(params)
+    smoke_cmd = os.path.join(params.hdp_root, "Run-SmokeTests.cmd")
+    service = "SLIDER"
+    Execute(format("cmd /C {smoke_cmd} {service}"), logoutput=True, user=params.hdfs_user)
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
+  def service_check(self, env):
+    import params
+    env.set_params(params)
     smokeuser_kinit_cmd = format(
       "{kinit_path_local} -kt {smokeuser_keytab} {smokeuser_principal};") if params.security_enabled else ""
 

+ 21 - 1
ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider.py

@@ -19,10 +19,30 @@ Ambari Agent
 
 """
 import os
-
 from resource_management import *
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+
+@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+def slider():
+  import params
+
+  slider_client_config = params.config['configurations']['slider-client'] if 'configurations' in params.config and 'slider-client' in params.config['configurations'] else {}
+
+  XmlConfig("slider-client.xml",
+            conf_dir=params.slider_conf_dir,
+            configurations=slider_client_config
+  )
+
+  if (params.log4j_props != None):
+    File(os.path.join(params.slider_conf_dir, "log4j.properties"),
+         content=params.log4j_props
+    )
+  elif (os.path.exists(os.path.join(params.slider_conf_dir, "log4j.properties"))):
+    File(os.path.join(params.slider_conf_dir, "log4j.properties"))
 
 
+@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
 def slider():
   import params
 

+ 13 - 4
ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py

@@ -19,15 +19,17 @@ limitations under the License.
 """
 
 from resource_management import *
-
 from slider import slider
-
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
 class SliderClient(Script):
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def get_stack_to_component(self):
     return {"HDP": "slider-client"}
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def pre_rolling_restart(self, env):
     import params
     env.set_params(params)
@@ -40,15 +42,22 @@ class SliderClient(Script):
       # hadoop-client is also set
       Execute(format("hdp-select set hadoop-client {version}"))
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
   def install(self, env):
     self.install_packages(env)
     self.configure(env)
 
-  def configure(self, env):
+  @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+  def install(self, env):
     import params
+    if params.slider_home is None:
+      self.install_packages(env)
+    self.configure(env)
 
+  @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
+  def configure(self, env):
+    import params
     env.set_params(params)
-
     slider()
 
   def status(self, env):

+ 1 - 1
ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/after-INSTALL/templates/Run-SmokeTests.ps1

@@ -467,7 +467,7 @@ function Run-KnoxSmokeTest
         return
     }
 
-    $url = "https://${ENV:KNOX_HOST}:8443/gateway/sandbox/webhdfs/v1/?op=GETHOMEDIRECTORY"
+    $url = "https://${ENV:KNOX_HOST}:8443/gateway/default/webhdfs/v1/?op=GETHOMEDIRECTORY"
     $req = [System.Net.WebRequest]::Create( $url )
     # Set the HTTP basic auth credentials to use for the request
     $req.Credentials = New-Object Net.NetworkCredential( "guest", "guest-password" )

+ 38 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/configuration/gateway-site.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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 default settings for Knox. -->
+<!-- Edit gateway-site.xml to change settings for your local -->
+<!-- install. -->
+
+<configuration supports_final="false">
+
+    <property>
+        <name>java.security.krb5.conf</name>
+        <value>c:\hadoop\knox\conf\krb5.conf</value>
+        <description>Absolute path to krb5.conf file</description>
+    </property>
+
+    <property>
+        <name>java.security.auth.login.config</name>
+        <value>c:\hadoop\knox\conf\krb5JAASLogin.conf</value>
+        <description>Absolute path to JASS login config file</description>
+    </property>
+
+</configuration>

+ 48 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/configuration/knox-env.xml

@@ -0,0 +1,48 @@
+<?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 supports_final="false">
+    <!-- knox-env.sh -->
+
+    <property>
+        <name>knox_user</name>
+        <value>knox</value>
+        <property-type>USER</property-type>
+        <deleted>true</deleted>
+        <description>Knox Username.</description>
+    </property>
+
+    <property>
+        <name>knox_group</name>
+        <value>knox</value>
+        <property-type>GROUP</property-type>
+        <deleted>true</deleted>
+        <description>Knox Group.</description>
+    </property>
+
+    <property>
+        <name>knox_pid_dir</name>
+        <value>/var/run/knox</value>
+        <deleted>true</deleted>
+        <description>Knox PID dir.</description>
+    </property>
+</configuration>

+ 29 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/configuration/ranger-knox-plugin-properties.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * 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>KNOX_HOME</name>
+    <value>c:\hadoop\knox</value>
+    <description></description>
+  </property>
+
+</configuration>

+ 26 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/KNOX/metainfo.xml

@@ -0,0 +1,26 @@
+<?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>KNOX</name>
+      <extends>common-services/KNOX/0.5.0.2.2</extends>
+    </service>
+  </services>
+</metainfo>

+ 29 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/SLIDER/configurations/slider-client.xml

@@ -0,0 +1,29 @@
+<?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.
+-->
+<!--
+  Properties set here are picked up in the client.
+-->
+<configuration>
+
+  <property>
+    <name>slider.zookeeper.quorum</name>
+    <value>localhost</value>
+  </property>
+
+</configuration>

+ 26 - 0
ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/SLIDER/metainfo.xml

@@ -0,0 +1,26 @@
+<?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>SLIDER</name>
+      <extends>common-services/SLIDER/0.60.0.2.2</extends>
+    </service>
+  </services>
+</metainfo>