Skip to content

Commit

Permalink
Merge pull request #16033 from bdunne/delete_commented_code
Browse files Browse the repository at this point in the history
Delete more commented code
  • Loading branch information
jrafanie authored Sep 26, 2017
2 parents 1b98304 + b523a54 commit cd3db79
Show file tree
Hide file tree
Showing 23 changed files with 0 additions and 72 deletions.
1 change: 0 additions & 1 deletion app/models/chargeback_rate_detail_currency.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class ChargebackRateDetailCurrency < ApplicationRecord
belongs_to :chargeback_rate_detail

# YAML.load_file(File.join(Rails.root, "db/fixtures/chargeback_rate_detail_currencies.yml"))
validates :code, :presence => true, :length => {:maximum => 100}
validates :name, :presence => true, :length => {:maximum => 100}
validates :full_name, :presence => true, :length => {:maximum => 100}
Expand Down
9 changes: 0 additions & 9 deletions app/models/classification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def self.managed
def ns
@ns ||= DEFAULT_NAMESPACE if self.new_record?

# @ns = tag2ns(self.tag.name) unless self.tag.nil?
return @ns if tag.nil?

return @ns unless @ns.nil?
Expand Down Expand Up @@ -344,14 +343,6 @@ def tag2ns(tag)
unless tag.nil?
ta = tag.split("/")
ta[0..(ta.length - 2)].join("/")

# tnew = []
# tag.split("/").each {|level|
# p "level=#{level}"
# tnew.push(level) unless level == self.name
# p "level=#{level}, #{tnew.inspect}, #{(level == self.name)}"
# }
# tnew.join("/")
end
end

Expand Down
2 changes: 0 additions & 2 deletions app/models/job_proxy_dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ def busy_proxy?(proxy, _job)

# Return if the active job count meets or exceeds the max allowed concurrent jobs for the agent
if active_job_count >= concurrent_job_max
# _log.debug("Too many active scans using resource: [#{proxy.class}]:[#{proxy.id}]. Count/Limit: [#{active_job_count} / #{concurrent_job_max}]")
return true
end

Expand Down Expand Up @@ -332,7 +331,6 @@ def embedded_resource_limit_exceeded?(job)
target_resource = embedded_scan_resource(@vm)
count = busy_resources_for_embedded_scanning[target_resource]
if count && count >= count_allowed
# _log.debug("Too many active scans using resource: [#{target_resource}], Count/Limit: [#{count} / #{count_allowed}]")
return true
end
rescue
Expand Down
1 change: 0 additions & 1 deletion app/models/ldap_domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def connect(server = nil)
options[:domain_prefix] = domain_prefix
options[:bind_timeout] = bind_timeout
options[:search_timeout] = search_timeout
# options[:] = (self.follow_referrals)

@ldap = MiqLdap.new(options)
begin
Expand Down
6 changes: 0 additions & 6 deletions app/models/miq_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ def miq_policies

def self.invoke_actions(apply_policies_to, inputs, succeeded, failed)
deferred = []
# _log.info("succeeded policies: #{succeeded.inspect}")
# _log.info("failed policies: #{failed.inspect}")

results = {}

begin
Expand All @@ -115,7 +112,6 @@ def self.invoke_actions(apply_policies_to, inputs, succeeded, failed)
else p.actions_for_event
end

# _log.debug("actions on failure: #{actions.inspect}")
actions.each do|a|
# merge in the synchronous flag and possibly the sequence if not already sorted by this
inputs = inputs.merge(:policy => p, :result => false, :sequence => a.sequence, :synchronous => a.synchronous)
Expand All @@ -135,7 +131,6 @@ def self.invoke_actions(apply_policies_to, inputs, succeeded, failed)
succeeded.each do|p|
next unless p.kind_of?(MiqPolicy) # built-in policies are OpenStructs whose actions will be invoked only on failure
actions = p.actions_for_event(inputs[:event], :success).uniq
# _log.info("actions on success: #{actions.inspect}")
actions.each do|a|
inputs = inputs.merge(:policy => p, :result => true, :sequence => a.sequence, :synchronous => a.synchronous)
_log.debug("action: [#{a.name}], seq: [#{a.sequence}], sync: [#{a.synchronous}], inputs to action: seq: [#{inputs[:sequence]}], sync: [#{inputs[:synchronous]}]")
Expand Down Expand Up @@ -201,7 +196,6 @@ def invoke_action_for_built_in_policy(rec, inputs)
end

def action_prevent(_action, _rec, _inputs)
# MiqPolicy.logger.warn("MIQ(action_prevent): Invoking action [prevent] for policy: [#{inputs[:policy].description}], event: [#{inputs[:event].description}], entity name: [#{rec.name}], entity type: [#{Dictionary.gettext(rec.class.to_s, :type=>:model)}]")
raise MiqException::PolicyPreventAction, "preventing current process from proceeding due to policy failure"
end

Expand Down
2 changes: 0 additions & 2 deletions app/models/miq_event_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ def self.add_elements(_vm, xmlNode)
end
end

