Sha256: e0813afc68526600b942e32998560469a27b03788913b533a346eee0ad43e29c

Contents?: true

Size: 659 Bytes

Versions: 62

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

module ForemanAnsible
  # imports ansible roles through UI
  class UiRolesImporter < RolesImporter
    def import!
      import_role_names
    end

    def finish_import(changes)
      return if changes.blank?
      create_new_roles changes['new'] if changes['new']
      delete_old_roles changes['obsolete'] if changes['obsolete']
    end

    def create_new_roles(changes)
      changes.each_pair do |_, new_role|
        ::AnsibleRole.create(new_role)
      end
    end

    def delete_old_roles(changes)
      changes.each_pair do |_, old_role|
        ::AnsibleRole.find(old_role['id']).destroy
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
foreman_ansible-10.0.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.1.4 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-9.0.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.1.3 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-9.0.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.1.2 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.1.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-8.0.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-8.0.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.0.4 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.1.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.0.3 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.0.2 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.0.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.0.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-6.3.4 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-6.3.3 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-6.3.2 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-6.3.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-6.4.1 app/services/foreman_ansible/ui_roles_importer.rb