Revision a653e389
Added by Ewoud Kohl van Wijngaarden about 6 years ago
app/models/setting/auth.rb | ||
---|---|---|
require 'facter'
|
||
class Setting::Auth < Setting
|
||
def self.default_settings
|
||
fqdn = Facter.value(:fqdn) || SETTINGS[:fqdn]
|
||
fqdn = SETTINGS[:fqdn]
|
||
lower_fqdn = fqdn.downcase
|
||
ssl_cert = "#{SETTINGS[:puppetssldir]}/certs/#{lower_fqdn}.pem"
|
||
ssl_ca_file = "#{SETTINGS[:puppetssldir]}/certs/ca.pem"
|
app/models/setting/email.rb | ||
---|---|---|
require 'facter'
|
||
|
||
class Setting::Email < Setting
|
||
NON_EMAIL_YAML_SETTINGS = %w(send_welcome_email email_reply_address email_subject_prefix)
|
||
|
app/models/setting/general.rb | ||
---|---|---|
require 'facter'
|
||
class Setting::General < Setting
|
||
include UrlValidator
|
||
|
||
... | ... | |
protocol = SETTINGS[:require_ssl] ? 'https' : 'http'
|
||
domain = SETTINGS[:domain]
|
||
administrator = "root@#{domain}"
|
||
foreman_url = "#{protocol}://#{Facter.value(:fqdn) || SETTINGS[:fqdn]}"
|
||
foreman_url = "#{protocol}://#{SETTINGS[:fqdn]}"
|
||
|
||
[
|
||
self.set('administrator', N_("The default administrator email address"), administrator, N_('Administrator email address')),
|
app/models/setting/provisioning.rb | ||
---|---|---|
require 'facter'
|
||
class Setting::Provisioning < Setting
|
||
def self.default_global_labels
|
||
TemplateKind::PXE.map do |pxe_kind|
|
||
... | ... | |
'vovsbr*'
|
||
]
|
||
def self.default_settings
|
||
fqdn = Facter.value(:fqdn) || SETTINGS[:fqdn]
|
||
fqdn = SETTINGS[:fqdn]
|
||
unattended_url = "http://#{fqdn}"
|
||
select = [{:name => _("Users"), :class => 'user', :scope => 'visible', :value_method => 'id_and_type', :text_method => 'login'},
|
||
{:name => _("Usergroup"), :class => 'usergroup', :scope => 'visible', :value_method => 'id_and_type', :text_method => 'name'}]
|
config/settings.rb | ||
---|---|---|
require_relative 'boot_settings'
|
||
require_relative '../app/services/foreman/version'
|
||
require 'facter'
|
||
|
||
root = File.expand_path(File.dirname(__FILE__) + "/..")
|
||
settings_file = Rails.env.test? ? 'config/settings.yaml.test' : 'config/settings.yaml'
|
||
... | ... | |
SETTINGS[:puppetvardir] ||= '/var/lib/puppet'
|
||
SETTINGS[:puppetssldir] ||= "#{SETTINGS[:puppetvardir]}/ssl"
|
||
SETTINGS[:rails] = '%.1f' % SETTINGS[:rails] if SETTINGS[:rails].is_a?(Float) # unquoted YAML value
|
||
SETTINGS[:domain] ||= Facter.value(:domain) || Facter.value(:hostname)
|
||
SETTINGS[:hsts_enabled] = true unless SETTINGS.has_key?(:hsts_enabled)
|
||
|
||
unless SETTINGS[:domain] && SETTINGS[:fqdn]
|
||
require 'facter'
|
||
SETTINGS[:domain] ||= Facter.value(:domain) || Facter.value(:hostname)
|
||
SETTINGS[:fqdn] ||= Facter.value(:fqdn)
|
||
end
|
||
|
||
# Load plugin config, if any
|
||
Dir["#{root}/config/settings.plugins.d/*.yaml"].each do |f|
|
||
SETTINGS.merge! YAML.load(ERB.new(File.read(f)).result)
|
db/migrate/20100419151910_add_owner_to_hosts.rb | ||
---|---|---|
require 'facter'
|
||
class AddOwnerToHosts < ActiveRecord::Migration[4.2]
|
||
class User < ApplicationRecord; end
|
||
class Host < ApplicationRecord; end
|
||
... | ... | |
|
||
Host.reset_column_information
|
||
|
||
email = SETTINGS[:administrator] || "root@#{Facter.value(:domain)}"
|
||
email = SETTINGS[:administrator] || "root@#{SETTINGS[:domain]}"
|
||
owner = User.find_by_mail email
|
||
owner ||= User.where(:admin => true).first
|
||
unless owner.nil? || owner.id.nil?
|
db/migrate/20100628123400_add_internal_auth.rb | ||
---|---|---|
require 'facter'
|
||
class AddInternalAuth < ActiveRecord::Migration[4.2]
|
||
def up
|
||
add_column :users, :password_hash, :string, :limit => 128
|
lib/tasks/reset_permissions.rake | ||
---|---|---|
require 'facter'
|
||
namespace :permissions do
|
||
desc <<-END_DESC
|
||
Create or reset "admin" user permissions to defaults. Alternatively, you may
|
Also available in: Unified diff
Fixes #23635 - Centralize use of facter
We have a bundler group for facter. That implies it's optional but
before this change it wasn't With this change it's only required if no
domain and fqdn are set. This is still the default so in most cases it's
no difference, but at least we have centralized all use of facter to one
place.