Class: Actions::SccManager::SyncProducts
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::SccManager::SyncProducts
- Includes:
- EncryptValue
- Defined in:
- app/lib/actions/scc_manager/sync_products.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
26 27 28 29 |
# File 'app/lib/actions/scc_manager/sync_products.rb', line 26 def finalize # this is only executed if 'run' succeeds SccAccount.find(input.fetch(:id)).update_scc_products(output.fetch(:data)) end |
#humanized_name ⇒ Object
35 36 37 |
# File 'app/lib/actions/scc_manager/sync_products.rb', line 35 def humanized_name _('Sync SUSE subscriptions (Products)') end |
#humanized_output ⇒ Object
39 40 41 |
# File 'app/lib/actions/scc_manager/sync_products.rb', line 39 def humanized_output output.dup.update(data: 'Trimmed') end |
#plan(scc_account) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/lib/actions/scc_manager/sync_products.rb', line 6 def plan(scc_account) action_subject(scc_account) password = encrypt_field(scc_account.password) plan_self(id: scc_account.id, base_url: scc_account.base_url, login: scc_account.login, password: password) end |
#rescue_strategy ⇒ Object
31 32 33 |
# File 'app/lib/actions/scc_manager/sync_products.rb', line 31 def rescue_strategy Dynflow::Action::Rescue::Fail end |
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/lib/actions/scc_manager/sync_products.rb', line 15 def run products = ::SccManager.get_scc_data(input.fetch(:base_url), '/connect/organizations/products', input.fetch(:login), decrypt_field(input.fetch(:password))) output[:data] = ::SccManager.sanitize_products(products).values rescue StandardError => e ::Foreman::Logging.logger('foreman_scc_manager').error "Error while syncronizing SCC-Products: #{e}" error! e.to_s end |