4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/lib/actions/middleware/record_smart_proxy_sync_history.rb', line 4
def save_smart_proxy_sync_history
if (action.input[:repository_id] && (action.input[:smart_proxy_id] || action.input[:capsule_id]) && !self.action.output[:smart_proxy_history_id])
repo_id = action.input[:repository_id]
repo = ::Katello::Repository.find_by(id: repo_id)
smart_proxy_id = action.input[:smart_proxy_id] || action.input[:capsule_id]
smart_proxy = ::SmartProxy.unscoped.find_by(id: smart_proxy_id)
if repo && smart_proxy
self.action.output[:smart_proxy_history_id] = repo.create_smart_proxy_sync_history(smart_proxy)
else
fail "Smart Proxy could not be found with id #{smart_proxy_id}" if smart_proxy.nil?
fail "Repository could not be found with id #{repo_id}" if repo.nil?
end
end
end
|