metadata.py 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. from resource_management import Directory, Fail, Logger, File, \
  18. InlineTemplate, PropertiesFile, StaticFile
  19. from resource_management.libraries.functions import format
  20. def metadata():
  21. import params
  22. Directory([params.pid_dir],
  23. mode=0755,
  24. cd_access='a',
  25. owner=params.metadata_user,
  26. group=params.user_group,
  27. create_parents = True
  28. )
  29. Directory(params.conf_dir,
  30. mode=0755,
  31. cd_access='a',
  32. owner=params.metadata_user,
  33. group=params.user_group,
  34. create_parents = True
  35. )
  36. Directory(params.log_dir,
  37. mode=0755,
  38. cd_access='a',
  39. owner=params.metadata_user,
  40. group=params.user_group,
  41. create_parents = True
  42. )
  43. Directory(params.data_dir,
  44. mode=0644,
  45. cd_access='a',
  46. owner=params.metadata_user,
  47. group=params.user_group,
  48. create_parents = True
  49. )
  50. Directory(params.expanded_war_dir,
  51. mode=0644,
  52. cd_access='a',
  53. owner=params.metadata_user,
  54. group=params.user_group,
  55. create_parents = True
  56. )
  57. File(format("{expanded_war_dir}/atlas.war"),
  58. content = StaticFile(format('{metadata_home}/server/webapp/atlas.war'))
  59. )
  60. PropertiesFile(format('{conf_dir}/application.properties'),
  61. properties = params.application_properties,
  62. mode=0644,
  63. owner=params.metadata_user,
  64. group=params.user_group
  65. )
  66. File(format("{conf_dir}/atlas-env.sh"),
  67. owner=params.metadata_user,
  68. group=params.user_group,
  69. mode=0755,
  70. content=InlineTemplate(params.metadata_env_content)
  71. )
  72. File(format("{conf_dir}/atlas-log4j.xml"),
  73. mode=0644,
  74. owner=params.metadata_user,
  75. group=params.user_group,
  76. content=StaticFile('atlas-log4j.xml')
  77. )