Class: Actions::Katello::Repository::CapsuleSync

Inherits:
Base
  • Object
show all
Defined in:
app/lib/actions/katello/repository/capsule_sync.rb

Instance Method Summary collapse

Instance Method Details

#finalizeObject



23
24
25
26
27
28
29
# File 'app/lib/actions/katello/repository/capsule_sync.rb', line 23

def finalize
  environment = ::Katello::KTEnvironment.find(input[:environment_id])
  if input[:skipped_capsules]
    output[:warning] = "Some smart proxies are not authorized for capsule content management or viewing in environment '#{environment.name}'. Skipping sync for those smart proxies."
    Rails.logger.warn output[:warning]
  end
end

#humanized_nameObject



5
6
7
# File 'app/lib/actions/katello/repository/capsule_sync.rb', line 5

def humanized_name
  _("Sync Repository on Smart Proxy(ies)")
end

#plan(repo) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/lib/actions/katello/repository/capsule_sync.rb', line 9

def plan(repo)
  if repo.node_syncable?
    concurrence do
      env_smart_proxies = SmartProxy.unscoped.with_environment(repo.environment)
      smart_proxies = env_smart_proxies.select { |sp| sp.authorized?(:manage_capsule_content) && sp.authorized?(:view_capsule_content) }
      unless smart_proxies.blank?
        plan_action(::Actions::BulkAction, ::Actions::Katello::CapsuleContent::Sync, smart_proxies,
                    :repository_id => repo.id)
      end
      plan_self(environment_id: repo.environment.id, skipped_capsules: (env_smart_proxies - smart_proxies).any?)
    end
  end
end