Skip to content

Commit

Permalink
Fixes #13772 - orchestration now uses app logger
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and iNecas committed Apr 12, 2017
1 parent 736cb75 commit 4deab2f
Show file tree
Hide file tree
Showing 107 changed files with 130 additions and 121 deletions.
8 changes: 8 additions & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true

# Rails use Notifications for own sql logging so we can override sql logger for orchestration
def logger
Foreman::Logging.logger('app')
end
end
2 changes: 1 addition & 1 deletion app/models/architecture.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Architecture < ActiveRecord::Base
class Architecture < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/auth_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

class AuthSource < ActiveRecord::Base
class AuthSource < ApplicationRecord
include Authorizable

audited
Expand Down
2 changes: 1 addition & 1 deletion app/models/bookmark.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Bookmark < ActiveRecord::Base
class Bookmark < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/cached_user_role.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CachedUserRole < ActiveRecord::Base
class CachedUserRole < ApplicationRecord
belongs_to :user
belongs_to :role

Expand Down
2 changes: 1 addition & 1 deletion app/models/cached_usergroup_member.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CachedUsergroupMember < ActiveRecord::Base
class CachedUsergroupMember < ApplicationRecord
belongs_to :user
belongs_to :usergroup
end
2 changes: 1 addition & 1 deletion app/models/compute_attribute.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ComputeAttribute < ActiveRecord::Base
class ComputeAttribute < ApplicationRecord
audited :associated_with => :compute_profile

belongs_to :compute_resource
Expand Down
2 changes: 1 addition & 1 deletion app/models/compute_profile.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ComputeProfile < ActiveRecord::Base
class ComputeProfile < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/compute_resource.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ComputeResource < ActiveRecord::Base
class ComputeResource < ApplicationRecord
include Taxonomix
include Encryptable
include Authorizable
Expand Down
2 changes: 1 addition & 1 deletion app/models/config_group.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ConfigGroup < ActiveRecord::Base
class ConfigGroup < ApplicationRecord
audited
include Authorizable
include Parameterizable::ByIdName
Expand Down
2 changes: 1 addition & 1 deletion app/models/config_group_class.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ConfigGroupClass < ActiveRecord::Base
class ConfigGroupClass < ApplicationRecord
include Authorizable

audited :associated_with => :config_group
Expand Down
2 changes: 1 addition & 1 deletion app/models/domain.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "resolv"
# This models a DNS domain and so represents a site.
class Domain < ActiveRecord::Base
class Domain < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/environment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Environment < ActiveRecord::Base
class Environment < ApplicationRecord
extend FriendlyId
friendly_id :name, :reserved_words => []
include Taxonomix
Expand Down
2 changes: 1 addition & 1 deletion app/models/environment_class.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class EnvironmentClass < ActiveRecord::Base
class EnvironmentClass < ApplicationRecord
belongs_to :environment
belongs_to :puppetclass
belongs_to :puppetclass_lookup_key
Expand Down
2 changes: 1 addition & 1 deletion app/models/external_usergroup.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ExternalUsergroup < ActiveRecord::Base
class ExternalUsergroup < ApplicationRecord
extend FriendlyId
friendly_id :name

Expand Down
2 changes: 1 addition & 1 deletion app/models/fact_name.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class FactName < ActiveRecord::Base
class FactName < ApplicationRecord
include Parameterizable::ByIdName

SEPARATOR = '::'
Expand Down
2 changes: 1 addition & 1 deletion app/models/fact_value.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class FactValue < ActiveRecord::Base
class FactValue < ApplicationRecord
include Authorizable
include ScopedSearchExtensions

Expand Down
2 changes: 1 addition & 1 deletion app/models/feature.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Feature < ActiveRecord::Base
class Feature < ApplicationRecord
extend FriendlyId
friendly_id :name
has_and_belongs_to_many :smart_proxies
Expand Down
2 changes: 1 addition & 1 deletion app/models/filter.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Filter < ActiveRecord::Base
class Filter < ApplicationRecord
include Taxonomix
include Authorizable
include TopbarCacheExpiry
Expand Down
2 changes: 1 addition & 1 deletion app/models/filtering.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Filtering < ActiveRecord::Base
class Filtering < ApplicationRecord
belongs_to :filter
belongs_to :permission
end
2 changes: 1 addition & 1 deletion app/models/host/base.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Host
class Base < ActiveRecord::Base
class Base < ApplicationRecord
include Foreman::STI
include Authorizable
include Parameterizable::ByName
Expand Down
2 changes: 1 addition & 1 deletion app/models/host_class.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class HostClass < ActiveRecord::Base
class HostClass < ApplicationRecord
include Authorizable

