/sos/plugins/openstack_horizon.py

https://gitlab.com/pbandark/sos · Python · 94 lines · 51 code · 25 blank · 18 comment · 3 complexity · 1a1c275c93079108f92a8e9a84252e61 MD5 · raw file

  1. # Copyright (C) 2009 Red Hat, Inc., Joey Boggs <jboggs@redhat.com>
  2. # Copyright (C) 2012 Rackspace US, Inc.,
  3. # Justin Shepherd <jshepher@rackspace.com>
  4. # Copyright (C) 2013 Red Hat, Inc., Jeremy Agee <jagee@redhat.com>
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
  17. class OpenStackHorizon(Plugin):
  18. """OpenStack Horizon
  19. """
  20. plugin_name = "openstack_horizon"
  21. profiles = ('openstack', 'openstack_controller')
  22. option_list = []
  23. def setup(self):
  24. self.limit = self.get_option("log_size")
  25. if self.get_option("all_logs"):
  26. self.add_copy_spec_limit("/var/log/horizon/",
  27. sizelimit=self.limit)
  28. else:
  29. self.add_copy_spec_limit("/var/log/horizon/*.log",
  30. sizelimit=self.limit)
  31. self.add_copy_spec("/etc/openstack-dashboard/")
  32. def postproc(self):
  33. protect_keys = [
  34. "SECRET_KEY", "EMAIL_HOST_PASSWORD"
  35. ]
  36. regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
  37. self.do_path_regex_sub("/etc/openstack-dashboard/.*\.json",
  38. regexp, r"\1*********")
  39. self.do_path_regex_sub("/etc/openstack-dashboard/local_settings",
  40. regexp, r"\1*********")
  41. class DebianHorizon(OpenStackHorizon, DebianPlugin):
  42. packages = (
  43. 'python-django-horizon',
  44. 'openstack-dashboard',
  45. 'openstack-dashboard-apache'
  46. )
  47. def setup(self):
  48. super(DebianHorizon, self).setup()
  49. self.add_copy_spec("/etc/apache2/sites-available/")
  50. class UbuntuHorizon(OpenStackHorizon, UbuntuPlugin):
  51. packages = (
  52. 'python-django-horizon',
  53. 'openstack-dashboard',
  54. 'openstack-dashboard-ubuntu-theme'
  55. )
  56. def setup(self):
  57. super(UbuntuHorizon, self).setup()
  58. self.add_copy_spec("/etc/apache2/conf.d/openstack-dashboard.conf")
  59. class RedHatHorizon(OpenStackHorizon, RedHatPlugin):
  60. packages = (
  61. 'python-django-horizon',
  62. 'openstack-dashboard'
  63. )
  64. def setup(self):
  65. super(RedHatHorizon, self).setup()
  66. self.add_copy_spec("/etc/httpd/conf.d/openstack-dashboard.conf")
  67. if self.get_option("log"):
  68. self.add_copy_spec("/var/log/httpd/")
  69. # vim: set et ts=4 sw=4 :