Sha256: c7e6a11394921a049209263e5a93d4fc146e003c15a7837d5844166042b01199
Contents?: true
Size: 1.46 KB
Versions: 5
Compression:
Stored size: 1.46 KB
Contents
module Actions module SccManager class SyncProducts < Actions::EntryAction include EncryptValue 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 def run output[:status] = 'SUCCESS' begin 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}" output[:error] = e.to_s output[:status] = 'FAILURE' end end def finalize SccAccount.find(input.fetch(:id)).update_scc_products(output.fetch(:data)) if output[:status] == 'SUCCESS' end def rescue_strategy Dynflow::Action::Rescue::Fail end def humanized_name _('Sync SUSE subscriptions (Products)') end def humanized_output output.dup.update(data: 'Trimmed') end end end end
Version data entries
5 entries across 5 versions & 1 rubygems