Revision 5c02cfe5
Added by Daniel Lobato Garcia over 9 years ago
.rubocop_todo.yml | ||
---|---|---|
Lint/ParenthesesAsGroupedExpression:
|
||
Enabled: false
|
||
|
||
# Offense count: 23
|
||
# Cop supports --auto-correct.
|
||
Lint/StringConversionInInterpolation:
|
||
Enabled: false
|
||
|
||
# Offense count: 54
|
||
# Cop supports --auto-correct.
|
||
Lint/UnusedBlockArgument:
|
app/models/operatingsystem.rb | ||
---|---|---|
|
||
# sets the prefix for the tfp files based on the os / arch combination
|
||
def pxe_prefix(arch)
|
||
"boot/#{to_s}-#{arch}".gsub(" ","-")
|
||
"boot/#{self}-#{arch}".gsub(" ","-")
|
||
end
|
||
|
||
def pxe_files(medium, arch, host = nil)
|
app/models/operatingsystems/solaris.rb | ||
---|---|---|
PXEFILES = {:initrd => "x86.miniroot", :kernel => "multiboot"}
|
||
|
||
def file_prefix
|
||
"#{to_s}".gsub(/[\s\(\)]/,"-").gsub("--", "-").gsub(/-\Z/, "")
|
||
"#{self}".gsub(/[\s\(\)]/,"-").gsub("--", "-").gsub(/-\Z/, "")
|
||
end
|
||
|
||
# sets the prefix for the tftp files based on the OS
|
app/models/report.rb | ||
---|---|---|
end
|
||
|
||
def to_label
|
||
"#{host.name} / #{reported_at.to_s}"
|
||
"#{host.name} / #{reported_at}"
|
||
end
|
||
|
||
def config_retrieval
|
app/models/setting.rb | ||
---|---|---|
|
||
def clear_cache
|
||
# ensures we don't have cache left overs in settings
|
||
Rails.logger.debug "removing #{name.to_s} from cache"
|
||
Rails.logger.debug "removing #{name} from cache"
|
||
Setting.cache.delete(name.to_s)
|
||
end
|
||
|
app/models/subnet.rb | ||
---|---|---|
end
|
||
|
||
def unused_ip(mac = nil, excluded_ips = [])
|
||
logger.debug "Not suggesting IP Address for #{to_s} as IPAM is disabled" and return unless ipam?
|
||
logger.debug "Not suggesting IP Address for #{self} as IPAM is disabled" and return unless ipam?
|
||
if self.ipam == IPAM_MODES[:dhcp] && dhcp?
|
||
# we have DHCP proxy so asking it for free IP
|
||
logger.debug "Asking #{dhcp.url} for free IP"
|
||
... | ... | |
return(ip)
|
||
end
|
||
end
|
||
logger.debug("Not suggesting IP Address for #{to_s} as no free IP found in our DB") and return
|
||
logger.debug("Not suggesting IP Address for #{self} as no free IP found in our DB") and return
|
||
end
|
||
rescue => e
|
||
logger.warn "Failed to fetch a free IP from our proxy: #{e}"
|
app/services/fact_parser.rb | ||
---|---|---|
return [int, values]
|
||
end
|
||
rescue Resolv::ResolvError => e
|
||
logger.debug "could not resolv name for #{ip} because of #{e.to_s} #{e.message}"
|
||
logger.debug "could not resolv name for #{ip} because of #{e} #{e.message}"
|
||
nil
|
||
end
|
||
end
|
config/initializers/sig_ttin_trap.rb | ||
---|---|---|
puts "============================================="
|
||
puts ""
|
||
Thread.list.each do |thread|
|
||
puts "Thread TID-#{thread.object_id.to_s}"
|
||
puts "Thread TID-#{thread.object_id}"
|
||
puts thread.backtrace
|
||
puts ""
|
||
end
|
lib/net/dhcp/record.rb | ||
---|---|---|
|
||
# Deletes the DHCP entry
|
||
def destroy
|
||
logger.info "Delete DHCP reservation for #{to_s}"
|
||
logger.info "Delete DHCP reservation for #{self}"
|
||
# it is safe to call destroy even if the entry does not exists, so we don't bother with validating anything here.
|
||
proxy.delete network, mac
|
||
end
|
||
|
||
# Create a DHCP entry
|
||
def create
|
||
logger.info "Create DHCP reservation for #{to_s}"
|
||
logger.info "Create DHCP reservation for #{self}"
|
||
begin
|
||
raise "Must define a hostname" if hostname.blank?
|
||
proxy.set network, attrs
|
||
rescue RestClient::Conflict
|
||
logger.warn "Conflicting DHCP reservation for #{to_s} detected"
|
||
logger.warn "Conflicting DHCP reservation for #{self} detected"
|
||
e = Net::Conflict.new
|
||
e.type = "dhcp"
|
||
e.expected = to_s
|
||
e.actual = conflicts
|
||
e.message = "in DHCP detected - expected #{to_s}, found #{conflicts.map(&:to_s).join(', ')}"
|
||
e.message = "in DHCP detected - expected #{self}, found #{conflicts.map(&:to_s).join(', ')}"
|
||
raise e
|
||
end
|
||
end
|
||
... | ... | |
|
||
# Verifies that are record already exists on the dhcp server
|
||
def valid?
|
||
logger.info "Fetching DHCP reservation for #{to_s}"
|
||
logger.info "Fetching DHCP reservation for #{self}"
|
||
self == proxy.record(network, mac)
|
||
end
|
||
|
lib/net/dns.rb | ||
---|---|---|
end
|
||
|
||
def destroy
|
||
logger.info "Delete the DNS #{type} record for #{to_s}"
|
||
logger.info "Delete the DNS #{type} record for #{self}"
|
||
end
|
||
|
||
def create
|
||
raise "Must define a hostname" if hostname.blank?
|
||
logger.info "Add DNS #{type} record for #{to_s}"
|
||
logger.info "Add DNS #{type} record for #{self}"
|
||
end
|
||
|
||
def attrs
|
||
... | ... | |
protected
|
||
|
||
def generate_conflict_error
|
||
logger.warn "Conflicting DNS #{type} record for #{to_s} detected"
|
||
logger.warn "Conflicting DNS #{type} record for #{self} detected"
|
||
e = Net::Conflict.new
|
||
e.type = "dns"
|
||
e.expected = to_s
|
||
e.actual = conflicts
|
||
e.message = "DNS conflict detected - expected #{to_s}, found #{conflicts.map(&:to_s).join(', ')}"
|
||
e.message = "DNS conflict detected - expected #{self}, found #{conflicts.map(&:to_s).join(', ')}"
|
||
e
|
||
end
|
||
|
lib/net/dns/ptr_record.rb | ||
---|---|---|
|
||
# Verifies that a record already exists on the dns server
|
||
def valid?
|
||
logger.debug "Fetching DNS reservation for #{to_s}"
|
||
logger.debug "Fetching DNS reservation for #{self}"
|
||
self == dns_lookup(ip)
|
||
end
|
||
|
test/test_runner.rb | ||
---|---|---|
Foreman::Plugin.tests_to_skip[self.to_s].detect do |string|
|
||
# Use a substring match, as test => "test_0010_foo" and string => "foo"
|
||
if test[string]
|
||
puts "skipping #{self.to_s}##{test}"
|
||
puts "skipping #{self}##{test}"
|
||
string
|
||
end
|
||
end
|
test/unit/setting_test.rb | ||
---|---|---|
end
|
||
|
||
def test_attributes_in_SETTINGS_are_readonly
|
||
setting_name = "foo_#{rand(1000000).to_s}"
|
||
setting_name = "foo_#{rand(1000000)}"
|
||
Setting.create!(:name => setting_name, :value => "bar", :default => "default", :description => "foo")
|
||
SETTINGS[setting_name.to_sym] = "no-bar"
|
||
|
||
... | ... | |
end
|
||
|
||
def test_value_is_updated_after_change_in_SETTINGS
|
||
setting_name = "foo_#{rand(1000000).to_s}"
|
||
setting_name = "foo_#{rand(1000000)}"
|
||
Setting.create!(:name => setting_name, :value => "bar", :default => "default", :description => "foo")
|
||
|
||
SETTINGS.stubs(:key?).with(setting_name.to_sym).returns(true)
|
Also available in: Unified diff
Refs #3809 - Enable cop StringConversionInInterpolation