crowbar/crowbar-openstack

View on GitHub

Showing 748 of 748 total issues

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

database_user "grant database access for watcher database user" do
  connection db_settings[:connection]
  username node[:watcher][:db][:user]
  password node[:watcher][:db][:password]
  database_name node[:watcher][:db][:database]
Severity: Major
Found in chef/cookbooks/watcher/recipes/common.rb and 8 other locations - About 1 hr to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 60..70
chef/cookbooks/cinder/recipes/sql.rb on lines 51..61
chef/cookbooks/designate/recipes/sql.rb on lines 47..57
chef/cookbooks/glance/recipes/common.rb on lines 53..63
chef/cookbooks/heat/recipes/server.rb on lines 45..55
chef/cookbooks/keystone/recipes/server.rb on lines 278..288
chef/cookbooks/manila/recipes/sql.rb on lines 34..44
chef/cookbooks/sahara/recipes/sql.rb on lines 47..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

database_user "grant database access for designate database user" do
  connection db_settings[:connection]
  username node[:designate][:db][:user]
  password node[:designate][:db][:password]
  database_name node[:designate][:db][:database]
Severity: Major
Found in chef/cookbooks/designate/recipes/sql.rb and 8 other locations - About 1 hr to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 60..70
chef/cookbooks/cinder/recipes/sql.rb on lines 51..61
chef/cookbooks/glance/recipes/common.rb on lines 53..63
chef/cookbooks/heat/recipes/server.rb on lines 45..55
chef/cookbooks/keystone/recipes/server.rb on lines 278..288
chef/cookbooks/manila/recipes/sql.rb on lines 34..44
chef/cookbooks/sahara/recipes/sql.rb on lines 47..57
chef/cookbooks/watcher/recipes/common.rb on lines 52..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    db_synced = node[:neutron][:db_synced_apic_gbp]
    is_founder = CrowbarPacemakerHelper.is_cluster_founder?(node)
    execute "gbp-db-manage upgrade head" do
      user node[:neutron][:user]
      group node[:neutron][:group]
Severity: Major
Found in chef/cookbooks/neutron/recipes/server.rb and 1 other location - About 1 hr to fix
chef/cookbooks/neutron/recipes/server.rb on lines 347..363

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method action_grant has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def action_grant
          db_name = new_resource.database_name || "*"
          tbl_name = new_resource.table || "*"

          username = client.escape(new_resource.username)
Severity: Minor
Found in chef/cookbooks/database/libraries/provider_database_mysql_user.rb - About 1 hr to fix

Method role_constraints has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def role_constraints
      {
        "swift-storage" => {
          "unique" => false,
          "count" => -1,
Severity: Minor
Found in crowbar_framework/app/models/swift_service.rb - About 1 hr to fix

Method binaryround has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def binaryround(value)

    # Keep a multiplier which grows through powers of 1
    multiplier = 1

Severity: Minor
Found in chef/cookbooks/postgresql/libraries/default.rb - About 1 hr to fix

Method run_report has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run_report(node)
    raise "unable to look up a #{@bc_name} proposal applied to #{node.inspect}" if (proposal = _get_proposal_by_node node).nil?

    report_run_uuid = `uuidgen`.strip
    report_run = {
Severity: Minor
Found in crowbar_framework/app/models/swift_service.rb - About 1 hr to fix

Method create_proposal has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_proposal
    base = super

    base[:attributes][:swift][:cluster_hash] = "%x%s" %  [rand(100000),rand(100000)]

Severity: Minor
Found in crowbar_framework/app/models/swift_service.rb - About 1 hr to fix

Method enable_neutron_networks has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def enable_neutron_networks(attributes, nodename, net_svc, needs_external = true)
    if needs_external
      net_svc.enable_interface "default", "nova_floating", nodename
      attributes["additional_external_networks"].each do |extnet|
        net_svc.enable_interface "default", extnet, nodename
Severity: Minor
Found in crowbar_framework/app/models/neutron_service.rb - About 1 hr to fix

Method create_proposal has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_proposal
    @logger.debug("Manila create_proposal: entering")
    base = super

    nodes = NodeObject.all
Severity: Minor
Found in crowbar_framework/app/models/manila_service.rb - About 1 hr to fix

Method clear_dispersion_reports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def clear_dispersion_reports
    def delete_file(file_name)
      File.delete(file_name) if File.exist?(file_name)
    end

Severity: Minor
Found in crowbar_framework/app/models/swift_service.rb - About 1 hr to fix

Method clear_test_runs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def clear_test_runs
    def delete_file(file_name)
      File.delete(file_name) if File.exist?(file_name)
    end

Severity: Minor
Found in crowbar_framework/app/models/tempest_service.rb - About 1 hr to fix

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

def upgrade(ta, td, a, d)
  # new defaults
  a["volume_defaults"]["eqlx"]["ssh_conn_timeout"] = \
    ta["volume_defaults"]["eqlx"]["ssh_conn_timeout"]
  a["volume_defaults"]["eqlx"].delete "eqlx_cli_timeout"
chef/data_bags/crowbar/migrate/cinder/015_rename_vmware_volume_folder.rb on lines 20..30

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        api: {
          bind_host: if !ha_enabled && node[:octavia][:api][:bind_open_address]
                       "0.0.0.0"
                     else
                       @admin_ip
Severity: Major
Found in chef/cookbooks/octavia/libraries/helpers.rb and 1 other location - About 1 hr to fix
chef/cookbooks/designate/libraries/helpers.rb on lines 31..44

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def downgrade ta, td, a, d
  a["volume_defaults"]["vmware"]["volume"] = a["volume_defaults"]["vmware"]["volume_folder"]
  a["volume_defaults"]["vmware"].delete("volume_folder")

  a["volumes"].each do |volume|
chef/data_bags/crowbar/migrate/cinder/200_update_eqlx_options.rb on lines 1..13

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        api: {
          bind_host: if !ha_enabled && node[:designate][:api][:bind_open_address]
                       "0.0.0.0"
                     else
                       @ip
Severity: Major
Found in chef/cookbooks/designate/libraries/helpers.rb and 1 other location - About 1 hr to fix
chef/cookbooks/octavia/libraries/helpers.rb on lines 90..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method upgrade has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def upgrade ta, td, a, d
  # Old proposals had passwords created in the cookbook, so we need to migrate
  # them in the proposal and in the role. We use a class variable to set the
  # same password in the proposal and in the role.
  service = ServiceObject.new "fake-logger"
Severity: Minor
Found in chef/data_bags/crowbar/migrate/ceilometer/004_generate_secrets.rb - About 1 hr to fix

Method get_neutron_physnets has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.get_neutron_physnets(node, external_networks)
    # This assumes that "nova_fixed" will always be on the physnet called
    # "physnet1" in neutron.
    # Also we don't allow to put 2 external networks on the same neutron
    # physnet.
Severity: Minor
Found in chef/cookbooks/neutron/libraries/helpers.rb - About 1 hr to fix

Method scan_available_timezones has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def scan_available_timezones(tzdir)
    # There should be an /etc/localtime zoneinfo file that is a link to
    # (or a copy of) a timezone data file under tzdir, which should have
    # been installed under the "share" directory by the tzdata package.
    #
Severity: Minor
Found in chef/cookbooks/postgresql/libraries/default.rb - About 1 hr to fix

Method validate_proposal_after_save has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "database-server"

    attributes = proposal["attributes"][@bc_name]
    deployment = proposal["deployment"][@bc_name]
Severity: Minor
Found in crowbar_framework/app/models/database_service.rb - About 1 hr to fix
Severity
Category
Status
Source
Language