cloudamatic/mu

View on GitHub

Showing 2,704 of 2,705 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

["allow_major_version_upgrade", "auto_minor_version_upgrade", "license_model", "storage_type", "port"].each { |arg|
if !@config[arg].nil?
key = ""
arg.split(/_/).each { |chunk| key = key + chunk.capitalize }
MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], key, @config[arg])
Severity: Minor
Found in modules/mu/providers/cloudformation/database.rb and 1 other location - About 45 mins to fix
modules/mu/providers/cloudformation/database.rb on lines 191..195

Similar blocks of code found in 2 locations. Consider refactoring.
Open

["engine", "backup_retention_period", "preferred_backup_window", "engine_version", "preferred_maintenance_window"].each { |arg|
if !@config[arg].nil?
key = ""
arg.split(/_/).each { |chunk| key = key + chunk.capitalize }
MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], key, @config[arg])
Severity: Minor
Found in modules/mu/providers/cloudformation/database.rb and 1 other location - About 45 mins to fix
modules/mu/providers/cloudformation/database.rb on lines 85..89

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if !group['domain']
if my_domains.size == 1
group['domain'] = my_domains.first
elsif my_domains.size > 1
MU.log "Google interactive User #{group['name']} did not specify a domain, and we have multiple defaults available. Must specify exactly one.", MU::ERR, details: my_domains
Severity: Minor
Found in modules/mu/providers/google/group.rb and 1 other location - About 45 mins to fix
modules/mu/providers/google/user.rb on lines 605..613

Identical blocks of code found in 2 locations. Consider refactoring.
Open

