Class: Actions::Katello::CapsuleContent::UpdateContentCounts

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/katello/capsule_content/update_content_counts.rb

Instance Method Summary collapse

Instance Method Details

#find_content_view(content_view_id) ⇒ Object



28
29
30
# File 'app/lib/actions/katello/capsule_content/update_content_counts.rb', line 28

def find_content_view(content_view_id)
  ::Katello::ContentView.find_by(id: content_view_id) if content_view_id
end

#find_env(environment_id) ⇒ Object



24
25
26
# File 'app/lib/actions/katello/capsule_content/update_content_counts.rb', line 24

def find_env(environment_id)
  ::Katello::KTEnvironment.find_by(id: environment_id) if environment_id
end

#find_repository(repository_id) ⇒ Object



32
33
34
# File 'app/lib/actions/katello/capsule_content/update_content_counts.rb', line 32

def find_repository(repository_id)
  ::Katello::Repository.find_by(id: repository_id) if repository_id
end

#humanized_nameObject



10
11
12
# File 'app/lib/actions/katello/capsule_content/update_content_counts.rb', line 10

def humanized_name
  _("Update Content Counts")
end

#plan(smart_proxy, options = {}) ⇒ Object



5
6
7
8
# File 'app/lib/actions/katello/capsule_content/update_content_counts.rb', line 5

def plan(smart_proxy, options = {})
  input[:options] = options
  plan_self(:smart_proxy_id => smart_proxy.id, environment_id: options[:environment_id], content_view_id: options[:content_view_id], repository_id: options[:repository_id])
end

#rescue_strategyObject



36
37
38
# File 'app/lib/actions/katello/capsule_content/update_content_counts.rb', line 36

def rescue_strategy
  Dynflow::Action::Rescue::Skip
end

#runObject



14
15
16
17
18
19
20
21
22
# File 'app/lib/actions/katello/capsule_content/update_content_counts.rb', line 14

def run
  smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
  env = find_env(input[:environment_id])
  content_view = find_content_view(input[:content_view_id])
  repository = find_repository(input[:repository_id])
  smart_proxy.update_content_counts!(environment: env,
                                     content_view: content_view,
                                     repository: repository)
end