# _log.warn "[#{xmlNode}]"
# add_missing_elements(vm, xmlNode, "Applications/Products/Products", "win32_product", WIN32_APPLICATION_MAPPING)
File.open("./xfer_#{xmlNode.root.name}.xml", "w") { |f| xmlNode.write(f, 0) }
rescue
end
Expand Down
1 change: 0 additions & 1 deletion app/models/miq_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ def self.separate_profiles_from_policies(policies)
def add_action_for_event(event, action, opt_hash = nil)
# we now expect an options hash provided by the UI, merge the qualifier with the options_hash
# overwriting with the values from the options hash
# _log.debug("opt_hash: #{opt_hash.inspect}")
opt_hash = {:qualifier => :failure}.merge(opt_hash)

# update the correct DB sequence and synchronous value with the value from the UI
Expand Down
1 change: 0 additions & 1 deletion app/models/miq_report/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ def build_add_missing_timestamps(recs)
while (rec.timestamp - last_rec.timestamp) > int
base_attrs = last_rec.attributes.reject { |k, _v| !base_cols.include?(k) }
last_rec = klass.new(base_attrs.merge(:timestamp => (last_rec.timestamp + int)))
# $log.info("XXX: Adding timestamp: [#{last_rec.timestamp}]")
last_rec.inside_time_profile = false if last_rec.respond_to?(:inside_time_profile)
arr << last_rec
end
Expand Down
1 change: 0 additions & 1 deletion app/models/miq_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ def action_vm_scan(obj, _at)
sched_action[:options] ||= {}
obj.scan_queue(userid, sched_action[:options])
_log.info("Action [#{name}] has been run for target: [#{obj.name}]")
# puts("[#{Time.now}] MIQ(Schedule.action_vm_scan) Action [#{self.name}] has been run for target: [#{obj.name}]")
end

def action_scan(obj, _at)
Expand Down
1 change: 0 additions & 1 deletion app/models/miq_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ def kill
end
end

# ActiveRecord::Base.connection.kill(self.sql_spid)
destroy
end

Expand Down
4 changes: 0 additions & 4 deletions app/models/service_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,9 @@ def create_service(service_task, parent_svc = nil)

nh['initiator'] = service_task.options[:initiator] if service_task.options[:initiator]

# Determine service name
# target_name = self.get_option(:target_name)
# nh['name'] = target_name unless target_name.blank?
svc = Service.create(nh)
svc.service_template = self

# self.options[:service_guid] = svc.guid
service_resources.each do |sr|
nh = sr.attributes.dup
%w(id created_at updated_at service_template_id).each { |key| nh.delete(key) }
Expand Down
2 changes: 0 additions & 2 deletions app/models/vim_performance_trend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def self.build(perfs, options)
options[:target_pcts].each do |pct|
col_name = "limit_pct_value_#{options[:target_pcts].index(pct) + 1}"
pct_of_limit = (limit * pct * 0.01)
# row[col_name] = self.calc_value_at_target(pct_of_limit, trend_data[name]) || "Unknown"
row[col_name] = calc_value_at_target(pct_of_limit, trend_data[name])
if row[col_name].nil?
row[col_name] = "Unknown"
Expand Down Expand Up @@ -133,7 +132,6 @@ def self.calc_value_at_target(limit, trend_data)
else
begin
result = MiqStats.solve_for_x(limit, trend_data[:slope], trend_data[:yint])
# return Time.at(result).utc.strftime("%m/%d/%Y")
return Time.at(result).utc
rescue RangeError
return nil
Expand Down
1 change: 0 additions & 1 deletion app/models/vm_reconfigure_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def do_request
update_and_notify_parent(:state => 'reconfigured', :message => "Finished #{request_class::TASK_DESCRIPTION}")
else
update_and_notify_parent(:state => 'finished', :message => "#{request_class::TASK_DESCRIPTION} complete")
# call_automate_event('vm_provision_postprocessing')
end
end
end
3 changes: 0 additions & 3 deletions app/models/vmdb_metric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ class VmdbMetric < ApplicationRecord
include_concern 'Purging'

def self.rollup_metrics(resource, _interval_name, rollup_date)
# tp = TimeProfile.find_by(:description => "UTC")

rows = 0
size = 0
wasted_bytes = 0
Expand All @@ -16,7 +14,6 @@ def self.rollup_metrics(resource, _interval_name, rollup_date)
metric ||= resource.vmdb_metrics.build(:capture_interval_name => 'daily', :timestamp => rollup_date.beginning_of_day)

# Fetch all hourly records for the table for date requested...
# Metric::Finders.find_all_by_day(table, rollup_date, interval_name, tp).each do |h|
resource.vmdb_metrics.where(:capture_interval_name => 'hourly', :timestamp => (rollup_date.beginning_of_day..rollup_date.end_of_day)).each do |h|
# Data conversion added, found cases where nil values were stored in db...
rows += h.rows.to_i
Expand Down
1 change: 0 additions & 1 deletion spec/lib/rbac/filterer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,6 @@ def get_rbac_results_for_and_expect_objects(klass, expected_objects)
expect(described_class.new.send(:apply_rbac_through_association?, Vm)).not_to be
end

