saltstack/salt

View on GitHub
salt/cloud/clouds/vmware.py

Summary

Maintainability
F
1 mo
Test Coverage

File vmware.py has 3542 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# pylint: disable=C0302
'''
VMware Cloud Module
===================
Severity: Major
Found in salt/cloud/clouds/vmware.py - About 1 wk to fix

    Function _manage_devices has a Cognitive Complexity of 222 (exceeds 5 allowed). Consider refactoring.
    Open

    def _manage_devices(devices, vm=None, container_ref=None, new_vm_name=None):
        unit_number = 0
        bus_number = 0
        device_specs = []
        existing_disks_label = []
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - About 4 days 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

    Function create has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring.
    Open

    def create(vm_):
        '''
        To create a single VM in the VMware environment.
    
        Sample profile and arguments that can be specified in it can be found
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - About 3 days 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

    Function _format_instance_info_select has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
    Open

    def _format_instance_info_select(vm, selection):
        def defaultto(machine, section, default='N/A'):
            '''
            Return either a named value from a VirtualMachineConfig or a
            default string "N/A".
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - About 1 day 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

    Cyclomatic complexity is too high in function create. (95)
    Open

    def create(vm_):
        '''
        To create a single VM in the VMware environment.
    
        Sample profile and arguments that can be specified in it can be found
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _manage_devices. (64)
    Open

    def _manage_devices(devices, vm=None, container_ref=None, new_vm_name=None):
        unit_number = 0
        bus_number = 0
        device_specs = []
        existing_disks_label = []
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _format_instance_info has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    def _format_instance_info(vm):
        device_full_info = {}
        device_mac_addresses = []
        if "config.hardware.device" in vm:
            for device in vm["config.hardware.device"]:
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - About 7 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

    Cyclomatic complexity is too high in function _format_instance_info_select. (41)
    Open

    def _format_instance_info_select(vm, selection):
        def defaultto(machine, section, default='N/A'):
            '''
            Return either a named value from a VirtualMachineConfig or a
            default string "N/A".
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _wait_for_ip has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def _wait_for_ip(vm_ref, max_wait):
        max_wait_vmware_tools = max_wait
        max_wait_ip = max_wait
        vmware_tools_status = _wait_for_vmware_tools(vm_ref, max_wait_vmware_tools)
        if not vmware_tools_status:
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - About 4 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

    Function list_hbas has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_hbas(kwargs=None, call=None):
        '''
        List all HBAs for each host system; or all HBAs for a specified host
        system; or HBAs of specified type for each host system; or HBAs of
        specified type for a specified host system in this VMware environment
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - About 4 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

    Function add_host has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_host(kwargs=None, call=None):
        '''
        Add a host system to the specified cluster or datacenter in this VMware environment
    
        .. note::
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - About 3 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

    Cyclomatic complexity is too high in function _format_instance_info. (28)
    Open

    def _format_instance_info(vm):
        device_full_info = {}
        device_mac_addresses = []
        if "config.hardware.device" in vm:
            for device in vm["config.hardware.device"]:
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function list_hosts_by_datacenter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_hosts_by_datacenter(kwargs=None, call=None):
        '''
        List hosts for each datacenter; or hosts for a specified datacenter in
        this VMware environment
    
    
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - 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

    Cyclomatic complexity is too high in function add_host. (25)
    Open

    def add_host(kwargs=None, call=None):
        '''
        Add a host system to the specified cluster or datacenter in this VMware environment
    
        .. note::
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function list_nodes_select has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_nodes_select(call=None):
        '''
        Return a list of all VMs and templates that are on the specified provider, with fields
        specified under ``query.selection`` in ``/etc/salt/cloud``
    
    
    Severity: Minor
    Found in salt/cloud/clouds/vmware.py - 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

    Function create has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def create(vm_):
        '''
        To create a single VM in the VMware environment.
    
        Sample profile and arguments that can be specified in it can be found
    Severity: Major
    Found in salt/cloud/clouds/vmware.py - About 2 hrs to fix

      Function _add_new_hard_disk_helper has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def _add_new_hard_disk_helper(disk_label,
                                    size_gb,
                                    unit_number,
                                    controller_key=1000,
                                    thin_provision=False,
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function _wait_for_host has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def _wait_for_host(host_ref, task_type, sleep_seconds=5, log_level='debug'):
          time_counter = 0
          starttime = time.time()
          while host_ref.runtime.connectionState != 'notResponding':
              if time_counter % sleep_seconds == 0:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function reset has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def reset(name, soft=False, call=None):
          '''
          To reset a VM using its name
      
          .. note::
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function destroy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def destroy(name, call=None):
          '''
          To destroy a VM from the VMware environment
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Cyclomatic complexity is too high in function list_nodes_select. (21)
      Open

      def list_nodes_select(call=None):
          '''
          Return a list of all VMs and templates that are on the specified provider, with fields
          specified under ``query.selection`` in ``/etc/salt/cloud``
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Function create_folder has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_folder(kwargs=None, call=None):
          '''
          Create the specified folder path in this VMware environment
      
          .. note::
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function avail_images has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def avail_images(call=None):
          '''
          Return a list of all the templates present in this VMware environment with basic
          details
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function stop has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def stop(name, soft=False, call=None):
          '''
          To stop/power off a VM using its name
      
          .. note::
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function create_cluster has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_cluster(kwargs=None, call=None):
          '''
          Create a new cluster under the specified datacenter in this VMware environment
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function _edit_existing_network_adapter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _edit_existing_network_adapter(network_adapter,
                                         new_network_name,
                                         adapter_type,
                                         switch_type,
                                         container_ref=None):
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function _upg_tools_helper has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _upg_tools_helper(vm, reboot=False):
          # Exit if template
          if vm.config.template:
              status = 'VMware tools cannot be updated on a template'
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function _add_new_scsi_controller_helper has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _add_new_scsi_controller_helper(scsi_controller_label,
                                          properties,
                                          bus_number):
          random_key = randint(-1050, -1000)
          adapter_type = properties['type'].strip().lower() if 'type' in properties else None
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function list_nodes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def list_nodes(kwargs=None, call=None):
          '''
          Return a list of all VMs and templates that are on the specified provider, with basic fields
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function _add_new_network_adapter_helper has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _add_new_network_adapter_helper(network_adapter_label,
                                          network_name,
                                          adapter_type,
                                          switch_type,
                                          mac,
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function list_snapshots has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def list_snapshots(kwargs=None, call=None):
          '''
          List snapshots either for all VMs and templates or for a specific VM/template
          in this VMware environment
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function suspend has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def suspend(name, call=None):
          '''
          To suspend a VM using its name
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function list_clusters_by_datacenter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def list_clusters_by_datacenter(kwargs=None, call=None):
          '''
          List clusters for each datacenter; or clusters for a specified datacenter in
          this VMware environment
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function terminate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def terminate(name, call=None):
          '''
          To do an immediate power off of a VM using its name. A ``SIGKILL``
          is issued to the vmx process of the VM
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function start has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def start(name, call=None):
          '''
          To start/power on a VM using its name
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function shutdown_host has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def shutdown_host(kwargs=None, call=None):
          '''
          Shut down the specified host system in this VMware environment
      
          .. note::
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function create_datastore_cluster has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_datastore_cluster(kwargs=None, call=None):
          '''
          Create a new datastore cluster for the specified datacenter in this VMware environment
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function list_hosts_by_cluster has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def list_hosts_by_cluster(kwargs=None, call=None):
          '''
          List hosts for each cluster; or hosts for a specified cluster in
          this VMware environment
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function _get_snapshots has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_snapshots(snapshot_list, current_snapshot=None, parent_snapshot_path=""):
          snapshots = {}
          for snapshot in snapshot_list:
              snapshot_path = "{0}/{1}".format(parent_snapshot_path, snapshot.name)
              snapshots[snapshot_path] = {
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function revert_to_snapshot has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def revert_to_snapshot(name, kwargs=None, call=None):
          '''
          Revert virtual machine to it's current snapshot. If no snapshot
          exists, the state of the virtual machine remains unchanged
      
      
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function reboot_host has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def reboot_host(kwargs=None, call=None):
          '''
          Reboot the specified host system in this VMware environment
      
          .. note::
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Function create_datacenter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_datacenter(kwargs=None, call=None):
          '''
          Create a new data center in this VMware environment
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/vmware.py - 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

      Avoid deeply nested control flow statements.
      Open

                          if device.deviceInfo.label in list(devices['network'].keys()):
                              network_name = devices['network'][device.deviceInfo.label]['name']
                              adapter_type = devices['network'][device.deviceInfo.label]['adapter_type'] if 'adapter_type' in devices['network'][device.deviceInfo.label] else ''
                              switch_type = devices['network'][device.deviceInfo.label]['switch_type'] if 'switch_type' in devices['network'][device.deviceInfo.label] else ''
                              network_spec = _edit_existing_network_adapter(device, network_name, adapter_type, switch_type, container_ref)
      Severity: Major
      Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if num_devices < 2:
                                controller_key = ide_controller_key
                                break
        
        
        Severity: Major
        Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if hasattr(device, 'controllerKey') and device.controllerKey:
                                  device_full_info[device.deviceInfo.label]['controllerKey'] = device.controllerKey
          
          
          Severity: Major
          Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if hasattr(device, 'connectable') and device.connectable:
                                    device_full_info[device.deviceInfo.label]['startConnected'] = device.connectable.startConnected
                                    device_full_info[device.deviceInfo.label]['allowGuestControl'] = device.connectable.allowGuestControl
                                    device_full_info[device.deviceInfo.label]['connected'] = device.connectable.connected
                                    device_full_info[device.deviceInfo.label]['status'] = device.connectable.status
            Severity: Major
            Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if hasattr(device, 'device'):
                                      device_full_info[device.deviceInfo.label]['deviceKeys'] = device.device
              
              
              Severity: Major
              Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if device.deviceInfo.label in list(devices['cd'].keys()):
                                        device_type = devices['cd'][device.deviceInfo.label]['device_type'] if 'device_type' in devices['cd'][device.deviceInfo.label] else ''
                                        mode = devices['cd'][device.deviceInfo.label]['mode'] if 'mode' in devices['cd'][device.deviceInfo.label] else ''
                                        iso_path = devices['cd'][device.deviceInfo.label]['iso_path'] if 'iso_path' in devices['cd'][device.deviceInfo.label] else ''
                                        cd_drive_spec = _edit_existing_cd_or_dvd_drive(device, device_type, mode, iso_path)
                Severity: Major
                Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if hasattr(device, 'busNumber'):
                                          device_full_info[device.deviceInfo.label]['busNumber'] = device.busNumber
                  
                  
                  Severity: Major
                  Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if spec.device.deviceInfo.label == devices['cd'][cd_drive_label]['controller']:
                                            controller_key = spec.device.key
                                            ide_controllers[controller_key] = 0
                                            break
                                else:
                    Severity: Major
                    Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if isinstance(host, vim.HostSystem):
                                              ret[datacenter['name']].append(host.name)
                              if datacenter_name and datacenter_name == datacenter['name']:
                      Severity: Major
                      Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if device.deviceInfo.label in list(devices['disk'].keys()):
                                                disk_spec = None
                                                if 'size' in devices['disk'][device.deviceInfo.label]:
                                                    size_gb = float(devices['disk'][device.deviceInfo.label]['size'])
                                                    size_kb = int(size_gb * 1024.0 * 1024.0)
                        Severity: Major
                        Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if spec.device.deviceInfo.label == devices['disk'][disk_label]['controller']:
                                                  disk_spec.device.controllerKey = spec.device.key
                                                  break
                          
                          
                          Severity: Major
                          Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                            Function create_snapshot has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def create_snapshot(name, kwargs=None, call=None):
                                '''
                                Create a snapshot of the specified virtual machine in this VMware
                                environment
                            
                            
                            Severity: Minor
                            Found in salt/cloud/clouds/vmware.py - 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

                            Avoid deeply nested control flow statements.
                            Open

                                                if device.deviceInfo.label in list(devices['scsi'].keys()):
                                                    # Modify the existing SCSI controller
                                                    scsi_controller_properties = devices['scsi'][device.deviceInfo.label]
                                                    bus_sharing = scsi_controller_properties['bus_sharing'].strip().lower() if 'bus_sharing' in scsi_controller_properties else None
                                                    if bus_sharing and bus_sharing in ['virtual', 'physical', 'no']:
                            Severity: Major
                            Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if _valid_ip(current_ip.ipAddress) and not ipv4_address:
                                                      # Delay return in case we have a valid IPv6 available
                                                      ipv4_address = current_ip
                                      if ipv4_address:
                              Severity: Major
                              Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if hasattr(device, 'addressType'):
                                                        device_full_info[device.deviceInfo.label]['addressType'] = device.addressType
                                
                                
                                Severity: Major
                                Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if hba.model in ret[host['name']]:
                                                          ret[host['name']][hba.model][hba.device] = hba_spec
                                                      else:
                                                          ret[host['name']][hba.model] = {hba.device: hba_spec}
                                              else:
                                  Severity: Major
                                  Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if device.unitNumber:
                                                            device_full_info[device.deviceInfo.label]['unitNumber'] = device.unitNumber
                                    
                                    
                                    Severity: Major
                                    Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                                      Function remove_host has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      def remove_host(kwargs=None, call=None):
                                          '''
                                          Remove the specified host system from this VMware environment
                                      
                                          CLI Example:
                                      Severity: Minor
                                      Found in salt/cloud/clouds/vmware.py - 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

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if master_supports_ipv6 and _valid_ip6(current_ip.ipAddress):
                                                              log.info(
                                                                  "[ %s ] Successfully retrieved IPv6 information "
                                                                  "in %s seconds", vm_ref.name, time_counter
                                                              )
                                      Severity: Major
                                      Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            if hasattr(device, 'videoRamSizeInKB'):
                                                                device_full_info[device.deviceInfo.label]['videoRamSizeInKB'] = device.videoRamSizeInKB
                                        
                                        
                                        Severity: Major
                                        Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                              if isinstance(device, vim.vm.device.VirtualDisk):
                                                                  device_full_info[device.deviceInfo.label]['capacityInKB'] = device.capacityInKB
                                                                  device_full_info[device.deviceInfo.label]['diskMode'] = device.backing.diskMode
                                                                  device_full_info[device.deviceInfo.label]['fileName'] = device.backing.fileName
                                          
                                          
                                          Severity: Major
                                          Found in salt/cloud/clouds/vmware.py - About 45 mins to fix

                                            Function remove_snapshot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            def remove_snapshot(name, kwargs=None, call=None):
                                                '''
                                                Remove a snapshot of the specified virtual machine in this VMware environment
                                            
                                                CLI Example:
                                            Severity: Minor
                                            Found in salt/cloud/clouds/vmware.py - About 35 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

                                            Function _set_cd_or_dvd_backing_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            def _set_cd_or_dvd_backing_type(drive, device_type, mode, iso_path):
                                                if device_type == "datastore_iso_file":
                                                    drive.backing = vim.vm.device.VirtualCdrom.IsoBackingInfo()
                                                    drive.backing.fileName = iso_path
                                            
                                            
                                            Severity: Minor
                                            Found in salt/cloud/clouds/vmware.py - About 35 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

                                            Function exit_maintenance_mode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            def exit_maintenance_mode(kwargs=None, call=None):
                                                '''
                                                To take the specified host system out of maintenance mode in this VMware environment
                                            
                                                CLI Example:
                                            Severity: Minor
                                            Found in salt/cloud/clouds/vmware.py - About 35 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

                                            Function rescan_hba has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            def rescan_hba(kwargs=None, call=None):
                                                '''
                                                To rescan a specified HBA or all the HBAs on the Host System
                                            
                                                CLI Example:
                                            Severity: Minor
                                            Found in salt/cloud/clouds/vmware.py - About 35 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

                                            Avoid too many return statements within this function.
                                            Open

                                                return False
                                            Severity: Major
                                            Found in salt/cloud/clouds/vmware.py - About 30 mins to fix

                                              Function connect_host has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              def connect_host(kwargs=None, call=None):
                                                  '''
                                                  Connect the specified host system in this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py - 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

                                              Function get_clonespec_for_valid_snapshot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              def get_clonespec_for_valid_snapshot(config_spec, object_ref, reloc_spec, template, vm_):
                                                  '''
                                                  return clonespec only if values are valid
                                                  '''
                                                  moving = True
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py - 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

                                              Function enter_maintenance_mode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              def enter_maintenance_mode(kwargs=None, call=None):
                                                  '''
                                                  To put the specified host system in maintenance mode in this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py - 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

                                              Function disconnect_host has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              def disconnect_host(kwargs=None, call=None):
                                                  '''
                                                  Disconnect the specified host system in this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py - 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

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

                                                          if hasattr(device, 'connectable') and device.connectable:
                                                              device_full_info[device.deviceInfo.label]['startConnected'] = device.connectable.startConnected
                                                              device_full_info[device.deviceInfo.label]['allowGuestControl'] = device.connectable.allowGuestControl
                                                              device_full_info[device.deviceInfo.label]['connected'] = device.connectable.connected
                                                              device_full_info[device.deviceInfo.label]['status'] = device.connectable.status
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 7 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1227..1231

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

                                              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

                                                                  if hasattr(device, 'connectable') and device.connectable:
                                                                      device_full_info[device.deviceInfo.label]['startConnected'] = device.connectable.startConnected
                                                                      device_full_info[device.deviceInfo.label]['allowGuestControl'] = device.connectable.allowGuestControl
                                                                      device_full_info[device.deviceInfo.label]['connected'] = device.connectable.connected
                                                                      device_full_info[device.deviceInfo.label]['status'] = device.connectable.status
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 7 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1301..1305

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

                                              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

                                                  while host_ref.runtime.connectionState != 'notResponding':
                                                      if time_counter % sleep_seconds == 0:
                                                          log.log(
                                                              logging.INFO if log_level == 'info' else logging.DEBUG,
                                                              "[ %s ] Waiting for host %s to finish [%s s]",
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 5 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1126..1134

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

                                              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

                                                  while host_ref.runtime.connectionState != 'connected':
                                                      if time_counter % sleep_seconds == 0:
                                                          log.log(
                                                              logging.INFO if log_level == 'info' else logging.DEBUG,
                                                              "[ %s ] Waiting for host %s to finish [%s s]",
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 5 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1117..1125

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

                                              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

                                                              if isinstance(hba, _get_hba_type(hba_type)):
                                                                  if hba.model in ret[host['name']]:
                                                                      ret[host['name']][hba.model][hba.device] = hba_spec
                                                                  else:
                                                                      ret[host['name']][hba.model] = {hba.device: hba_spec}
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 5 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 3596..3606

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

                                              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

                                                          if hba_type:
                                                              if isinstance(hba, _get_hba_type(hba_type)):
                                                                  if hba.model in ret[host['name']]:
                                                                      ret[host['name']][hba.model][hba.device] = hba_spec
                                                                  else:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 5 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 3597..3601

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

                                              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

                                                                  if isinstance(device, vim.vm.device.VirtualDisk):
                                                                      device_full_info[device.deviceInfo.label]['capacityInKB'] = device.capacityInKB
                                                                      device_full_info[device.deviceInfo.label]['diskMode'] = device.backing.diskMode
                                                                      device_full_info[device.deviceInfo.label]['fileName'] = device.backing.fileName
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 5 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1326..1329

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

                                              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

                                                          if isinstance(device, vim.vm.device.VirtualDisk):
                                                              device_full_info[device.deviceInfo.label]['capacityInKB'] = device.capacityInKB
                                                              device_full_info[device.deviceInfo.label]['diskMode'] = device.backing.diskMode
                                                              device_full_info[device.deviceInfo.label]['fileName'] = device.backing.fileName
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 5 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1248..1251

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

                                              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

                                                  storage_full_info = {
                                                      'committed': int(vm["summary.storage.committed"]) if "summary.storage.committed" in vm else "N/A",
                                                      'uncommitted': int(vm["summary.storage.uncommitted"]) if "summary.storage.uncommitted" in vm else "N/A",
                                                      'unshared': int(vm["summary.storage.unshared"]) if "summary.storage.unshared" in vm else "N/A"
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 4 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1264..1267

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

                                              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

                                                      storage_full_info = {
                                                          'committed': int(vm["summary.storage.committed"]) if "summary.storage.committed" in vm else "N/A",
                                                          'uncommitted': int(vm["summary.storage.uncommitted"]) if "summary.storage.uncommitted" in vm else "N/A",
                                                          'unshared': int(vm["summary.storage.unshared"]) if "summary.storage.unshared" in vm else "N/A"
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 4 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1331..1334

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

                                              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

                                                          try:
                                                              log.info('Resetting VM %s', name)
                                                              if soft:
                                                                  vm["object"].RebootGuest()
                                                              else:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 4 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 2272..2286

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

                                              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

                                                          try:
                                                              log.info('Stopping VM %s', name)
                                                              if soft:
                                                                  vm["object"].ShutdownGuest()
                                                              else:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 4 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 2378..2392

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

                                              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 script(vm_):
                                                  '''
                                                  Return the script deployment object
                                                  '''
                                                  script_name = config.get_cloud_config_value('script', vm_, __opts__)
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 3 hrs to fix
                                              salt/cloud/clouds/proxmox.py on lines 375..388

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

                                              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 4 locations. Consider refactoring.
                                              Open

                                                          if vm["summary.runtime.powerState"] != "poweredOff":
                                                              # Power off the vm first
                                                              try:
                                                                  log.info('Powering Off VM %s', name)
                                                                  task = vm["object"].PowerOff()
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 3 other locations - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 2218..2229
                                              salt/cloud/clouds/vmware.py on lines 2324..2335
                                              salt/cloud/clouds/vmware.py on lines 2492..2503

                                              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 4 locations. Consider refactoring.
                                              Open

                                                          try:
                                                              log.info('Starting VM %s', name)
                                                              task = vm["object"].PowerOn()
                                                              salt.utils.vmware.wait_for_task(task, name, 'power on')
                                                          except Exception as exc:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 3 other locations - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 2324..2335
                                              salt/cloud/clouds/vmware.py on lines 2478..2491
                                              salt/cloud/clouds/vmware.py on lines 2492..2503

                                              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 4 locations. Consider refactoring.
                                              Open

                                                          try:
                                                              log.info('Destroying VM %s', name)
                                                              task = vm["object"].Destroy_Task()
                                                              salt.utils.vmware.wait_for_task(task, name, 'destroy')
                                                          except Exception as exc:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 3 other locations - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 2218..2229
                                              salt/cloud/clouds/vmware.py on lines 2324..2335
                                              salt/cloud/clouds/vmware.py on lines 2478..2491

                                              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 4 locations. Consider refactoring.
                                              Open

                                                          try:
                                                              log.info('Suspending VM %s', name)
                                                              task = vm["object"].Suspend()
                                                              salt.utils.vmware.wait_for_task(task, name, 'suspend')
                                                          except Exception as exc:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 3 other locations - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 2218..2229
                                              salt/cloud/clouds/vmware.py on lines 2478..2491
                                              salt/cloud/clouds/vmware.py on lines 2492..2503

                                              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

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

                                                      if "guest.net" in vm:
                                                          for net in vm["guest.net"]:
                                                              network_full_info[net.network] = {
                                                                  'connected': net.connected,
                                                                  'ip_addresses': net.ipAddress,
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1349..1356

                                              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

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

                                                  if "guest.net" in vm:
                                                      for net in vm["guest.net"]:
                                                          network_full_info[net.network] = {
                                                              'connected': net.connected,
                                                              'ip_addresses': net.ipAddress,
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1196..1203

                                              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 38 locations. Consider refactoring.
                                              Open

                                                  __utils__['cloud.fire_event'](
                                                      'event',
                                                      'starting create',
                                                      'salt/cloud/{0}/creating'.format(vm_['name']),
                                                      args=__utils__['cloud.filter_event']('creating', vm_, ['name', 'profile', 'provider', 'driver']),
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 37 other locations - About 2 hrs to fix
                                              salt/cloud/clouds/aliyun.py on lines 625..631
                                              salt/cloud/clouds/aliyun.py on lines 732..738
                                              salt/cloud/clouds/azurearm.py on lines 1349..1359
                                              salt/cloud/clouds/azurearm.py on lines 1398..1406
                                              salt/cloud/clouds/azurearm.py on lines 1480..1489
                                              salt/cloud/clouds/digitalocean.py on lines 287..293
                                              salt/cloud/clouds/digitalocean.py on lines 537..543
                                              salt/cloud/clouds/dimensiondata.py on lines 207..213
                                              salt/cloud/clouds/dimensiondata.py on lines 337..343
                                              salt/cloud/clouds/ec2.py on lines 2579..2585
                                              salt/cloud/clouds/gce.py on lines 2461..2467
                                              salt/cloud/clouds/gce.py on lines 2551..2557
                                              salt/cloud/clouds/gce.py on lines 2635..2641
                                              salt/cloud/clouds/gogrid.py on lines 96..102
                                              salt/cloud/clouds/gogrid.py on lines 180..186
                                              salt/cloud/clouds/joyent.py on lines 274..280
                                              salt/cloud/clouds/joyent.py on lines 325..331
                                              salt/cloud/clouds/lxc.py on lines 440..446
                                              salt/cloud/clouds/lxc.py on lines 460..466
                                              salt/cloud/clouds/lxc.py on lines 488..494
                                              salt/cloud/clouds/msazure.py on lines 429..435
                                              salt/cloud/clouds/msazure.py on lines 683..689
                                              salt/cloud/clouds/nova.py on lines 961..967
                                              salt/cloud/clouds/opennebula.py on lines 1006..1012
                                              salt/cloud/clouds/openstack.py on lines 684..690
                                              salt/cloud/clouds/packet.py on lines 347..353
                                              salt/cloud/clouds/parallels.py on lines 287..293
                                              salt/cloud/clouds/parallels.py on lines 356..362
                                              salt/cloud/clouds/proxmox.py on lines 578..585
                                              salt/cloud/clouds/qingcloud.py on lines 668..674
                                              salt/cloud/clouds/qingcloud.py on lines 738..744
                                              salt/cloud/clouds/scaleway.py on lines 200..206
                                              salt/cloud/clouds/scaleway.py on lines 304..310
                                              salt/cloud/clouds/virtualbox.py on lines 176..182
                                              salt/cloud/clouds/vmware.py on lines 3072..3078
                                              salt/cloud/clouds/vultrpy.py on lines 292..298
                                              salt/cloud/clouds/vultrpy.py on lines 465..471

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

                                              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 38 locations. Consider refactoring.
                                              Open

                                                  __utils__['cloud.fire_event'](
                                                      'event',
                                                      'created instance',
                                                      'salt/cloud/{0}/created'.format(vm_['name']),
                                                      args=__utils__['cloud.filter_event']('created', vm_, ['name', 'profile', 'provider', 'driver']),
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 37 other locations - About 2 hrs to fix
                                              salt/cloud/clouds/aliyun.py on lines 625..631
                                              salt/cloud/clouds/aliyun.py on lines 732..738
                                              salt/cloud/clouds/azurearm.py on lines 1349..1359
                                              salt/cloud/clouds/azurearm.py on lines 1398..1406
                                              salt/cloud/clouds/azurearm.py on lines 1480..1489
                                              salt/cloud/clouds/digitalocean.py on lines 287..293
                                              salt/cloud/clouds/digitalocean.py on lines 537..543
                                              salt/cloud/clouds/dimensiondata.py on lines 207..213
                                              salt/cloud/clouds/dimensiondata.py on lines 337..343
                                              salt/cloud/clouds/ec2.py on lines 2579..2585
                                              salt/cloud/clouds/gce.py on lines 2461..2467
                                              salt/cloud/clouds/gce.py on lines 2551..2557
                                              salt/cloud/clouds/gce.py on lines 2635..2641
                                              salt/cloud/clouds/gogrid.py on lines 96..102
                                              salt/cloud/clouds/gogrid.py on lines 180..186
                                              salt/cloud/clouds/joyent.py on lines 274..280
                                              salt/cloud/clouds/joyent.py on lines 325..331
                                              salt/cloud/clouds/lxc.py on lines 440..446
                                              salt/cloud/clouds/lxc.py on lines 460..466
                                              salt/cloud/clouds/lxc.py on lines 488..494
                                              salt/cloud/clouds/msazure.py on lines 429..435
                                              salt/cloud/clouds/msazure.py on lines 683..689
                                              salt/cloud/clouds/nova.py on lines 961..967
                                              salt/cloud/clouds/opennebula.py on lines 1006..1012
                                              salt/cloud/clouds/openstack.py on lines 684..690
                                              salt/cloud/clouds/packet.py on lines 347..353
                                              salt/cloud/clouds/parallels.py on lines 287..293
                                              salt/cloud/clouds/parallels.py on lines 356..362
                                              salt/cloud/clouds/proxmox.py on lines 578..585
                                              salt/cloud/clouds/qingcloud.py on lines 668..674
                                              salt/cloud/clouds/qingcloud.py on lines 738..744
                                              salt/cloud/clouds/scaleway.py on lines 200..206
                                              salt/cloud/clouds/scaleway.py on lines 304..310
                                              salt/cloud/clouds/virtualbox.py on lines 176..182
                                              salt/cloud/clouds/vmware.py on lines 2543..2549
                                              salt/cloud/clouds/vultrpy.py on lines 292..298
                                              salt/cloud/clouds/vultrpy.py on lines 465..471

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

                                              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 10 locations. Consider refactoring.
                                              Open

                                                      __utils__['cloud.fire_event'](
                                                          'event',
                                                          'requesting instance',
                                                          'salt/cloud/{0}/requesting'.format(vm_['name']),
                                                          args=__utils__['cloud.filter_event']('requesting', event_kwargs, list(event_kwargs)),
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 9 other locations - About 2 hrs to fix
                                              salt/cloud/clouds/aliyun.py on lines 659..665
                                              salt/cloud/clouds/digitalocean.py on lines 448..454
                                              salt/cloud/clouds/dimensiondata.py on lines 256..262
                                              salt/cloud/clouds/ec2.py on lines 2860..2866
                                              salt/cloud/clouds/msazure.py on lines 541..547
                                              salt/cloud/clouds/nova.py on lines 1068..1074
                                              salt/cloud/clouds/openstack.py on lines 767..773
                                              salt/cloud/clouds/virtualbox.py on lines 192..198
                                              salt/cloud/clouds/virtualbox.py on lines 218..224

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

                                              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

                                                  if "layoutEx.file" in vm:
                                                      for filename in vm["layoutEx.file"]:
                                                          file_full_info[filename.key] = {
                                                              'key': filename.key,
                                                              'name': filename.name,
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1273..1279

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

                                              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

                                                      if "layoutEx.file" in vm:
                                                          for filename in vm["layoutEx.file"]:
                                                              file_full_info[filename.key] = {
                                                                  'key': filename.key,
                                                                  'name': filename.name,
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 2 hrs to fix
                                              salt/cloud/clouds/vmware.py on lines 1338..1344

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

                                              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 18 locations. Consider refactoring.
                                              Open

                                                  try:
                                                      # Check for required profile parameters before sending any API calls.
                                                      if (vm_['profile'] and
                                                          config.is_profile_configured(__opts__,
                                                                                       __active_provider_name__ or 'vmware',
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 17 other locations - About 1 hr to fix
                                              salt/cloud/clouds/aliyun.py on lines 615..622
                                              salt/cloud/clouds/azurearm.py on lines 1384..1392
                                              salt/cloud/clouds/cloudstack.py on lines 270..277
                                              salt/cloud/clouds/digitalocean.py on lines 277..284
                                              salt/cloud/clouds/ec2.py on lines 2554..2561
                                              salt/cloud/clouds/gce.py on lines 2451..2458
                                              salt/cloud/clouds/gogrid.py on lines 86..93
                                              salt/cloud/clouds/joyent.py on lines 260..267
                                              salt/cloud/clouds/linode.py on lines 328..335
                                              salt/cloud/clouds/msazure.py on lines 419..426
                                              salt/cloud/clouds/nova.py on lines 938..945
                                              salt/cloud/clouds/parallels.py on lines 277..284
                                              salt/cloud/clouds/proxmox.py on lines 566..573
                                              salt/cloud/clouds/qingcloud.py on lines 658..665
                                              salt/cloud/clouds/scaleway.py on lines 190..197
                                              salt/cloud/clouds/softlayer.py on lines 248..255
                                              salt/cloud/clouds/softlayer_hw.py on lines 216..223

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

                                              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 5 locations. Consider refactoring.
                                              Open

                                                                      switch_type = devices['network'][device.deviceInfo.label]['switch_type'] if 'switch_type' in devices['network'][device.deviceInfo.label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 4 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 795..795
                                              salt/cloud/clouds/vmware.py on lines 825..825
                                              salt/cloud/clouds/vmware.py on lines 826..826
                                              salt/cloud/clouds/vmware.py on lines 827..827

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

                                              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 5 locations. Consider refactoring.
                                              Open

                                                                      device_type = devices['cd'][device.deviceInfo.label]['device_type'] if 'device_type' in devices['cd'][device.deviceInfo.label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 4 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 795..795
                                              salt/cloud/clouds/vmware.py on lines 796..796
                                              salt/cloud/clouds/vmware.py on lines 826..826
                                              salt/cloud/clouds/vmware.py on lines 827..827

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

                                              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 5 locations. Consider refactoring.
                                              Open

                                                                      mode = devices['cd'][device.deviceInfo.label]['mode'] if 'mode' in devices['cd'][device.deviceInfo.label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 4 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 795..795
                                              salt/cloud/clouds/vmware.py on lines 796..796
                                              salt/cloud/clouds/vmware.py on lines 825..825
                                              salt/cloud/clouds/vmware.py on lines 827..827

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

                                              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 5 locations. Consider refactoring.
                                              Open

                                                                      adapter_type = devices['network'][device.deviceInfo.label]['adapter_type'] if 'adapter_type' in devices['network'][device.deviceInfo.label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 4 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 796..796
                                              salt/cloud/clouds/vmware.py on lines 825..825
                                              salt/cloud/clouds/vmware.py on lines 826..826
                                              salt/cloud/clouds/vmware.py on lines 827..827

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

                                              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 5 locations. Consider refactoring.
                                              Open

                                                                      iso_path = devices['cd'][device.deviceInfo.label]['iso_path'] if 'iso_path' in devices['cd'][device.deviceInfo.label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 4 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 795..795
                                              salt/cloud/clouds/vmware.py on lines 796..796
                                              salt/cloud/clouds/vmware.py on lines 825..825
                                              salt/cloud/clouds/vmware.py on lines 826..826

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

                                              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

                                                          if hasattr(device, 'macAddress'):
                                                              device_full_info[device.deviceInfo.label]['macAddress'] = device.macAddress
                                                              device_mac_addresses.append(device.macAddress)
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1253..1255

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

                                              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

                                                              if hasattr(device, 'macAddress'):
                                                                  device_full_info[device.deviceInfo.label]['macAddress'] = device.macAddress
                                                                  device_mac_addresses.append(device.macAddress)
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1313..1315

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

                                              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

                                                          eagerly_scrub = bool(devices['disk'][disk_label]['eagerly_scrub']) if 'eagerly_scrub' in devices['disk'][disk_label] else False
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 893..893

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

                                              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

                                                          thin_provision = bool(devices['disk'][disk_label]['thin_provision']) if 'thin_provision' in devices['disk'][disk_label] else False
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 894..894

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_hosts(kwargs=None, call=None):
                                                  '''
                                                  List all the hosts for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_vapps(kwargs=None, call=None):
                                                  '''
                                                  List all the vApps for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_datastores(kwargs=None, call=None):
                                                  '''
                                                  List all the datastores for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_folders(kwargs=None, call=None):
                                                  '''
                                                  List all the folders for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_datastores_full(kwargs=None, call=None):
                                                  '''
                                                  List all the datastores for this VMware environment, with extra information
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_portgroups(kwargs=None, call=None):
                                                  '''
                                                  List all the distributed virtual portgroups for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_networks(kwargs=None, call=None):
                                                  '''
                                                  List all the standard networks for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_dvs(kwargs=None, call=None):
                                                  '''
                                                  List all the distributed virtual switches for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_datacenters(kwargs=None, call=None):
                                                  '''
                                                  List all the data centers for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_clusters(kwargs=None, call=None):
                                                  '''
                                                  List all the clusters for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_datastore_clusters(kwargs=None, call=None):
                                                  '''
                                                  List all the datastore clusters for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1710..1726
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 12 locations. Consider refactoring.
                                              Open

                                              def list_resourcepools(kwargs=None, call=None):
                                                  '''
                                                  List all the resource pools for this VMware environment
                                              
                                                  CLI Example:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 11 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 1550..1566
                                              salt/cloud/clouds/vmware.py on lines 1569..1585
                                              salt/cloud/clouds/vmware.py on lines 1588..1604
                                              salt/cloud/clouds/vmware.py on lines 1607..1623
                                              salt/cloud/clouds/vmware.py on lines 1626..1642
                                              salt/cloud/clouds/vmware.py on lines 1645..1661
                                              salt/cloud/clouds/vmware.py on lines 1691..1707
                                              salt/cloud/clouds/vmware.py on lines 1729..1745
                                              salt/cloud/clouds/vmware.py on lines 2121..2137
                                              salt/cloud/clouds/vmware.py on lines 3613..3629
                                              salt/cloud/clouds/vmware.py on lines 3632..3648

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

                                              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 6 locations. Consider refactoring.
                                              Open

                                                          switch_type = devices['network'][network_adapter_label]['switch_type'] if 'switch_type' in devices['network'][network_adapter_label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 5 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 842..842
                                              salt/cloud/clouds/vmware.py on lines 844..844
                                              salt/cloud/clouds/vmware.py on lines 924..924
                                              salt/cloud/clouds/vmware.py on lines 925..925
                                              salt/cloud/clouds/vmware.py on lines 926..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 47.

                                              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 6 locations. Consider refactoring.
                                              Open

                                                          adapter_type = devices['network'][network_adapter_label]['adapter_type'] if 'adapter_type' in devices['network'][network_adapter_label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 5 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 843..843
                                              salt/cloud/clouds/vmware.py on lines 844..844
                                              salt/cloud/clouds/vmware.py on lines 924..924
                                              salt/cloud/clouds/vmware.py on lines 925..925
                                              salt/cloud/clouds/vmware.py on lines 926..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 47.

                                              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 6 locations. Consider refactoring.
                                              Open

                                                          mac = devices['network'][network_adapter_label]['mac'] if 'mac' in devices['network'][network_adapter_label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 5 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 842..842
                                              salt/cloud/clouds/vmware.py on lines 843..843
                                              salt/cloud/clouds/vmware.py on lines 924..924
                                              salt/cloud/clouds/vmware.py on lines 925..925
                                              salt/cloud/clouds/vmware.py on lines 926..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 47.

                                              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 6 locations. Consider refactoring.
                                              Open

                                                          device_type = devices['cd'][cd_drive_label]['device_type'] if 'device_type' in devices['cd'][cd_drive_label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 5 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 842..842
                                              salt/cloud/clouds/vmware.py on lines 843..843
                                              salt/cloud/clouds/vmware.py on lines 844..844
                                              salt/cloud/clouds/vmware.py on lines 925..925
                                              salt/cloud/clouds/vmware.py on lines 926..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 47.

                                              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 6 locations. Consider refactoring.
                                              Open

                                                          mode = devices['cd'][cd_drive_label]['mode'] if 'mode' in devices['cd'][cd_drive_label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 5 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 842..842
                                              salt/cloud/clouds/vmware.py on lines 843..843
                                              salt/cloud/clouds/vmware.py on lines 844..844
                                              salt/cloud/clouds/vmware.py on lines 924..924
                                              salt/cloud/clouds/vmware.py on lines 926..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 47.

                                              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 6 locations. Consider refactoring.
                                              Open

                                                          iso_path = devices['cd'][cd_drive_label]['iso_path'] if 'iso_path' in devices['cd'][cd_drive_label] else ''
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 5 other locations - About 1 hr to fix
                                              salt/cloud/clouds/vmware.py on lines 842..842
                                              salt/cloud/clouds/vmware.py on lines 843..843
                                              salt/cloud/clouds/vmware.py on lines 844..844
                                              salt/cloud/clouds/vmware.py on lines 924..924
                                              salt/cloud/clouds/vmware.py on lines 925..925

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

                                              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

                                                      if isinstance(network_adapter, type(edited_network_adapter)):
                                                          edited_network_adapter = network_adapter
                                                      else:
                                                          log.debug(
                                                              "Changing type of '%s' from '%s' to '%s'",
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 55 mins to fix
                                              salt/modules/vsphere.py on lines 7671..7675

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

                                              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 23 locations. Consider refactoring.
                                              Open

                                                  if __opts__.get('update_cachedir', False) is True:
                                                      __utils__['cloud.delete_minion_cachedir'](name, __active_provider_name__.split(':')[0], __opts__)
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 22 other locations - About 50 mins to fix
                                              salt/cloud/clouds/azurearm.py on lines 1528..1532
                                              salt/cloud/clouds/digitalocean.py on lines 868..869
                                              salt/cloud/clouds/ec2.py on lines 3417..3418
                                              salt/cloud/clouds/gce.py on lines 2377..2378
                                              salt/cloud/clouds/gogrid.py on lines 421..422
                                              salt/cloud/clouds/joyent.py on lines 429..430
                                              salt/cloud/clouds/linode.py on lines 758..759
                                              salt/cloud/clouds/lxc.py on lines 415..416
                                              salt/cloud/clouds/msazure.py on lines 947..948
                                              salt/cloud/clouds/nova.py on lines 569..570
                                              salt/cloud/clouds/oneandone.py on lines 918..922
                                              salt/cloud/clouds/opennebula.py on lines 1226..1230
                                              salt/cloud/clouds/openstack.py on lines 816..817
                                              salt/cloud/clouds/parallels.py on lines 561..562
                                              salt/cloud/clouds/profitbricks.py on lines 1023..1027
                                              salt/cloud/clouds/proxmox.py on lines 1194..1196
                                              salt/cloud/clouds/scaleway.py on lines 456..458
                                              salt/cloud/clouds/softlayer.py on lines 637..638
                                              salt/cloud/clouds/softlayer_hw.py on lines 547..548
                                              salt/cloud/clouds/vagrant.py on lines 308..310
                                              salt/cloud/clouds/xen.py on lines 1046..1050
                                              salt/cloud/libcloudfuncs.py on lines 403..404

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

                                              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 15 locations. Consider refactoring.
                                              Open

                                              def __virtual__():
                                                  '''
                                                  Check for VMware configuration and if required libs are available.
                                                  '''
                                                  if get_configured_provider() is False:
                                              Severity: Major
                                              Found in salt/cloud/clouds/vmware.py and 14 other locations - About 30 mins to fix
                                              salt/cloud/clouds/aliyun.py on lines 90..100
                                              salt/cloud/clouds/cloudstack.py on lines 78..88
                                              salt/cloud/clouds/digitalocean.py on lines 68..78
                                              salt/cloud/clouds/ec2.py on lines 186..196
                                              salt/cloud/clouds/msazure.py on lines 79..89
                                              salt/cloud/clouds/oneandone.py on lines 156..166
                                              salt/cloud/clouds/opennebula.py on lines 98..108
                                              salt/cloud/clouds/openstack.py on lines 248..256
                                              salt/cloud/clouds/profitbricks.py on lines 138..148
                                              salt/cloud/clouds/proxmox.py on lines 70..80
                                              salt/cloud/clouds/pyrax.py on lines 29..39
                                              salt/cloud/clouds/qingcloud.py on lines 71..81
                                              salt/cloud/clouds/softlayer.py on lines 55..65
                                              salt/cloud/clouds/softlayer_hw.py on lines 53..63

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

                                              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 avail_sizes(call=None):
                                                  '''
                                                  Return a list of all the available sizes in this VMware environment.
                                              
                                                  CLI Example:
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 30 mins to fix
                                              salt/cloud/clouds/opennebula.py on lines 193..209

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

                                              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

                                                  elif adapter_type == "paravirtual":
                                                      summary = "VMware paravirtual SCSI"
                                                      scsi_spec.device = vim.vm.device.ParaVirtualSCSIController()
                                                  else:
                                                      # If type not specified or does not match, show error and return
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 30 mins to fix
                                              salt/cloud/clouds/vmware.py on lines 461..479

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

                                              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

                                                  elif switch_type == 'distributed':
                                                      network_ref = salt.utils.vmware.get_mor_by_property(_get_si(),
                                                                                                          vim.dvs.DistributedVirtualPortgroup,
                                                                                                          network_name,
                                                                                                          container_ref=container_ref)
                                              Severity: Minor
                                              Found in salt/cloud/clouds/vmware.py and 1 other location - About 30 mins to fix
                                              salt/cloud/clouds/vmware.py on lines 520..529

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

                                              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