Sha256: 72a682ce477bc2bf226c9d12210988cda637d3649756bccaaccf46c950eeba7c

Contents?: true

Size: 1.31 KB

Versions: 19

Compression:

Stored size: 1.31 KB

Contents

module Actions
  module SccManager
    class SyncRepositories < Actions::EntryAction
      include EncryptValue

      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

      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

      def finalize
        # this is only executed if 'run' succeeds
        SccAccount.find(input[:scc_account][:id]).update_scc_repositories(output[:data])
      end

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

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

      def humanized_output
        output.dup.update(data: "Trimmed (got #{output[:data]&.length} repositories")
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
foreman_scc_manager-2.3.0 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-2.2.3 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-2.2.2 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-2.2.1 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-2.2.0 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-2.1.0 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-2.0.0 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.20 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.19 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.18 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.17 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.16 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.15 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.13 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.12 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.10 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.9 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.8 app/lib/actions/scc_manager/sync_repositories.rb
foreman_scc_manager-1.8.7 app/lib/actions/scc_manager/sync_repositories.rb