Module: Katello::Concerns::SmartProxyExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/katello/concerns/smart_proxy_extensions.rb

Constant Summary collapse

PULP_FEATURE =
"Pulp"
PULP_NODE_FEATURE =
"Pulp Node"

Instance Method Summary collapse

Instance Method Details

#associate_content_hostObject



85
86
87
88
# File 'app/models/katello/concerns/smart_proxy_extensions.rb', line 85

def associate_content_host
  content_host = Katello::System.where(:name => self.name).order("created_at DESC").first
  self.content_host = content_host if content_host
end

#associate_default_locationObject



72
73
74
75
76
77
78
79
# File 'app/models/katello/concerns/smart_proxy_extensions.rb', line 72

def associate_default_location
  if self.default_capsule?
    default_location = Location.default_location
    if default_location && !self.locations.include?(default_location)
      self.locations << default_location
    end
  end
end

#associate_lifecycle_environmentsObject



81
82
83
# File 'app/models/katello/concerns/smart_proxy_extensions.rb', line 81

def associate_lifecycle_environments
  self.lifecycle_environments = Katello::KTEnvironment.all if self.default_capsule?
end

#associate_organizationsObject



68
69
70
# File 'app/models/katello/concerns/smart_proxy_extensions.rb', line 68

def associate_organizations
  self.organizations = Organization.all if self.default_capsule?
end

#default_capsule?Boolean

Returns:

  • (Boolean)


63
64
65
66
# File 'app/models/katello/concerns/smart_proxy_extensions.rb', line 63

def default_capsule?
  # use map instead of pluck in case the features aren't saved yet during create
  self.features.map(&:name).include?(PULP_FEATURE)
end

#pulp_nodeObject



55
56
57
# File 'app/models/katello/concerns/smart_proxy_extensions.rb', line 55

def pulp_node
  @pulp_node ||= Katello::Pulp::Server.config(pulp_url, User.remote_user)
end

#pulp_urlObject



59
60
61
# File 'app/models/katello/concerns/smart_proxy_extensions.rb', line 59

def pulp_url
  "#{url}/pulp/api/v2/"
end