cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb

Summary

Maintainability
F
5 days
Test Coverage

File cloud.rb has 566 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Bosh::CloudStackCloud
  ##
  # BOSH CloudStack CPI
  class Cloud < Bosh::Cloud
    include Helpers
Severity: Major
Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 1 day to fix

    Method create_vm has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_vm(agent_id, stemcell_id, resource_pool,
                      network_spec = nil, disk_locality = nil, environment = nil)
          with_thread_name("create_vm(#{agent_id}, ...)") do
            @logger.info("Creating new server...")
            server_name = "vm-#{generate_unique_name}"
    Severity: Minor
    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Class Cloud has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Cloud < Bosh::Cloud
        include Helpers
    
        BOSH_APP_DIR = "/var/vcap/bosh"
        FIRST_DEVICE_NAME_LETTER = "b"
    Severity: Minor
    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 4 hrs to fix

      Method create_vm has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def create_vm(agent_id, stemcell_id, resource_pool,
                        network_spec = nil, disk_locality = nil, environment = nil)
            with_thread_name("create_vm(#{agent_id}, ...)") do
              @logger.info("Creating new server...")
              server_name = "vm-#{generate_unique_name}"
      Severity: Major
      Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 3 hrs to fix

        Method delete_vm has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def delete_vm(server_id)
              with_thread_name("delete_vm(#{server_id})") do
                @logger.info("Deleting server `#{server_id}'...")
                server = with_compute { @compute.servers.get(server_id) }
                if server
        Severity: Minor
        Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method create_disk has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_disk(size, server_id = nil)
              with_thread_name("create_disk(#{size}, #{server_id})") do
                raise ArgumentError, "Disk size needs to be an integer" unless size.kind_of?(Integer)
                cloud_error("Minimum disk size is 1 GiB") if (size < 1024)
                cloud_error("Maximum disk size is 1 TiB") if (size > 1024 * 1000)
        Severity: Minor
        Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            def initialize(options)
              @options = options.dup
        
              validate_options
              initialize_registry
        Severity: Minor
        Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 1 hr to fix

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

              def create_stemcell(image_path, stemcell_properties)
                with_thread_name("create_stemcell(#{image_path}...)") do
                  creator = StemcellCreator.new(@default_zone, stemcell_properties, self)
          
                  begin
          Severity: Minor
          Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 1 hr to fix

            Method delete_vm has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def delete_vm(server_id)
                  with_thread_name("delete_vm(#{server_id})") do
                    @logger.info("Deleting server `#{server_id}'...")
                    server = with_compute { @compute.servers.get(server_id) }
                    if server
            Severity: Minor
            Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 1 hr to fix

              Method create_disk has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def create_disk(size, server_id = nil)
                    with_thread_name("create_disk(#{size}, #{server_id})") do
                      raise ArgumentError, "Disk size needs to be an integer" unless size.kind_of?(Integer)
                      cloud_error("Minimum disk size is 1 GiB") if (size < 1024)
                      cloud_error("Maximum disk size is 1 TiB") if (size > 1024 * 1000)
              Severity: Minor
              Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 1 hr to fix

                Method create_stemcell has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def create_stemcell(image_path, stemcell_properties)
                      with_thread_name("create_stemcell(#{image_path}...)") do
                        creator = StemcellCreator.new(@default_zone, stemcell_properties, self)
                
                        begin
                Severity: Minor
                Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 55 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method snapshot_disk has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def snapshot_disk(disk_id, metadata)
                      with_thread_name("snapshot_disk(#{disk_id})") do
                        volume = compute.volumes.get(disk_id)
                        cloud_error("Volume `#{disk_id}' not found") unless volume
                        device = volume_device_name(volume.device_id) if volume.device_id
                Severity: Minor
                Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 55 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method detach_disk has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def detach_disk(server_id, disk_id)
                      with_thread_name("detach_disk(#{server_id}, #{disk_id})") do
                        server = with_compute { @compute.servers.get(server_id) }
                        cloud_error("Server `#{server_id}' not found") unless server
                
                
                Severity: Minor
                Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method create_vm has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def create_vm(agent_id, stemcell_id, resource_pool,
                                  network_spec = nil, disk_locality = nil, environment = nil)
                Severity: Minor
                Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 45 mins to fix

                  Method attach_disk has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def attach_disk(server_id, disk_id)
                        with_thread_name("attach_disk(#{server_id}, #{disk_id})") do
                          server = with_compute { @compute.servers.get(server_id) }
                          cloud_error("Server `#{server_id}' not found") unless server
                  
                  
                  Severity: Minor
                  Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method current_vm_id has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def current_vm_id
                        @metadata_lock.synchronize do
                          return @current_vm_id if @current_vm_id
                  
                          client = HTTPClient.new
                  Severity: Minor
                  Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method initial_agent_settings has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def initial_agent_settings(server_name, agent_id, network_spec, environment, ephemeral_volume)
                  Severity: Minor
                  Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 35 mins to fix

                    Method delete_disk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def delete_disk(disk_id)
                          with_thread_name("delete_disk(#{disk_id})") do
                            @logger.info("Deleting volume `#{disk_id}'...")
                            volume = with_compute { @compute.volumes.get(disk_id) }
                            if volume
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Method delete_snapshot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def delete_snapshot(snapshot_id)
                          with_thread_name("delete_snapshot(#{snapshot_id})") do
                            @logger.info("Deleting snapshot `#{snapshot_id}'...")
                            snapshot = with_compute { @compute.snapshots.get(snapshot_id) }
                    
                    
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

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

                        def attach_disk(server_id, disk_id)
                          with_thread_name("attach_disk(#{server_id}, #{disk_id})") do
                            server = with_compute { @compute.servers.get(server_id) }
                            cloud_error("Server `#{server_id}' not found") unless server
                    
                    
                    Severity: Major
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 1 hr to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 474..487

                    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 69.

                    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 detach_disk(server_id, disk_id)
                          with_thread_name("detach_disk(#{server_id}, #{disk_id})") do
                            server = with_compute { @compute.servers.get(server_id) }
                            cloud_error("Server `#{server_id}' not found") unless server
                    
                    
                    Severity: Major
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 1 hr to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 498..511

                    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 67.

                    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

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

                        def unpack_image(tmp_dir, image_path)
                          result = Bosh::Exec.sh("tar -C #{tmp_dir} -xzf #{image_path} 2>&1", :on_error => :return)
                          if result.failed?
                            @logger.error("Extracting stemcell root image failed in dir #{tmp_dir}, " +
                                          "tar returned #{result.exit_status}, output: #{result.output}")
                    Severity: Major
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 1 hr to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 880..889

                    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 48.

                    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

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

                        def user_data(server_name, network_spec, public_key = nil)
                          data = {}
                    
                          data["registry"] = { "endpoint" => @registry.endpoint }
                          data["server"] = { "name" => server_name }
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 40 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 645..656

                    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 38.

                    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 set_vm_metadata(server_id, metadata)
                          with_thread_name("set_vm_metadata(#{server_id}, ...)") do
                            with_compute do
                              server = @compute.servers.get(server_id)
                              cloud_error("Server `#{server_id}' not found") unless server
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 30 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 580..587

                    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 32.

                    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

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

                          unless @options.has_key?("registry") &&
                              @options["registry"].is_a?(Hash) &&
                              @options["registry"]["endpoint"] &&
                              @options["registry"]["user"] &&
                              @options["registry"]["password"]
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 25 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 909..915

                    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 31.

                    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 compare_security_groups(server, specified_sg_names)
                          actual_sg_names = with_compute { server.security_groups }.collect { |sg| sg.name }
                    
                          unless actual_sg_names.sort == specified_sg_names.sort
                            raise Bosh::Clouds::NotSupported,
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 25 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 828..834

                    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 31.

                    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 ensure_same_availability_zone(disks, default)
                          zones = disks.map { |disk| disk.zone_name }
                          zones << default if default
                          zones.uniq!
                          cloud_error "can't use multiple availability zones: %s" %
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 25 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 621..627

                    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 30.

                    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 find_volume_device(sd_name)
                          # need also xvd?
                          vd_name = sd_name.gsub(/^\/dev\/sd/, "/dev/vd")
                    
                          DEVICE_POLL_TIMEOUT.times do
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 20 mins to fix
                    bosh_aws_cpi/lib/cloud/aws/cloud.rb on lines 451..463

                    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 27.

                    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 select_availability_zone(volumes, resource_pool_az)
                          if volumes && !volumes.empty?
                            disks = volumes.map { |vid| with_compute { @compute.volumes.get(vid) } }
                            ensure_same_availability_zone(disks, resource_pool_az)
                            disks.first.zone_name
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 20 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 603..610

                    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 27.

                    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

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

                        def update_agent_settings(server)
                          raise ArgumentError, "Block is not provided" unless block_given?
                    
                          @logger.info("Updating settings for server `#{server.id}'...")
                          settings = @registry.read_settings(server.name)
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 15 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 711..717

                    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 26.

                    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

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

                        def initialize_registry
                          registry_properties = @options.fetch('registry')
                          registry_endpoint   = registry_properties.fetch('endpoint')
                          registry_user       = registry_properties.fetch('user')
                          registry_password   = registry_properties.fetch('password')
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 15 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 918..926

                    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 26.

                    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 reboot_vm(server_id)
                          with_thread_name("reboot_vm(#{server_id})") do
                            server = with_compute { @compute.servers.get(server_id) }
                            cloud_error("Server `#{server_id}' not found") unless server
                    
                    
                    Severity: Minor
                    Found in bosh_cloudstack_cpi/lib/cloud/cloudstack/cloud.rb and 1 other location - About 15 mins to fix
                    bosh_openstack_cpi/lib/cloud/openstack/cloud.rb on lines 342..347

                    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 25.

                    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

                    There are no issues that match your filters.

                    Category
                    Status