Sha256: 7bcd9f9fac6ad5c5b1b9e8737ee565620c10cb7e9f27b35a19dda530c387d9ec
Contents?: true
Size: 683 Bytes
Versions: 39
Compression:
Stored size: 683 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(JSON.parse(new_role)) end end def delete_old_roles(changes) changes.each_pair do |_, old_role| ::AnsibleRole.find(JSON.parse(old_role)['id']).destroy end end end end
Version data entries
39 entries across 39 versions & 1 rubygems