Sha256: a499508af054d00a735fe12b41c606ed752d20570f5d159d5dc9dba4608df403

Contents?: true

Size: 550 Bytes

Versions: 5

Compression:

Stored size: 550 Bytes

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
foreman_ansible-2.2.14 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-2.2.13 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-2.2.12 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-2.2.11 app/services/foreman_ansible/api_roles_importer.rb
foreman_ansible-2.2.10 app/services/foreman_ansible/api_roles_importer.rb