Class: Katello::UpstreamConnectionChecker

Inherits:
Object
  • Object
show all
Defined in:
app/services/katello/upstream_connection_checker.rb

Constant Summary collapse

POSSIBLE_EXCEPTIONS =
[
  Katello::Errors::SubscriptionConnectionNotEnabled,
  Katello::Errors::ManifestExpired,
  Katello::Errors::UpstreamConsumerGone,
  Katello::Errors::UpstreamConsumerNotFound,
  Katello::Errors::NoManifestImported
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(organization) ⇒ UpstreamConnectionChecker

Returns a new instance of UpstreamConnectionChecker.



11
12
13
# File 'app/services/katello/upstream_connection_checker.rb', line 11

def initialize(organization)
  @organization = organization
end

Instance Method Details

#assert_connectionObject



25
26
27
28
29
30
31
# File 'app/services/katello/upstream_connection_checker.rb', line 25

def assert_connection
  assert_connected
  assert_unexpired_manifest
  assert_can_upstream_ping

  true
end

#can_connect?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
# File 'app/services/katello/upstream_connection_checker.rb', line 15

def can_connect?
  assert_connection
rescue StandardError => e
  if POSSIBLE_EXCEPTIONS.include?(e.class)
    false
  else
    raise e
  end
end