Class: Katello::Candlepin::Consumer
- Inherits:
-
Object
- Object
- Katello::Candlepin::Consumer
- Includes:
- LazyAccessor
- Defined in:
- app/services/katello/candlepin/consumer.rb
Constant Summary collapse
- SYSTEM =
"system".freeze
Instance Attribute Summary collapse
-
#owner_label ⇒ Object
Returns the value of attribute owner_label.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
- #checkin(checkin_time) ⇒ Object
-
#initialize(uuid, owner_label) ⇒ Consumer
constructor
A new instance of Consumer.
- #regenerate_identity_certificates ⇒ Object
- #virtual_guests ⇒ Object
- #virtual_host ⇒ Object
Methods included from LazyAccessor
Constructor Details
#initialize(uuid, owner_label) ⇒ Consumer
Returns a new instance of Consumer.
17 18 19 20 |
# File 'app/services/katello/candlepin/consumer.rb', line 17 def initialize(uuid, owner_label) self.uuid = uuid self.owner_label = owner_label end |
Instance Attribute Details
#owner_label ⇒ Object
Returns the value of attribute owner_label.
15 16 17 |
# File 'app/services/katello/candlepin/consumer.rb', line 15 def owner_label @owner_label end |
#uuid ⇒ Object
Returns the value of attribute uuid.
15 16 17 |
# File 'app/services/katello/candlepin/consumer.rb', line 15 def uuid @uuid end |
Class Method Details
.distribution_to_puppet_os(name) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/services/katello/candlepin/consumer.rb', line 44 def self.distribution_to_puppet_os(name) return ::Operatingsystem::REDHAT_ATOMIC_HOST_OS if name == ::Operatingsystem::REDHAT_ATOMIC_HOST_DISTRO_NAME case name.downcase when /red\s*hat/ 'RedHat' when /centos/ 'CentOS' when /fedora/ 'Fedora' when /sles/, /suse.*enterprise.*/ 'SLES' when /debian/ 'Debian' when /ubuntu/ 'Ubuntu' when /oracle/ 'OracleLinux' when /almalinux/ 'AlmaLinux' when /rocky/ 'Rocky' when /amazon/ 'Amazon' else 'Unknown' end end |
Instance Method Details
#checkin(checkin_time) ⇒ Object
26 27 28 |
# File 'app/services/katello/candlepin/consumer.rb', line 26 def checkin(checkin_time) Resources::Candlepin::Consumer.checkin(uuid, checkin_time) end |
#regenerate_identity_certificates ⇒ Object
22 23 24 |
# File 'app/services/katello/candlepin/consumer.rb', line 22 def regenerate_identity_certificates Resources::Candlepin::Consumer.regenerate_identity_certificates(self.uuid) end |
#virtual_guests ⇒ Object
30 31 32 33 34 35 |
# File 'app/services/katello/candlepin/consumer.rb', line 30 def virtual_guests return @virtual_guests unless @virtual_guests.nil? return [] if self.uuid.nil? guest_uuids = Resources::Candlepin::Consumer.virtual_guests(self.uuid).map { |guest| guest['uuid'] } @virtual_guests = ::Host.joins(:subscription_facet).where("#{Katello::Host::SubscriptionFacet.table_name}.uuid" => guest_uuids) end |
#virtual_host ⇒ Object
37 38 39 40 41 42 |
# File 'app/services/katello/candlepin/consumer.rb', line 37 def virtual_host return nil if self.uuid.nil? if (virtual_host_info = Resources::Candlepin::Consumer.virtual_host(self.uuid)) ::Host.joins(:subscription_facet).where("#{Katello::Host::SubscriptionFacet.table_name}.uuid" => virtual_host_info[:uuid]).first end end |