Sha256: 167da99c2c57fc462a43d6b58d4277e8624e18e2b48d1e1e7c1b2f8d5a2f180a

Contents?: true

Size: 581 Bytes

Versions: 39

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module ForemanAnsible
  # imports Ansible roles through API
  class ApiRolesImporter < RolesImporter
    def import!(role_names = nil)
      new_roles = import_role_names[:new]
      if role_names.present?
        new_roles.select! do |role|
          role_names.include?(role.name)
        end
      end
      new_roles.map(&:save)
      new_roles
    end

    def obsolete!
      obsolete_roles = import_role_names[:obsolete]
      obsolete_roles.map(&:destroy)
      obsolete_roles
    end

    def fetch!
      fetch_role_names
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
foreman_ansible-6.2.0 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-6.1.1 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-6.0.2 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-6.1.0 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-6.0.1 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-5.1.3 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-6.0.0 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-5.1.2 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-5.1.1 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-5.1.0 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.3.5 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.3.4 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.3.3 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.3.2 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-5.0.1 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.5 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.3.1 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.4 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-5.0.0 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-4.0.3 app/services/foreman_ansible/api_roles_importer.rb