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-14.2.2 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-14.2.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-13.0.7 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-14.2.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-14.1.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-14.1.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-13.0.5 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-14.0.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-13.0.4 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-13.0.3 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-13.0.2 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-13.0.1 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-13.0.0 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-12.0.7 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-10.4.4 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-7.1.8 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-12.0.6 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-12.0.5 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-10.4.3 app/services/foreman_ansible/ui_roles_importer.rb
foreman_ansible-12.0.4 app/services/foreman_ansible/ui_roles_importer.rb