validates_lengths_from_database
Expand Down
2 changes: 1 addition & 1 deletion app/models/host_config_group.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class HostConfigGroup < ActiveRecord::Base
class HostConfigGroup < ApplicationRecord
include Authorizable
audited :associated_with => :host
audited :associated_with => :hostgroup
Expand Down
2 changes: 1 addition & 1 deletion app/models/host_facets/base.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module HostFacets
class Base < ActiveRecord::Base
class Base < ApplicationRecord
self.abstract_class = true

include Facets::Base
Expand Down
2 changes: 1 addition & 1 deletion app/models/host_status/status.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module HostStatus
class Status < ActiveRecord::Base
class Status < ApplicationRecord
include Foreman::STI

self.table_name = 'host_status'
Expand Down
2 changes: 1 addition & 1 deletion app/models/hostgroup.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Hostgroup < ActiveRecord::Base
class Hostgroup < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :title
Expand Down
2 changes: 1 addition & 1 deletion app/models/hostgroup_class.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class HostgroupClass < ActiveRecord::Base
class HostgroupClass < ApplicationRecord
include Authorizable

audited :associated_with => :hostgroup
Expand Down
2 changes: 1 addition & 1 deletion app/models/image.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Image < ActiveRecord::Base
class Image < ApplicationRecord
include Authorizable

audited :except => [ :password ]
Expand Down
2 changes: 1 addition & 1 deletion app/models/key_pair.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class KeyPair < ActiveRecord::Base
class KeyPair < ApplicationRecord
belongs_to :compute_resource
validates_lengths_from_database
validates :name, :secret, :presence => true
Expand Down
2 changes: 1 addition & 1 deletion app/models/log.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Log < ActiveRecord::Base
class Log < ApplicationRecord
belongs_to :message
belongs_to :source
belongs_to :report
Expand Down
2 changes: 1 addition & 1 deletion app/models/lookup_keys/lookup_key.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class LookupKey < ActiveRecord::Base
class LookupKey < ApplicationRecord
include Authorizable
include HiddenValue

Expand Down
2 changes: 1 addition & 1 deletion app/models/lookup_value.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class LookupValue < ActiveRecord::Base
class LookupValue < ApplicationRecord
include Authorizable
include PuppetLookupValueExtensions
include HiddenValue
Expand Down
2 changes: 1 addition & 1 deletion app/models/mail_notifications/mail_notification.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class MailNotification < ActiveRecord::Base
class MailNotification < ApplicationRecord
include Authorizable

INTERVALS = [N_("Daily"), N_("Weekly"), N_("Monthly")]
Expand Down
2 changes: 1 addition & 1 deletion app/models/medium.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Medium < ActiveRecord::Base
class Medium < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/message.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Message < ActiveRecord::Base
class Message < ApplicationRecord
has_many :reports, :through => :logs
has_many :logs
validates_lengths_from_database
Expand Down
2 changes: 1 addition & 1 deletion app/models/model.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Model < ActiveRecord::Base
class Model < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/nic/base.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Represents a Host's network interface
# This class is the both parent
module Nic
class Base < ActiveRecord::Base
class Base < ApplicationRecord
include Foreman::STI
include Encryptable
encrypts :password
Expand Down
2 changes: 1 addition & 1 deletion app/models/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Stores the information related to serving the notification to multiple users
# This class' responsibility is, given a notification blueprint, to determine
# who are the notification recipients
class Notification < ActiveRecord::Base
class Notification < ApplicationRecord
AUDIENCE_USER = 'user'
AUDIENCE_GROUP = 'usergroup'
AUDIENCE_TAXONOMY = 'taxonomy'
Expand Down
2 changes: 1 addition & 1 deletion app/models/notification_blueprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# actions that are notification-worthy. This keeps the responsibilities
# separate, Notifications taking care of serving the content, and
# NotificationBlueprint of storing it.
class NotificationBlueprint < ActiveRecord::Base
class NotificationBlueprint < ApplicationRecord
has_many :notifications, :dependent => :destroy
store :actions, :accessors => [:links], :coder => JSON

Expand Down
2 changes: 1 addition & 1 deletion app/models/notification_recipient.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class NotificationRecipient < ActiveRecord::Base
class NotificationRecipient < ApplicationRecord
belongs_to :notification
belongs_to :user
has_one :notification_blueprint, :through => :notification
Expand Down
2 changes: 1 addition & 1 deletion app/models/operatingsystem.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'ostruct'
require 'uri'

