Sha256: 91d194c80d0150db7084eb9f37cac7bd4f00a37a980f61a1cc7fa883d281ac3f

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

module Actions
  module SccManager
    class Sync < Actions::EntryAction
      def plan(scc_account)
        ::Foreman::Logging.logger('foreman_scc_manager')
                          .info("Initiating 'sync' for SccAccount '#{scc_account.name}'.")
        action_subject(scc_account)
        sequence do
          sync_repo_action = plan_action(::Actions::SccManager::SyncRepositories, scc_account)
          sync_prod_action = plan_action(::Actions::SccManager::SyncProducts, scc_account)
          plan_self(repo_status: sync_repo_action.output[:status], prod_status: sync_prod_action.output[:status])
        end
      end

      def finalize
        scc_account = SccAccount.find(input[:scc_account][:id])
        raise 'Updating failed' unless input[:repo_status] == 'SUCCESS' && input[:prod_status] == 'SUCCESS'

        scc_account.update! synced: Time.current
      end

      def rescue_strategy
        Dynflow::Action::Rescue::Fail
      end

      def humanized_name
        _('Sync SUSE subscriptions')
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_scc_manager-1.8.6 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.8.5 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.8.4 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.7.1 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.8.3 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.8.2 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.8.1 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.8.0 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.7.0 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.6.3 app/lib/actions/scc_manager/sync.rb
foreman_scc_manager-1.6.2 app/lib/actions/scc_manager/sync.rb