Class: Actions::SccManager::SyncRepositories
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::SccManager::SyncRepositories
- Includes:
- EncryptValue
- Defined in:
- app/lib/actions/scc_manager/sync_repositories.rb
Instance Method Summary collapse
- #finalize ⇒ Object
- #humanized_name ⇒ Object
- #humanized_output ⇒ Object
- #plan(scc_account) ⇒ Object
- #rescue_strategy ⇒ Object
- #run ⇒ Object
Instance Method Details
#finalize ⇒ Object
24 25 26 27 |
# File 'app/lib/actions/scc_manager/sync_repositories.rb', line 24 def finalize # this is only executed if 'run' succeeds SccAccount.find(input[:scc_account][:id]).update_scc_repositories(output[:data]) end |
#humanized_name ⇒ Object
33 34 35 |
# File 'app/lib/actions/scc_manager/sync_repositories.rb', line 33 def humanized_name _('Sync SUSE subscriptions (Repositories)') end |
#humanized_output ⇒ Object
37 38 39 |
# File 'app/lib/actions/scc_manager/sync_repositories.rb', line 37 def humanized_output output.dup.update(data: "Trimmed (got #{output[:data]&.length} repositories") end |
#plan(scc_account) ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/lib/actions/scc_manager/sync_repositories.rb', line 6 def plan(scc_account) action_subject(scc_account) password = encrypt_field(scc_account.password) plan_self(base_url: scc_account.base_url, login: scc_account.login, password: password) end |
#rescue_strategy ⇒ Object
29 30 31 |
# File 'app/lib/actions/scc_manager/sync_repositories.rb', line 29 def rescue_strategy Dynflow::Action::Rescue::Fail end |
#run ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/lib/actions/scc_manager/sync_repositories.rb', line 14 def run output[:data] = ::SccManager.get_scc_data(input[:base_url], '/connect/organizations/repositories', input[:login], decrypt_field(input[:password])) rescue StandardError => e ::Foreman::Logging.logger('foreman_scc_manager').error "Error while syncronizing SCC-Repositories: #{e}" error! e.to_s end |