class Operatingsystem < ActiveRecord::Base
class Operatingsystem < ApplicationRecord
include Authorizable
include ValidateOsFamily
include PxeLoaderSupport
Expand Down
2 changes: 1 addition & 1 deletion app/models/os_default_template.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class OsDefaultTemplate < ActiveRecord::Base
class OsDefaultTemplate < ApplicationRecord
belongs_to :provisioning_template
belongs_to :template_kind
belongs_to :operatingsystem
Expand Down
2 changes: 1 addition & 1 deletion app/models/parameter.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Parameter < ActiveRecord::Base
class Parameter < ApplicationRecord
extend FriendlyId
friendly_id :name
include Parameterizable::ByIdName
Expand Down
2 changes: 1 addition & 1 deletion app/models/permission.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Permission < ActiveRecord::Base
class Permission < ApplicationRecord
validates_lengths_from_database
validates :name, :presence => true, :uniqueness => true

Expand Down
2 changes: 1 addition & 1 deletion app/models/puppetclass.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Puppetclass < ActiveRecord::Base
class Puppetclass < ApplicationRecord
include Authorizable
include ScopedSearchExtensions
extend FriendlyId
Expand Down
2 changes: 1 addition & 1 deletion app/models/realm.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Realm < ActiveRecord::Base
class Realm < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/report.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Report < ActiveRecord::Base
class Report < ApplicationRecord
LOG_LEVELS = %w[debug info notice warning err alert emerg crit]

include Foreman::STI
Expand Down
2 changes: 1 addition & 1 deletion app/models/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

class Role < ActiveRecord::Base
class Role < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/setting.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'resolv'

class Setting < ActiveRecord::Base
class Setting < ApplicationRecord
extend FriendlyId
friendly_id :name
include ActiveModel::Validations
Expand Down
2 changes: 1 addition & 1 deletion app/models/smart_proxy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SmartProxy < ActiveRecord::Base
class SmartProxy < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/source.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Source < ActiveRecord::Base
class Source < ApplicationRecord
validates_lengths_from_database
has_many :reports, :through => :logs
has_many :logs
Expand Down
2 changes: 1 addition & 1 deletion app/models/ssh_key.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SshKey < ActiveRecord::Base
class SshKey < ApplicationRecord
include Authorizable
extend FriendlyId
friendly_id :name
Expand Down
2 changes: 1 addition & 1 deletion app/models/subnet.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'ipaddr'

class Subnet < ActiveRecord::Base
class Subnet < ApplicationRecord
IP_FIELDS = [:network, :mask, :gateway, :dns_primary, :dns_secondary, :from, :to]
REQUIRED_IP_FIELDS = [:network, :mask]
SUBNET_TYPES = {:'Subnet::Ipv4' => N_('IPv4'), :'Subnet::Ipv6' => N_('IPv6')}
Expand Down
2 changes: 1 addition & 1 deletion app/models/subnet_domain.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SubnetDomain < ActiveRecord::Base
class SubnetDomain < ApplicationRecord
belongs_to :domain
belongs_to :subnet

Expand Down
2 changes: 1 addition & 1 deletion app/models/taxable_taxonomy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class TaxableTaxonomy < ActiveRecord::Base
class TaxableTaxonomy < ApplicationRecord
belongs_to :taxonomy
belongs_to :taxable, :polymorphic => true

Expand Down
2 changes: 1 addition & 1 deletion app/models/taxonomy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Taxonomy < ActiveRecord::Base
class Taxonomy < ApplicationRecord
validates_lengths_from_database

include Authorizable
Expand Down
2 changes: 1 addition & 1 deletion app/models/template.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Template < ActiveRecord::Base
class Template < ApplicationRecord
include Exportable
attr_accessor :modify_locked, :modify_default

Expand Down
2 changes: 1 addition & 1 deletion app/models/template_combination.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class TemplateCombination < ActiveRecord::Base
class TemplateCombination < ApplicationRecord
belongs_to :provisioning_template
belongs_to :environment
belongs_to :hostgroup
Expand Down
2 changes: 1 addition & 1 deletion app/models/template_kind.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class TemplateKind < ActiveRecord::Base
class TemplateKind < ApplicationRecord
extend FriendlyId
friendly_id :name
validates_lengths_from_database
Expand Down
2 changes: 1 addition & 1 deletion app/models/token.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Token < ActiveRecord::Base
class Token < ApplicationRecord
validates_lengths_from_database
belongs_to_host :foreign_key => :host_id

Expand Down
2 changes: 1 addition & 1 deletion app/models/trend.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Trend < ActiveRecord::Base
class Trend < ApplicationRecord
validates_lengths_from_database
after_save :create_values, :if => ->(o) { o.fact_value.nil? }
after_destroy :destroy_values, :if => ->(o) { o.fact_value.nil? }
Expand Down
Loading

0 comments on commit 4deab2f

Please sign in to comment.