PageRenderTime 26ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/app/registries/foreman/settings/facts.rb

https://github.com/theforeman/foreman
Ruby | 105 lines | 101 code | 2 blank | 2 comment | 4 complexity | 639c6b01527e7acdc184e3c5bbb495de MD5 | raw file
Possible License(s): LGPL-3.0
  1. Foreman::SettingManager.define(:foreman) do
  2. category(:facts, N_('Facts')) do
  3. # facts which change way too often
  4. IGNORED_FACTS = [
  5. 'load_averages::*',
  6. 'memory::swap::available*',
  7. 'memory::swap::capacity',
  8. 'memory::swap::used*',
  9. 'memory::system::available*',
  10. 'memory::system::capacity',
  11. 'memory::system::used*',
  12. 'memoryfree',
  13. 'memoryfree_mb',
  14. 'swapfree',
  15. 'swapfree_mb',
  16. # uptime_seconds is not here since the boot time fact is derived from it
  17. 'uptime_hours',
  18. 'uptime_days',
  19. ].freeze
  20. IGNORED_INTERFACES = [
  21. 'lo',
  22. 'en*v*',
  23. 'usb*',
  24. 'vnet*',
  25. 'macvtap*',
  26. ';vdsmdummy;',
  27. 'veth*',
  28. 'docker*',
  29. 'tap*',
  30. 'qbr*',
  31. 'qvb*',
  32. 'qvo*',
  33. 'qr-*',
  34. 'qg-*',
  35. 'vlinuxbr*',
  36. 'vovsbr*',
  37. 'br-int',
  38. ].freeze
  39. setting('create_new_host_when_facts_are_uploaded',
  40. type: :boolean,
  41. description: N_("Foreman will create the host when new facts are received"),
  42. default: true,
  43. full_name: N_('Create new host when facts are uploaded'))
  44. setting('location_fact',
  45. type: :string,
  46. description: N_("Hosts created after a puppet run will be placed in the location this fact dictates. The content of this fact should be the full label of the location."),
  47. default: 'foreman_location',
  48. full_name: N_('Location fact'))
  49. setting('organization_fact',
  50. type: :string,
  51. description: N_("Hosts created after a puppet run will be placed in the organization this fact dictates. The content of this fact should be the full label of the organization."),
  52. default: 'foreman_organization',
  53. full_name: N_('Organization fact'))
  54. setting('default_location',
  55. type: :string,
  56. description: N_("Hosts created after a puppet run that did not send a location fact will be placed in this location"),
  57. default: '',
  58. full_name: N_('Default location'),
  59. collection: proc { Hash[Location.all.pluck(:title).map { |title| [title, title] }] })
  60. setting('default_organization',
  61. type: :string,
  62. description: N_("Hosts created after a puppet run that did not send a organization fact will be placed in this organization"),
  63. default: '',
  64. full_name: N_('Default organization'),
  65. collection: proc { Hash[Organization.all.pluck(:title).map { |title| [title, title] }] })
  66. setting('update_hostgroup_from_facts',
  67. type: :boolean,
  68. description: N_("Foreman will update a host's hostgroup from its facts"),
  69. default: true,
  70. full_name: N_('Update hostgroup from facts'))
  71. setting('ignore_facts_for_operatingsystem',
  72. type: :boolean,
  73. description: N_("Stop updating Operating System from facts"),
  74. default: false,
  75. full_name: N_('Ignore facts for operating system'))
  76. setting('ignore_facts_for_domain',
  77. type: :boolean,
  78. description: N_("Stop updating domain values from facts"),
  79. default: false,
  80. full_name: N_('Ignore facts for domain'))
  81. setting('update_subnets_from_facts',
  82. type: :string,
  83. description: N_("Foreman will update a host's subnet from its facts"),
  84. default: 'none',
  85. full_name: N_('Update subnets from facts'),
  86. collection: proc { { 'all' => _('All'), 'provisioning' => _('Provisioning only'), 'none' => _('None') } })
  87. setting('ignore_puppet_facts_for_provisioning',
  88. type: :boolean,
  89. description: N_("Stop updating IP and MAC address values from facts (affects all interfaces)"),
  90. default: false,
  91. full_name: N_('Ignore interfaces facts for provisioning'))
  92. setting('ignored_interface_identifiers',
  93. type: :array,
  94. description: N_("Skip creating or updating host network interfaces objects with identifiers matching these values from incoming facts. You can use * wildcard to match identifiers with indexes e.g. macvtap*. The ignored interfaces raw facts will be still stored in the DB, see the 'Exclude pattern' setting for more details."),
  95. default: IGNORED_INTERFACES,
  96. full_name: N_('Ignore interfaces with matching identifier'))
  97. setting('excluded_facts',
  98. type: :array,
  99. description: N_("Exclude pattern for all types of imported facts (puppet, ansible, rhsm). Those facts won't be stored in foreman's database. You can use * wildcard to match names with indexes e.g. ignore* will filter out ignore, ignore123 as well as a::ignore or even a::ignore123::b"),
  100. default: IGNORED_INTERFACES + IGNORED_FACTS,
  101. full_name: N_('Exclude pattern for facts stored in foreman'))
  102. end
  103. end