Sha256: fc1ee07bea8ff710ff114ba8fab949fcc7e7abd30bc812fbd0b64c056ec0b77f

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

module Actions
  module SccManager
    class SyncProducts < Actions::EntryAction
      def plan(scc_account)
        action_subject(scc_account)
        plan_self(id: scc_account.id,
                  base_url: scc_account.base_url,
                  login: scc_account.login,
                  password: scc_account.password)
      end

      def run
        output[:status] = 'SUCCESS'
        begin
          output[:data] = ::SccManager.get_scc_data(input.fetch(:base_url),
                                                    '/connect/organizations/products',
                                                    input.fetch(:login),
                                                    input.fetch(:password))
        rescue
          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
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_scc_manager-1.3.1 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.3.0 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.2.0 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.1.3 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.1.2 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.1.1 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.1.0 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.0.1 app/lib/actions/scc_manager/sync_products.rb
foreman_scc_manager-1.0.0 app/lib/actions/scc_manager/sync_products.rb