Sha256: b30121d6c5ad5cdeec0269fa5091a9e6f50386487440c3f66698ef28b82eead1
Contents?: true
Size: 885 Bytes
Versions: 1
Compression:
Stored size: 885 Bytes
Contents
class ForemanDiscovery::HostConverter # Converts discovered host to managed host without uptading the database. # Record must be saved explicitly (using save! or update_attributes! or similar). # This method MUST be called from a SQL transaction. def self.to_managed(original_host, set_managed = true, set_build = true) if ActiveRecord::Base.connection.open_transactions <= 0 raise "This method must be executed with explicit transaction" end host = original_host.becomes(::Host::Managed) host.type = 'Host::Managed' # the following flags can be skipped when parameters are set to false if set_managed host.managed = set_managed host.primary_interface.managed = set_managed end # set build only and only on final save (otherwise interfaces are not being identified) host.build = set_build if set_build host end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_discovery-4.0.0 | app/services/foreman_discovery/host_converter.rb |