# find_targets_with_direct_rbac(klass, scope, rbac_filters, find_options, user_or_group)
describe "find_targets_with_direct_rbac" do
let(:host_match) { FactoryGirl.create(:host, :hostname => 'good') }
let(:host_other) { FactoryGirl.create(:host, :hostname => 'bad') }
Expand Down
2 changes: 0 additions & 2 deletions spec/models/job_proxy_dispatcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@
context "with jobs, a default smartproxy for repo scanning" do
before(:each) do
allow(MiqVimBrokerWorker).to receive(:available?).and_return(true)
# JobProxyDispatcher.stub(:start_job_on_proxy).and_return(nil)
# MiqProxy.any_instance.stub(:concurrent_job_max).and_return(1)
@repo_proxy = @proxies.last
if @repo_proxy
@repo_proxy.name = "repo_proxy"
Expand Down
1 change: 0 additions & 1 deletion spec/models/miq_schedule_worker/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@

context "calling check_roles_changed" do
before(:each) do
# MiqScheduleWorker::Runner.any_instance.stub(:schedules_for_scheduler_role)
allow(@schedule_worker).to receive(:worker_settings).and_return(Hash.new(5.minutes))
@schedule_worker.instance_variable_set(:@schedules, :scheduler => [])

Expand Down
8 changes: 0 additions & 8 deletions spec/models/service/retirement_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,6 @@
expect(@service.retirement_due?).to be_falsey
end

# it "#retirement_warn" do
# expect(@service.retirement_warn).to be_nil
# @service.update_attributes(:retirement_last_warn => Time.zone.today)
# @service.retirement_warn = 60
# expect(@service.retirement_warn).to eq(60)
# expect(@service.retirement_last_warn).to be_nil
# end

it "#retirement_due?" do
expect(@service.retirement_due?).to be_falsey

Expand Down
4 changes: 0 additions & 4 deletions spec/models/service_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,6 @@
expect { add_and_save_service(@svc_c, @svc_a) }.to raise_error(MiqException::MiqServiceCircularReferenceError)
expect { add_and_save_service(@svc_d, @svc_a) }.to raise_error(MiqException::MiqServiceCircularReferenceError)
expect { add_and_save_service(@svc_c, @svc_b) }.to raise_error(MiqException::MiqServiceCircularReferenceError)

# Print tree-view of services
# puts "\n#{svc_a.name}"
# print_svc(svc_a, " ")
end

it "should not allow deeply nested service templates to be connected in a circular reference" do
Expand Down
8 changes: 0 additions & 8 deletions spec/models/vim_performance_analysis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

# currently, only vms have data, but only host data is returned
results = VimPerformanceAnalysis.find_child_perf_for_time_period(ems, "daily", options)
# expect(results).not_to be_empty
VimPerformanceAnalysis.group_perf_by_timestamp(ems, results, cols)

# for now, we're just content that it did not blow up
Expand All @@ -74,13 +73,6 @@
end
end

# describe ".child_tags_over_time_period" do
# it "returns only tagged nodes" do
# good_vm = FactoryGirl.create(:vm_vmware, :tags => [tag_good])
# bad_vm = FactoryGirl.create(:vm_vmware, :tags => [tag_bad])
# end
# end

describe ".get_daily_perf" do
it "should not raise an error" do
range = {:days => 7, :end_date => "2016-04-19T23:00:00Z".to_time}
Expand Down
9 changes: 0 additions & 9 deletions spec/models/vm/retirement_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@
expect(@vm.retirement_due?).to be_falsey
end

# it "#retirement_warn" do
# expect(@vm.retirement_warn).to be_nil
# @vm.update_attributes(:retirement_last_warn => Time.zone.today)
# @vm.retirement_warn = 60

# expect(@vm.retirement_warn).to eq(60)
# expect(@vm.retirement_last_warn).to be_nil
# end

it "#retirement_due?" do
vm = FactoryGirl.create(:vm_vmware, :ems_id => @ems.id)
expect(vm.retirement_due?).to be_falsey
Expand Down
3 changes: 0 additions & 3 deletions spec/tools/fix_auth/auth_model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
context "#authentications" do
subject { FixAuth::FixAuthentication }
let(:contenders) { subject.contenders.collect(&:name) }

# NOTE: these are not created unless you reference them
# if you want to always create them use let!(:var) {} instead
let(:v1_v2) { subject.create(:name => "v2_v1", :password => enc_v2, :auth_key => enc_v1) }
let(:v2_v1) { subject.create(:name => "v1_v2", :password => enc_v1, :auth_key => enc_v2) }
let(:v1) { subject.create(:name => "v1", :password => enc_v1) }
Expand Down
1 change: 0 additions & 1 deletion tools/ldap_ping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

LOG_DIR = "./"
logfile = File.join(LOG_DIR, "ldap_ping.log")
# File.delete(logfile) if File.exist?(logfile)
$log = VMDBLogger.new(logfile)
$log.level = VMDBLogger.const_get("INFO")

Expand Down

0 comments on commit cd3db79

Please sign in to comment.