params.py 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/usr/bin/env python
  2. """
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing, software
  12. distributed under the License is distributed on an "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. See the License for the specific language governing permissions and
  15. limitations under the License.
  16. """
  17. import os
  18. import sys
  19. from resource_management import format_hdp_stack_version, Script
  20. from resource_management.libraries.functions import format
  21. import status_params
  22. # server configurations
  23. config = Script.get_config()
  24. # security enabled
  25. security_enabled = status_params.security_enabled
  26. # hdp version
  27. stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
  28. hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
  29. metadata_home = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ else '/usr/hdp/current/atlas-server'
  30. metadata_bin = format("{metadata_home}/bin")
  31. python_binary = os.environ['PYTHON_EXE'] if 'PYTHON_EXE' in os.environ else sys.executable
  32. metadata_start_script = format("{metadata_bin}/metadata_start.py")
  33. metadata_stop_script = format("{metadata_bin}/metadata_stop.py")
  34. # metadata local directory structure
  35. log_dir = config['configurations']['metadata-env']['metadata_log_dir']
  36. conf_dir = status_params.conf_dir # "/etc/metadata/conf"
  37. # service locations
  38. hadoop_conf_dir = os.path.join(os.environ["HADOOP_HOME"], "conf") if 'HADOOP_HOME' in os.environ else '/etc/hadoop/conf'
  39. # user and status
  40. metadata_user = status_params.metadata_user
  41. user_group = config['configurations']['cluster-env']['user_group']
  42. pid_dir = status_params.pid_dir
  43. pid_file = format("{pid_dir}/metadata.pid")
  44. # metadata env
  45. java64_home = config['hostLevelParams']['java_home']
  46. env_sh_template = config['configurations']['metadata-env']['content']
  47. # credential provider
  48. credential_provider = format( "jceks://file@{conf_dir}/atlas-site.jceks")
  49. # command line args
  50. metadata_port = config['configurations']['metadata-env']['metadata_port']
  51. metadata_host = config['hostname']
  52. # application properties
  53. application_properties = config['configurations']['application-properties']
  54. for key, value in application_properties.iteritems():
  55. # fix the multi-line property
  56. if (key == 'http_authentication_kerberos_name_rules'):
  57. value = ' \\ \n'.join(value.splitlines())
  58. globals()[key] = value
  59. metadata_env_content = config['configurations']['metadata-env']['content']
  60. application_properties_content = config['configurations']['application-properties']['content']
  61. metadata_opts = config['configurations']['metadata-env']['metadata_opts']
  62. metadata_classpath = config['configurations']['metadata-env']['metadata_classpath']
  63. data_dir = config['configurations']['metadata-env']['metadata_data_dir']
  64. expanded_war_dir = os.environ['METADATA_EXPANDED_WEBAPP_DIR'] if 'METADATA_EXPANDED_WEBAPP_DIR' in os.environ else '/var/lib/atlas/server/webapp'
  65. # smoke test
  66. smoke_test_user = config['configurations']['cluster-env']['smokeuser']
  67. smoke_test_password = 'smoke'
  68. smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
  69. smokeuser_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
  70. kinit_path_local = status_params.kinit_path_local
  71. security_check_status_file = format('{log_dir}/security_check.status')
  72. if security_enabled:
  73. smoke_cmd = format('curl --negotiate -u : -b ~/cookiejar.txt -c ~/cookiejar.txt -s -o /dev/null -w "%{{http_code}}" http://{metadata_host}:{metadata_port}/')
  74. else:
  75. smoke_cmd = format('curl -s -o /dev/null -w "%{{http_code}}" http://{metadata_host}:{metadata_port}/')