@vpc.subnets.each { |subnet_obj|
next if subnet_obj.private? and ["all_public", "public"].include?(@config["vpc"]["subnet_pref"])
next if !subnet_obj.private? and ["all_private", "private"].include?(@config["vpc"]["subnet_pref"])
subnet_ids << subnet_obj.cloud_id
Severity: Minor
Found in modules/mu/providers/aws/search_domain.rb and 1 other location - About 45 mins to fix
modules/mu/providers/aws/server_pool.rb on lines 1416..1419

Identical blocks of code found in 2 locations. Consider refactoring.
Open

@vpc.subnets.each { |subnet_obj|
next if subnet_obj.private? and ["all_public", "public"].include?(@config["vpc"]["subnet_pref"])
next if !subnet_obj.private? and ["all_private", "private"].include?(@config["vpc"]["subnet_pref"])
subnet_ids << subnet_obj.cloud_id
Severity: Minor
Found in modules/mu/providers/aws/server_pool.rb and 1 other location - About 45 mins to fix
modules/mu/providers/aws/search_domain.rb on lines 707..710

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if !arguments.nil? and arguments.size == 1
retval = @myobject.method(method_sym).call(arguments[0])
elsif !arguments.nil? and arguments.size > 0
retval = @myobject.method(method_sym).call(*arguments)
else
Severity: Major
Found in modules/mu/providers/azure.rb and 2 other locations - About 40 mins to fix
modules/mu/providers/azure.rb on lines 1065..1071
modules/mu/providers/google.rb on lines 1258..1264

Identical blocks of code found in 2 locations. Consider refactoring.
Open

lb_options[:listeners].each do |listener|
if listener[:protocol].upcase == 'HTTP' or listener[:protocol].upcase == 'HTTPS'
listener_policy[:load_balancer_port] = listener[:load_balancer_port]
MU::Cloud::AWS.elb(region: @region, credentials: @credentials).set_load_balancer_policies_of_listener(listener_policy)
end
Severity: Minor
Found in modules/mu/providers/aws/loadbalancer.rb and 1 other location - About 40 mins to fix
modules/mu/providers/aws/loadbalancer.rb on lines 539..543

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if (!defined? rule['hosts'] or !rule['hosts'].is_a?(Array)) and
(!defined? rule['sgs'] or !rule['sgs'].is_a?(Array)) and
(!defined? rule['lbs'] or !rule['lbs'].is_a?(Array))
raise MuError, "One of 'hosts', 'sgs', or 'lbs' in rules provided to createEc2SG must be an array."
end
Severity: Minor
Found in modules/mu/providers/cloudformation/firewall_rule.rb and 1 other location - About 40 mins to fix
modules/mu/providers/aws/firewall_rule.rb on lines 882..886

Similar blocks of code found in 2 locations. Consider refactoring.
Open

elsif !subnet['subnet_id']
subnet['subnet_id'] = ext_subnet.cloud_id
subnet['az'] = ext_subnet.az
subnet.delete('subnet_name')
subnet.delete('tag')
Severity: Minor
Found in modules/mu/config/vpc.rb and 1 other location - About 40 mins to fix
modules/mu/config/vpc.rb on lines 882..888

Identical blocks of code found in 2 locations. Consider refactoring.
Open

lb_options[:listeners].each do |listener|
if listener[:protocol].upcase == 'HTTP' or listener[:protocol].upcase == 'HTTPS'
listener_policy[:load_balancer_port] = listener[:load_balancer_port]
MU::Cloud::AWS.elb(region: @region, credentials: @credentials).set_load_balancer_policies_of_listener(listener_policy)
end
Severity: Minor
Found in modules/mu/providers/aws/loadbalancer.rb and 1 other location - About 40 mins to fix
modules/mu/providers/aws/loadbalancer.rb on lines 495..499

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if !arguments.nil? and arguments.size == 1
retval = @api.method(method_sym).call(arguments[0])
elsif !arguments.nil? and arguments.size > 0
retval = @api.method(method_sym).call(*arguments)
else
Severity: Major
Found in modules/mu/providers/google.rb and 2 other locations - About 40 mins to fix
modules/mu/providers/azure.rb on lines 1065..1071
modules/mu/providers/azure.rb on lines 1100..1106

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def self.getOrg(org)
begin
Timeout::timeout(45) {
response = chefAPI.get("organizations/#{org}")
return response
Severity: Minor
Found in modules/mu/master/chef.rb and 1 other location - About 40 mins to fix
modules/mu/master/chef.rb on lines 32..42

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if !strip_std
MU::MommaCat.listStandardTags.each_pair { |key, value|
@config['tags'] << { "key" => key, "value" => value }
}
 
 
Severity: Minor
Found in modules/mu/providers/aws/user.rb and 1 other location - About 40 mins to fix
modules/mu/providers/aws/role.rb on lines 1278..1285

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if use_cache
begin
win_admin_password = @groomer.getSecret(
vault: @config['windows_auth_vault']['vault'],
item: @config['windows_auth_vault']['item'],
Severity: Minor
Found in modules/mu/providers/aws/server.rb and 1 other location - About 40 mins to fix
modules/mu/providers/google/server.rb on lines 1028..1037

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if (!defined? rule['hosts'] or !rule['hosts'].is_a?(Array)) and
(!defined? rule['firewall_rules'] or !rule['firewall_rules'].is_a?(Array)) and
(!defined? rule['loadbalancers'] or !rule['loadbalancers'].is_a?(Array))
rule['hosts'] = ["0.0.0.0/0"]
end
Severity: Minor
Found in modules/mu/providers/aws/firewall_rule.rb and 1 other location - About 40 mins to fix
modules/mu/providers/cloudformation/firewall_rule.rb on lines 220..224

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if !arguments.nil? and arguments.size == 1
retval = @api.method(method_sym).call(arguments[0])
elsif !arguments.nil? and arguments.size > 0
retval = @api.method(method_sym).call(*arguments)
else
Severity: Major
Found in modules/mu/providers/azure.rb and 2 other locations - About 40 mins to fix
modules/mu/providers/azure.rb on lines 1100..1106
modules/mu/providers/google.rb on lines 1258..1264

Similar blocks of code found in 2 locations. Consider refactoring.
Open

elsif File.exist?(userdir+"/"+field)
all_user_data[key][field] = File.read(userdir+"/"+field).chomp
elsif ["email", "realname"].include?(field)
MU.log "Required user field '#{field}' for '#{key}' not set in LDAP or in Mu's disk cache.", MU::WARN
end
Severity: Minor
Found in modules/mu/master.rb and 1 other location - About 40 mins to fix
modules/mu/master.rb on lines 348..352

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if use_cache
begin
win_admin_password = @groomer.getSecret(
vault: @config['windows_auth_vault']['vault'],
item: @config['windows_auth_vault']['item'],
Severity: Minor
Found in modules/mu/providers/google/server.rb and 1 other location - About 40 mins to fix
modules/mu/providers/aws/server.rb on lines 1179..1189

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if !strip_std
MU::MommaCat.listStandardTags.each_pair { |key, value|
@config['tags'] << { "key" => key, "value" => value }
}
 
 
Severity: Minor
Found in modules/mu/providers/aws/role.rb and 1 other location - About 40 mins to fix
modules/mu/providers/aws/user.rb on lines 558..565

Similar blocks of code found in 2 locations. Consider refactoring.
Open

file "#{splunk_dir}/etc/auth/splunkweb/#{ssl_options['crtfile']}" do
content certs[ssl_options['crtfile']]
owner node['splunk']['user']['username']
group node['splunk']['user']['username']
mode 00600
Severity: Minor
Found in cookbooks/mu-splunk/recipes/setup_ssl.rb and 1 other location - About 40 mins to fix
cookbooks/mu-splunk/recipes/setup_ssl.rb on lines 49..54
Severity
Category
Status
Source
Language