saltstack/salt

View on GitHub
salt/modules/vsphere.py

Summary

Maintainability
F
2 mos
Test Coverage

File vsphere.py has 7717 lines of code (exceeds 250 allowed). Consider refactoring.
Invalid

# -*- coding: utf-8 -*-
'''
Manage VMware vCenter servers and ESXi hosts.

.. versionadded:: 2015.8.4
Severity: Major
Found in salt/modules/vsphere.py - About 3 wks to fix

    Function _apply_cluster_dict has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_cluster_dict(cluster_spec, cluster_dict, vsan_spec=None,
                            vsan_61=True):
        '''
        Applies the values of cluster_dict dictionary to a cluster spec
        (vim.ClusterConfigSpecEx).
    Severity: Minor
    Found in salt/modules/vsphere.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

    Function get_vm_config has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_vm_config(name, datacenter=None, objects=True, service_instance=None):
        '''
        Queries and converts the virtual machine properties to the available format
        from the schema. If the objects attribute is True the config objects will
        have extra properties, like 'object' which will include the
    Severity: Minor
    Found in salt/modules/vsphere.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

    Function add_host_to_dvs has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_host_to_dvs(host, username, password, vmknic_name, vmnic_name,
                        dvs_name, target_portgroup_name, uplink_portgroup_name,
                        protocol=None, port=None, host_names=None):
        '''
        Adds an ESXi host to a vSphere Distributed Virtual Switch and migrates
    Severity: Minor
    Found in salt/modules/vsphere.py - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function gets_service_instance_via_proxy has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def gets_service_instance_via_proxy(fn):
        '''
        Decorator that connects to a target system (vCenter or ESXi host) using the
        proxy details and passes the connection (vim.ServiceInstance) to
        the decorated function.
    Severity: Minor
    Found in salt/modules/vsphere.py - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _apply_cluster_dict(cluster_spec, cluster_dict, vsan_spec=None,
                            vsan_61=True):
        '''
        Applies the values of cluster_dict dictionary to a cluster spec
        (vim.ClusterConfigSpecEx).
    Severity: Minor
    Found in salt/modules/vsphere.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 update_vm has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_vm(vm_name, cpu=None, memory=None, image=None, version=None,
                  interfaces=None, disks=None, scsi_devices=None,
                  serial_ports=None, datacenter=None, datastore=None,
                  cd_dvd_drives=None, sata_controllers=None, advanced_configs=None,
                  service_instance=None):
    Severity: Minor
    Found in salt/modules/vsphere.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 set_syslog_config has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_syslog_config(host,
                          username,
                          password,
                          syslog_config,
                          config_value,
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_dvportgroup_teaming has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_dvportgroup_teaming(pg_name, teaming, teaming_conf):
        '''
        Applies the values in teaming_conf to a teaming policy object
    
        pg_name
    Severity: Minor
    Found in salt/modules/vsphere.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 set_service_policy has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_service_policy(host,
                           username,
                           password,
                           service_name,
                           service_policy,
    Severity: Minor
    Found in salt/modules/vsphere.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

    Function compare_vm_configs has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def compare_vm_configs(new_config, current_config):
        '''
        Compares virtual machine current and new configuration, the current is the
        one which is deployed now, and the new is the target config. Returns the
        differences between the objects in a dictionary, the keys are the
    Severity: Minor
    Found in salt/modules/vsphere.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 get_vm_config. (32)
    Open

    @gets_service_instance_via_proxy
    def get_vm_config(name, datacenter=None, objects=True, service_instance=None):
        '''
        Queries and converts the virtual machine properties to the available format
        from the schema. If the objects attribute is True the config objects will
    Severity: Minor
    Found in salt/modules/vsphere.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_disks has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_disks(service_instance, disks, scsi_controllers=None, parent=None):
        '''
        Returns a list of disk specs representing the disks to be created for a
        virtual machine
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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

    Function vsan_add_disks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def vsan_add_disks(host, username, password, protocol=None, port=None, host_names=None):
        '''
        Add any VSAN-eligible disks to the VSAN System for the given host or list of host_names.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 update_vm. (28)
    Open

    @depends(HAS_PYVMOMI)
    @supports_proxies('esxvm', 'esxcluster', 'esxdatacenter')
    @gets_service_instance_via_proxy
    def update_vm(vm_name, cpu=None, memory=None, image=None, version=None,
                  interfaces=None, disks=None, scsi_devices=None,
    Severity: Minor
    Found in salt/modules/vsphere.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 _update_scsi_devices has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def _update_scsi_devices(scsis_old_new, current_disks):
        '''
        Returns a list of vim.vm.device.VirtualDeviceSpec specifying  the scsi
        properties as input the old and new configs are defined in a dictionary.
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_dvportgroup_config has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_dvportgroup_config(pg_name, pg_spec, pg_conf):
        '''
        Applies the values in conf to a distributed portgroup spec
    
        pg_name
    Severity: Minor
    Found in salt/modules/vsphere.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 _update_cd_drives has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def _update_cd_drives(drives_old_new, controllers=None, parent=None):
        '''
        Returns a list of vim.vm.device.VirtualDeviceSpec specifying to edit a
        deployed cd drive configuration to the new given config
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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 _get_vsan_eligible_disks has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_vsan_eligible_disks(service_instance, host, host_names):
        '''
        Helper function that returns a dictionary of host_name keys with either a list of eligible
        disks that can be added to VSAN or either an 'Error' message or a message saying no
        eligible disks were found. Possible keys/values look like:
    Severity: Minor
    Found in salt/modules/vsphere.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_cluster has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_cluster(cluster_dict, datacenter=None, cluster=None,
                       service_instance=None):
        '''
        Creates a cluster.
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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_to_dvs. (25)
    Open

    @depends(HAS_PYVMOMI)
    @ignores_kwargs('credstore')
    def add_host_to_dvs(host, username, password, vmknic_name, vmnic_name,
                        dvs_name, target_portgroup_name, uplink_portgroup_name,
                        protocol=None, port=None, host_names=None):
    Severity: Minor
    Found in salt/modules/vsphere.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 update_dvs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_dvs(dvs_dict, dvs, service_instance=None):
        '''
        Updates a distributed virtual switch (DVS).
    
        Note: Updating the product info, capability, uplinks of a DVS is not
    Severity: Minor
    Found in salt/modules/vsphere.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_adapter_type has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_adapter_type(network_adapter, adapter_type,
                             network_adapter_label=''):
        '''
        Returns a vim.vm.device.VirtualEthernetCard object specifying a virtual
        ethernet card information
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_dvs_infrastructure_traffic_resources has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_dvs_infrastructure_traffic_resources(infra_traffic_resources,
                                                    resource_dicts):
        '''
        Applies the values of the resource dictionaries to infra traffic resources,
        creating the infra traffic resource if required
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_policy_config has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_policy_config(policy_spec, policy_dict):
        '''Applies a policy dictionary to a policy spec'''
        log.trace('policy_dict = %s', policy_dict)
        if policy_dict.get('name'):
            policy_spec.name = policy_dict['name']
    Severity: Minor
    Found in salt/modules/vsphere.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 update_cluster has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_cluster(cluster_dict, datacenter=None, cluster=None,
                       service_instance=None):
        '''
        Updates a cluster.
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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_vm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_vm(vm_name, cpu, memory, image, version, datacenter, datastore,
                  placement, interfaces, disks, scsi_devices, serial_ports=None,
                  ide_controllers=None, sata_controllers=None, cd_drives=None,
                  advanced_configs=None, service_instance=None):
        '''
    Severity: Minor
    Found in salt/modules/vsphere.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 get_service_policy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_service_policy(host, username, password, service_name, protocol=None, port=None, host_names=None):
        '''
        Get the service name's policy for a given host or list of hosts.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 coredump_network_enable has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def coredump_network_enable(host, username, password, enabled, protocol=None, port=None, esxi_hosts=None, credstore=None):
        '''
        Enable or disable ESXi core dump collection. Returns ``True`` if coredump is enabled
        and returns ``False`` if core dump is not enabled. If there was an error, the error
        will be the value printed in the ``Error`` key dictionary for the given host.
    Severity: Minor
    Found in salt/modules/vsphere.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_cluster_dict has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_cluster_dict(cluster_name, cluster_ref):
        '''
        Returns a cluster dict representation from
        a vim.ClusterComputeResource object.
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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_cd_drives has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_cd_drives(cd_drives, controllers=None, parent_ref=None):
        '''
        Returns a list of vim.vm.device.VirtualDeviceSpec objects representing the
        CD/DVD drives to be created for a virtual machine
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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_service_running has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_service_running(host, username, password, service_name, protocol=None, port=None, host_names=None):
        '''
        Get the service name's running state for a given host or list of hosts.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 register_vm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def register_vm(name, datacenter, placement, vmx_path, service_instance=None):
        '''
        Registers a virtual machine to the inventory with the given vmx file.
        Returns comments and change list
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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_coredump_network_config has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_coredump_network_config(host, username, password, protocol=None, port=None, esxi_hosts=None, credstore=None):
        '''
        Retrieve information on ESXi or vCenter network dump collection and
        format it into a dictionary.
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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_firewall_status has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_firewall_status(host, username, password, protocol=None, port=None, esxi_hosts=None, credstore=None):
        '''
        Show status of all firewall rule sets.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 set_coredump_network_config has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_coredump_network_config(host,
                                    username,
                                    password,
                                    dump_ip,
                                    protocol=None,
    Severity: Minor
    Found in salt/modules/vsphere.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 esxcli_cmd has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def esxcli_cmd(cmd_str, host=None, username=None, password=None, protocol=None, port=None, esxi_hosts=None, credstore=None):
        '''
        Run an ESXCLI command directly on the host or list of hosts.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 _format_coredump_stdout has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _format_coredump_stdout(cmd_ret):
        '''
        Helper function to format the stdout from the get_coredump_network_config function.
    
        cmd_ret
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_advanced_config has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_advanced_config(config_spec, advanced_config, vm_extra_config=None):
        '''
        Sets configuration parameters for the vm
    
        config_spec
    Severity: Minor
    Found in salt/modules/vsphere.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_datastores_via_proxy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_datastores_via_proxy(datastore_names=None, backing_disk_ids=None,
                                  backing_disk_scsi_addresses=None,
                                  service_instance=None):
        '''
        Returns a list of dict representations of the datastores visible to the
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_dvs_config has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_dvs_config(config_spec, config_dict):
        '''
        Applies the values of the config dict dictionary to a config spec
        (vim.VMwareDVSConfigSpec)
        '''
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_serial_port has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_serial_port(serial_device_spec, key, operation='add'):
        '''
        Returns a vim.vm.device.VirtualSerialPort representing a serial port
        component
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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_policy_dict has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_policy_dict(policy):
        '''Returns a dictionary representation of a policy'''
        profile_dict = {'name': policy.name,
                        'description': policy.description,
                        'resource_type': policy.resourceType.resourceType}
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_dvs_network_resource_pools has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_dvs_network_resource_pools(network_resource_pools, resource_dicts):
        '''
        Applies the values of the resource dictionaries to network resource pools,
        creating the resource pools if required
        (vim.DVSNetworkResourcePoolConfigSpec)
    Severity: Minor
    Found in salt/modules/vsphere.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 reset_syslog_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def reset_syslog_config(host,
                            username,
                            password,
                            protocol=None,
                            port=None,
    Severity: Minor
    Found in salt/modules/vsphere.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_vsan_eligible_disks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_vsan_eligible_disks(host, username, password, protocol=None, port=None, host_names=None):
        '''
        Returns a list of VSAN-eligible disks for a given host or list of host_names.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 service_start has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def service_start(host,
                      username,
                      password,
                      service_name,
                      protocol=None,
    Severity: Minor
    Found in salt/modules/vsphere.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_network_backing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_network_backing(network_name, switch_type, parent_ref):
        '''
        Returns a vim.vm.device.VirtualDevice.BackingInfo object specifying a
        virtual ethernet card backing information
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_cd_drive has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_cd_drive(drive_label, key, device_type, operation,
                        client_device=None, datastore_iso_file=None,
                        connectable=None, controller_key=200, parent_ref=None):
        '''
        Returns a vim.vm.device.VirtualDeviceSpec object specifying to add/edit a
    Severity: Minor
    Found in salt/modules/vsphere.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 vsan_enable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def vsan_enable(host, username, password, protocol=None, port=None, host_names=None):
        '''
        Enable VSAN for a given host or list of host_names.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_hard_disk has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_hard_disk(unit_number, key, operation, disk_label=None, size=None,
                         unit='GB', controller_key=None, thin_provision=None,
                         eagerly_scrub=None, datastore=None, filename=None):
        '''
        Returns a vim.vm.device.VirtualDeviceSpec object specifying to add/edit
    Severity: Minor
    Found in salt/modules/vsphere.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 vsan_disable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def vsan_disable(host, username, password, protocol=None, port=None, host_names=None):
        '''
        Disable VSAN for a given host or list of host_names.
    
        host
    Severity: Minor
    Found in salt/modules/vsphere.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 _update_disks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _update_disks(disks_old_new):
        '''
        Changes the disk size and returns the config spec objects in a list.
        The controller property cannot be updated, because controller address
        identifies the disk by the unit and bus number properties.
    Severity: Minor
    Found in salt/modules/vsphere.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 service_restart has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def service_restart(host,
                        username,
                        password,
                        service_name,
                        protocol=None,
    Severity: Minor
    Found in salt/modules/vsphere.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 service_stop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def service_stop(host,
                     username,
                     password,
                     service_name,
                     protocol=None,
    Severity: Minor
    Found in salt/modules/vsphere.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_dvs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_dvs(dvs_dict, dvs_name, service_instance=None):
        '''
        Creates a distributed virtual switch (DVS).
    
        Note: The ``dvs_name`` param will override any name set in ``dvs_dict``.
    Severity: Minor
    Found in salt/modules/vsphere.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 _get_proxy_target has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_proxy_target(service_instance):
        '''
        Returns the target object of a proxy.
    
        If the object doesn't exist a VMwareObjectRetrievalError is raised
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_scsi_controller has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_scsi_controller(adapter, adapter_type, bus_sharing, key,
                               bus_number, operation):
        '''
        Returns a vim.vm.device.VirtualDeviceSpec object specifying to
        add/edit a SCSI controller
    Severity: Minor
    Found in salt/modules/vsphere.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 list_dvportgroups has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_dvportgroups(dvs=None, portgroup_names=None, service_instance=None):
        '''
        Returns a list of distributed virtual switch portgroups.
        The list can be filtered by the portgroup names or by the DVS.
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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 _apply_memory_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _apply_memory_config(config_spec, memory):
        '''
        Sets memory size to the given value
    
        config_spec
    Severity: Minor
    Found in salt/modules/vsphere.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_network_adapters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_network_adapters(network_interfaces, parent=None):
        '''
        Returns a list of vim.vm.device.VirtualDeviceSpec objects representing
        the interfaces to be created for a virtual machine
    
    
    Severity: Minor
    Found in salt/modules/vsphere.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

                        for current_disk in disks_to_update:
                            disk_spec = vim.vm.device.VirtualDeviceSpec()
                            disk_spec.device = current_disk
                            disk_spec.operation = 'edit'
                            device_config_specs.append(disk_spec)
    Severity: Major
    Found in salt/modules/vsphere.py - About 45 mins to fix

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

      def _reset_syslog_config_params(host, username, password, cmd, resets, valid_resets,
                                      protocol=None, port=None, esxi_host=None, credstore=None):
          '''
          Helper function for reset_syslog_config that resets the config and populates the return dictionary.
          '''
      Severity: Minor
      Found in salt/modules/vsphere.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

                          for disk_key in current_scsi['device']:
                              disk_objects = \
                                  [disk['object'] for disk in current_disks]
                              disks_to_update.append(
                                  _get_device_by_key(disk_objects, disk_key))
      Severity: Major
      Found in salt/modules/vsphere.py - About 45 mins to fix

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

        def remove_capacity_from_diskgroup(cache_disk_id, capacity_disk_ids,
                                           data_evacuation=True, safety_checks=True,
                                           service_instance=None):
            '''
            Remove capacity disks from the disk group with the specified cache disk.
        Severity: Minor
        Found in salt/modules/vsphere.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

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

        def add_capacity_to_diskgroup(cache_disk_id, capacity_disk_ids,
                                      safety_checks=True, service_instance=None):
            '''
            Adds capacity disks to the disk group with the specified cache disk.
        
        
        Severity: Minor
        Found in salt/modules/vsphere.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

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

        def upload_ssh_key(host, username, password, ssh_key=None, ssh_key_file=None,
                           protocol=None, port=None, certificate_verify=False):
            '''
            Upload an ssh key for root to an ESXi host via http PUT.
            This function only works for ESXi, not vCenter.
        Severity: Minor
        Found in salt/modules/vsphere.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 _get_proxy_connection_details has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_proxy_connection_details():
            '''
            Returns the connection details of the following proxies: esxi
            '''
            proxytype = get_proxy_type()
        Severity: Minor
        Found in salt/modules/vsphere.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 get_vm_config_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_vm_config_file(name, datacenter, placement, datastore,
                               service_instance=None):
            '''
            Queries the virtual machine config file and returns
            vim.host.DatastoreBrowser.SearchResults object on success None on failure
        Severity: Minor
        Found in salt/modules/vsphere.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 _apply_network_adapter_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def _apply_network_adapter_config(key, network_name, adapter_type, switch_type,
                                          network_adapter_label=None, operation='add',
                                          connectable=None, mac=None, parent=None):
            '''
            Returns a vim.vm.device.VirtualDeviceSpec object specifying to add/edit a
        Severity: Minor
        Found in salt/modules/vsphere.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 list_dvss has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def list_dvss(datacenter=None, dvs_names=None, service_instance=None):
            '''
            Returns a list of distributed virtual switches (DVSs).
            The list can be filtered by the datacenter or DVS names.
        
        
        Severity: Minor
        Found in salt/modules/vsphere.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_syslog_config_helper has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def _set_syslog_config_helper(host, username, password, syslog_config, config_value,
                                      protocol=None, port=None, reset_service=None, esxi_host=None, credstore=None):
            '''
            Helper function for set_syslog_config that sets the config and populates the return dictionary.
            '''
        Severity: Minor
        Found in salt/modules/vsphere.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 _delete_advanced_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def _delete_advanced_config(config_spec, advanced_config, vm_extra_config):
            '''
            Removes configuration parameters for the vm
        
            config_spec
        Severity: Minor
        Found in salt/modules/vsphere.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 _convert_units has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def _convert_units(devices):
            '''
            Updates the size and unit dictionary values with the new unit values
        
            devices
        Severity: Minor
        Found in salt/modules/vsphere.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 create_diskgroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def create_diskgroup(cache_disk_id, capacity_disk_ids, safety_checks=True,
                             service_instance=None):
            '''
            Creates disk group on an ESXi host with the specified cache and
            capacity disks.
        Severity: Minor
        Found in salt/modules/vsphere.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 syslog_service_reload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def syslog_service_reload(host, username, password, protocol=None, port=None, esxi_hosts=None, credstore=None):
            '''
            Reload the syslog service so it will pick up any changes.
        
            host
        Severity: Minor
        Found in salt/modules/vsphere.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 enable_firewall_ruleset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def enable_firewall_ruleset(host,
                                    username,
                                    password,
                                    ruleset_enable,
                                    ruleset_name,
        Severity: Minor
        Found in salt/modules/vsphere.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_syslog_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_syslog_config(host, username, password, protocol=None, port=None, esxi_hosts=None, credstore=None):
            '''
            Retrieve the syslog configuration.
        
            host
        Severity: Minor
        Found in salt/modules/vsphere.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_host_disks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_host_disks(host_reference):
            '''
            Helper function that returns a dictionary containing a list of SSD and Non-SSD disks.
            '''
            storage_system = host_reference.configManager.storageSystem
        Severity: Minor
        Found in salt/modules/vsphere.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 _update_network_adapters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _update_network_adapters(interface_old_new, parent):
            '''
            Returns a list of vim.vm.device.VirtualDeviceSpec specifying
            configuration(s) for changed network adapters, the adapter type cannot
            be changed, as input the old and new configs are defined in a dictionary.
        Severity: Minor
        Found in salt/modules/vsphere.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 _update_serial_ports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _update_serial_ports(serial_old_new):
            '''
            Returns a list of vim.vm.device.VirtualDeviceSpec specifying to edit a
            deployed serial port configuration to the new given config
        
        
        Severity: Minor
        Found in salt/modules/vsphere.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

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def service_stop(host,
                         username,
                         password,
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 3 days to fix
        salt/modules/vsphere.py on lines 2631..2739
        salt/modules/vsphere.py on lines 2853..2961

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

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def service_restart(host,
                            username,
                            password,
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 3 days to fix
        salt/modules/vsphere.py on lines 2631..2739
        salt/modules/vsphere.py on lines 2742..2850

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

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def service_start(host,
                          username,
                          password,
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 3 days to fix
        salt/modules/vsphere.py on lines 2742..2850
        salt/modules/vsphere.py on lines 2853..2961

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

        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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def get_service_policy(host, username, password, service_name, protocol=None, port=None, host_names=None):
            '''
            Get the service name's policy for a given host or list of hosts.
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 days to fix
        salt/modules/vsphere.py on lines 1639..1743

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

        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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def get_service_running(host, username, password, service_name, protocol=None, port=None, host_names=None):
            '''
            Get the service name's running state for a given host or list of hosts.
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 days to fix
        salt/modules/vsphere.py on lines 1532..1636

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

        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

        @depends(HAS_PYVMOMI)
        @supports_proxies('esxvm', 'esxcluster', 'esxdatacenter')
        @gets_service_instance_via_proxy
        def power_on_vm(name, datacenter=None, service_instance=None):
            '''
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 day to fix
        salt/modules/vsphere.py on lines 9534..9573

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

        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

        @depends(HAS_PYVMOMI)
        @supports_proxies('esxvm', 'esxcluster', 'esxdatacenter')
        @gets_service_instance_via_proxy
        def power_off_vm(name, datacenter=None, service_instance=None):
            '''
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 day to fix
        salt/modules/vsphere.py on lines 9492..9531

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

        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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_ssds(host, username, password, protocol=None, port=None, host_names=None):
            '''
            Returns a list of SSDs for the given host or list of host_names.
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 day to fix
        salt/modules/vsphere.py on lines 2483..2548

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

        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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_non_ssds(host, username, password, protocol=None, port=None, host_names=None):
            '''
            Returns a list of Non-SSD disks for the given host or list of host_names.
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 day to fix
        salt/modules/vsphere.py on lines 2422..2480

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

        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

        @depends(HAS_PYVMOMI)
        @supports_proxies('esxvm', 'esxcluster', 'esxdatacenter')
        @gets_service_instance_via_proxy
        def unregister_vm(name, datacenter, placement=None, power_off=False,
                          service_instance=None):
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 day to fix
        salt/modules/vsphere.py on lines 9618..9659

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

        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

        @depends(HAS_PYVMOMI)
        @supports_proxies('esxvm', 'esxcluster', 'esxdatacenter')
        @gets_service_instance_via_proxy
        def delete_vm(name, datacenter, placement=None, power_off=False,
                      service_instance=None):
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 day to fix
        salt/modules/vsphere.py on lines 9662..9703

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

        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 proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
                if not cluster:
                    raise ArgumentValueError('\'cluster\' needs to be specified')
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 7 hrs to fix
        salt/modules/vsphere.py on lines 5420..5428

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

        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 proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
                if not cluster:
                    raise ArgumentValueError('\'cluster\' needs to be specified')
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 7 hrs to fix
        salt/modules/vsphere.py on lines 5325..5333

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

        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 esxi_hosts:
                if not isinstance(esxi_hosts, list):
                    raise CommandExecutionError('\'esxi_hosts\' must be a list.')
        
                for esxi_host in esxi_hosts:
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 7 hrs to fix
        salt/modules/vsphere.py on lines 899..913

        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 esxi_hosts:
                if not isinstance(esxi_hosts, list):
                    raise CommandExecutionError('\'esxi_hosts\' must be a list.')
        
                for esxi_host in esxi_hosts:
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 7 hrs to fix
        salt/modules/vsphere.py on lines 964..978

        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

                        try:
                            task = vsan_system.AddDisks(eligible)
                            salt.utils.vmware.wait_for_task(task, host_name, 'Adding disks to VSAN', sleep_seconds=3)
                        except vim.fault.InsufficientDisks as err:
                            log.debug(err.msg)
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 7 hrs to fix
        salt/modules/vsphere.py on lines 3538..3550

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

        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:
                        # Disable vsan on the host
                        task = vsan_system.UpdateVsan_Task(vsan_config)
                        salt.utils.vmware.wait_for_task(task, host_name, 'Disabling VSAN', sleep_seconds=3)
                    except vmodl.fault.SystemError as err:
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 7 hrs to fix
        salt/modules/vsphere.py on lines 3435..3446

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3768..3773
        salt/modules/vsphere.py on lines 3965..3970
        salt/modules/vsphere.py on lines 4043..4048
        salt/modules/vsphere.py on lines 4234..4239
        salt/modules/vsphere.py on lines 4275..4280
        salt/modules/vsphere.py on lines 4500..4505
        salt/modules/vsphere.py on lines 4601..4606

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3768..3773
        salt/modules/vsphere.py on lines 4043..4048
        salt/modules/vsphere.py on lines 4234..4239
        salt/modules/vsphere.py on lines 4275..4280
        salt/modules/vsphere.py on lines 4500..4505
        salt/modules/vsphere.py on lines 4550..4555
        salt/modules/vsphere.py on lines 4601..4606

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3965..3970
        salt/modules/vsphere.py on lines 4043..4048
        salt/modules/vsphere.py on lines 4234..4239
        salt/modules/vsphere.py on lines 4275..4280
        salt/modules/vsphere.py on lines 4500..4505
        salt/modules/vsphere.py on lines 4550..4555
        salt/modules/vsphere.py on lines 4601..4606

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3768..3773
        salt/modules/vsphere.py on lines 3965..3970
        salt/modules/vsphere.py on lines 4043..4048
        salt/modules/vsphere.py on lines 4275..4280
        salt/modules/vsphere.py on lines 4500..4505
        salt/modules/vsphere.py on lines 4550..4555
        salt/modules/vsphere.py on lines 4601..4606

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3768..3773
        salt/modules/vsphere.py on lines 3965..3970
        salt/modules/vsphere.py on lines 4043..4048
        salt/modules/vsphere.py on lines 4234..4239
        salt/modules/vsphere.py on lines 4275..4280
        salt/modules/vsphere.py on lines 4500..4505
        salt/modules/vsphere.py on lines 4550..4555

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3768..3773
        salt/modules/vsphere.py on lines 3965..3970
        salt/modules/vsphere.py on lines 4043..4048
        salt/modules/vsphere.py on lines 4234..4239
        salt/modules/vsphere.py on lines 4275..4280
        salt/modules/vsphere.py on lines 4550..4555
        salt/modules/vsphere.py on lines 4601..4606

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3768..3773
        salt/modules/vsphere.py on lines 3965..3970
        salt/modules/vsphere.py on lines 4043..4048
        salt/modules/vsphere.py on lines 4234..4239
        salt/modules/vsphere.py on lines 4500..4505
        salt/modules/vsphere.py on lines 4550..4555
        salt/modules/vsphere.py on lines 4601..4606

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

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

            if proxy_type == 'esxdatacenter':
                datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
                dc_ref = _get_proxy_target(service_instance)
            elif proxy_type == 'esxcluster':
                datacenter = __salt__['esxcluster.get_details']()['datacenter']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 4 hrs to fix
        salt/modules/vsphere.py on lines 3768..3773
        salt/modules/vsphere.py on lines 3965..3970
        salt/modules/vsphere.py on lines 4234..4239
        salt/modules/vsphere.py on lines 4275..4280
        salt/modules/vsphere.py on lines 4500..4505
        salt/modules/vsphere.py on lines 4550..4555
        salt/modules/vsphere.py on lines 4601..4606

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

        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 not disk_id:
                scsi_address_to_lun = \
                        salt.utils.vmware.get_scsi_address_to_lun_map(host_ref)
                if scsi_address not in scsi_address_to_lun:
                    raise VMwareObjectRetrievalError(
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 3 hrs to fix
        salt/modules/vsphere.py on lines 6101..6110

        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

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

            if not disk_id:
                scsi_address_to_lun = \
                        salt.utils.vmware.get_scsi_address_to_lun_map(host_ref)
                if scsi_address not in scsi_address_to_lun:
                    raise VMwareObjectRetrievalError(
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 3 hrs to fix
        salt/modules/vsphere.py on lines 6046..6055

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_vms(host, username, password, protocol=None, port=None):
            '''
            Returns a list of VMs for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_folders(host, username, password, protocol=None, port=None):
            '''
            Returns a list of folders for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_datastores(host, username, password, protocol=None, port=None):
            '''
            Returns a list of datastores for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_dvs(host, username, password, protocol=None, port=None):
            '''
            Returns a list of distributed virtual switches for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_vapps(host, username, password, protocol=None, port=None):
            '''
            Returns a list of vApps for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_datacenters(host, username, password, protocol=None, port=None):
            '''
            Returns a list of datacenters for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_clusters(host, username, password, protocol=None, port=None):
            '''
            Returns a list of clusters for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_networks(host, username, password, protocol=None, port=None):
            '''
            Returns a list of networks for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_resourcepools(host, username, password, protocol=None, port=None):
            '''
            Returns a list of resource pools for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_hosts(host, username, password, protocol=None, port=None):
            '''
            Returns a list of hosts for the the specified VMware environment.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2088..2122
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

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

        @depends(HAS_PYVMOMI)
        @ignores_kwargs('credstore')
        def list_datastore_clusters(host, username, password, protocol=None, port=None):
            '''
            Returns a list of datastore clusters for the the specified host.
        Severity: Major
        Found in salt/modules/vsphere.py and 10 other locations - About 2 hrs to fix
        salt/modules/vsphere.py on lines 2012..2047
        salt/modules/vsphere.py on lines 2050..2085
        salt/modules/vsphere.py on lines 2125..2159
        salt/modules/vsphere.py on lines 2162..2196
        salt/modules/vsphere.py on lines 2199..2233
        salt/modules/vsphere.py on lines 2236..2270
        salt/modules/vsphere.py on lines 2273..2307
        salt/modules/vsphere.py on lines 2310..2344
        salt/modules/vsphere.py on lines 2347..2381
        salt/modules/vsphere.py on lines 2384..2419

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 69.

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

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

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

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

        Refactorings

        Further Reading

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

                        if response['retcode'] != 0:
                            ret.update({esxi_host: {'enable_firewall': {'message': response['stdout'],
                                                                        'success': False}}})
                        else:
                            ret.update({esxi_host: {'enable_firewall': {'success': True}}})
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 1085..1089

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 67.

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

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

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

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

        Refactorings

        Further Reading

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

                    if response['retcode'] != 0:
                        ret.update({host: {'enable_firewall': {'message': response['stdout'],
                                                               'success': False}}})
                    else:
                        ret.update({host: {'enable_firewall': {'success': True}}})
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 1074..1078

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 67.

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

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

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

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

        Refactorings

        Further Reading

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

                    if bus_sharing == 'noSharing':
                        controller['bus_sharing'] = 'no_sharing'
                    elif bus_sharing == 'virtualSharing':
                        controller['bus_sharing'] = 'virtual_sharing'
                    elif bus_sharing == 'physicalSharing':
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/states/glassfish.py on lines 458..465

        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 'vim25/6.0' in VmomiSupport.versionMap and \
                sys.version_info > (2, 7) and sys.version_info < (2, 7, 9):
        
                log.debug('pyVmomi not loaded: Incompatible versions '
                          'of Python. See Issue #29537.')
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/states/esxi.py on lines 124..129

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

                    if response['retcode'] != 0:
                        ret.update({esxi_host: {'Error': response['stdout'],
                                                'success': False,
                                                'rulesets': None}})
                    else:
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 827..833

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

        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 response['retcode'] != 0:
                    ret.update({host: {'Error': response['stdout'],
                                       'success': False,
                                       'rulesets': None}})
                else:
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 815..821

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

        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 safety_checks:
                for id in capacity_disk_ids:
                    if not [d for d in disks if d.canonicalName == id]:
                        raise VMwareObjectRetrievalError(
                            'No disk with id \'{0}\' was found in ESXi host \'{1}\''
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 6354..6359

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

        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 safety_checks:
                for id in capacity_disk_ids:
                    if not [d for d in disks if d.canonicalName == id]:
                        raise VMwareObjectRetrievalError(
                            'No disk with id \'{0}\' was found in ESXi host \'{1}\''
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 6285..6290

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

        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 filtered_traffic_resources:
                    traffic_res = filtered_traffic_resources[0]
                else:
                    traffic_res = vim.DvsHostInfrastructureTrafficResource()
                    traffic_res.key = res_dict['key']
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 3922..3929

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

        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 ress:
                    res = ress[0]
                else:
                    res = vim.DVSNetworkResourcePoolConfigSpec()
                    res.key = res_dict['key']
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 2 hrs to fix
        salt/modules/vsphere.py on lines 3890..3897

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

        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 response['retcode'] != 0:
                        ret.update({esxi_host: {'Error': response.get('stdout')}})
                    else:
                        ret.update({esxi_host: {'Coredump Enabled': enabled}})
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 654..657

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

        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 response['retcode'] != 0:
                    ret.update({host: {'Error': response.get('stdout')}})
                else:
                    ret.update({host: {'Coredump Enabled': enabled}})
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 644..647

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

        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

            if operation == 'add':
                sata_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
            elif operation == 'edit':
                sata_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit
        Severity: Major
        Found in salt/modules/vsphere.py and 4 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 7792..7797
        salt/modules/vsphere.py on lines 7871..7874
        salt/modules/vsphere.py on lines 8058..8061
        salt/modules/vsphere.py on lines 8162..8165

        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

            if operation == 'add':
                network_spec.operation = \
                    vim.vm.device.VirtualDeviceSpec.Operation.add
            elif operation == 'edit':
                network_spec.operation = \
        Severity: Major
        Found in salt/modules/vsphere.py and 4 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 7871..7874
        salt/modules/vsphere.py on lines 7991..7994
        salt/modules/vsphere.py on lines 8058..8061
        salt/modules/vsphere.py on lines 8162..8165

        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

            if operation == 'add':
                scsi_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
            elif operation == 'edit':
                scsi_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit
        Severity: Major
        Found in salt/modules/vsphere.py and 4 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 7792..7797
        salt/modules/vsphere.py on lines 7991..7994
        salt/modules/vsphere.py on lines 8058..8061
        salt/modules/vsphere.py on lines 8162..8165

        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

            if operation == 'add':
                drive_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
            elif operation == 'edit':
                drive_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit
        Severity: Major
        Found in salt/modules/vsphere.py and 4 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 7792..7797
        salt/modules/vsphere.py on lines 7871..7874
        salt/modules/vsphere.py on lines 7991..7994
        salt/modules/vsphere.py on lines 8162..8165

        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

            if operation == 'add':
                device_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
            elif operation == 'edit':
                device_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit
        Severity: Major
        Found in salt/modules/vsphere.py and 4 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 7792..7797
        salt/modules/vsphere.py on lines 7871..7874
        salt/modules/vsphere.py on lines 7991..7994
        salt/modules/vsphere.py on lines 8058..8061

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

            if 'teaming' in pg_conf:
                if not pg_spec.defaultPortConfig.uplinkTeamingPolicy:
                    pg_spec.defaultPortConfig.uplinkTeamingPolicy = \
                            vim.VmwareUplinkPortTeamingPolicy()
                _apply_dvportgroup_teaming(
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 4444..4450
        salt/modules/vsphere.py on lines 4451..4457

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

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

            if 'out_shaping' in pg_conf:
                if not pg_spec.defaultPortConfig.outShapingPolicy:
                    pg_spec.defaultPortConfig.outShapingPolicy = \
                            vim.DVSTrafficShapingPolicy()
                _apply_dvportgroup_out_shaping(
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 4451..4457
        salt/modules/vsphere.py on lines 4458..4464

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

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

            if 'security_policy' in pg_conf:
                if not pg_spec.defaultPortConfig.securityPolicy:
                    pg_spec.defaultPortConfig.securityPolicy = \
                            vim.DVSSecurityPolicy()
                _apply_dvportgroup_security_policy(
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 1 hr to fix
        salt/modules/vsphere.py on lines 4444..4450
        salt/modules/vsphere.py on lines 4458..4464

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

        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 response['retcode'] != 0:
                        ret.update({esxi_host: {'Error': response.get('stdout')}})
                    else:
                        ret.update({esxi_host: response})
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 500..503

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

                if response['retcode'] != 0:
                    ret.update({host: {'Error': response.get('stdout')}})
                else:
                    ret.update({host: response})
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 491..494

        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

            try:
                jsonschema.validate(
                    {'diskgroups': [{'cache_id': cache_disk_id,
                                     'capacity_ids': capacity_disk_ids}]},
                    schema)
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 6208..6214

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

        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

            try:
                jsonschema.validate(
                    {'diskgroups': [{'cache_id': cache_disk_id,
                                      'capacity_ids': capacity_disk_ids}]},
                    schema)
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 6275..6281

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

        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:
                    vmotion_system.DeselectVnic()
                except vim.fault.HostConfigFault as err:
                    msg = 'vsphere.vmotion_disable failed: {0}'.format(err)
                    log.debug(msg)
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 3351..3358

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

        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:
                    vmotion_system.SelectVnic(device)
                except vim.fault.HostConfigFault as err:
                    msg = 'vsphere.vmotion_disable failed: {0}'.format(err)
                    log.debug(msg)
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 3278..3285

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

        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 'service_instance' in arg_names:
                    idx = arg_names.index('service_instance')
                    if idx >= len(arg_names) - len(default_values):
                        # 'service_instance' has a default value:
                        #     we check if we need to instantiate it or
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 353..371

        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

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

                        if len(args) > idx:
                            # case 1: The call was made with enough positional
                            # parameters to include 'service_instance'
                            if not args[idx]:
                                local_service_instance = \
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 339..379

        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

                    if 'compression_enabled' in vsan_dict:
                        if not vsan_spec.dataEfficiencyConfig:
                            vsan_spec.dataEfficiencyConfig = \
                                    vim.vsan.DataEfficiencyConfig()
                        vsan_spec.dataEfficiencyConfig.compressionEnabled = \
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 5254..5259

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 48.

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

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

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

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

        Refactorings

        Further Reading

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

            if 'cpu' in difference_keys:
                if diffs['cpu'].changed() != set():
                    _apply_cpu_config(config_spec, diffs['cpu'].current_dict)
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 9316..9318

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 48.

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

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

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

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

        Refactorings

        Further Reading

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

                            device_config_specs.append(_apply_scsi_controller(
                                current_scsi['adapter'],
                                next_scsi['type'],
                                next_scsi['bus_sharing'],
                                current_scsi['key'],
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 8875..8901

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 48.

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

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

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

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

        Refactorings

        Further Reading

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

                    if 'dedup_enabled' in vsan_dict:
                        if not vsan_spec.dataEfficiencyConfig:
                            vsan_spec.dataEfficiencyConfig = \
                                    vim.vsan.DataEfficiencyConfig()
                        vsan_spec.dataEfficiencyConfig.dedupEnabled = \
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 5248..5253

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 48.

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

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

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

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

        Refactorings

        Further Reading

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

            if 'memory' in difference_keys:
                if diffs['memory'].changed() != set():
                    _apply_memory_config(config_spec, diffs['memory'].current_dict)
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 9313..9315

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 48.

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

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

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

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

        Refactorings

        Further Reading

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

                        if next_scsi['type'] != current_scsi['type']:
                            device_config_specs.append(
                                _delete_device(current_scsi['object']))
                            device_config_specs.append(_apply_scsi_controller(
                                current_scsi['adapter'],
        Severity: Major
        Found in salt/modules/vsphere.py and 1 other location - About 1 hr to fix
        salt/modules/vsphere.py on lines 8878..8883

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 48.

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

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

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

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

        Refactorings

        Further Reading

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

                if not v_nic:
                    ret[host_name].update({'message': 'Virtual nic {0} not found'.format(vmnic_name)})
                    ret['success'] = False
                    continue
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 55 mins to fix
        salt/modules/vsphere.py on lines 7016..7019
        salt/modules/vsphere.py on lines 7029..7032

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

                if not p_nic:
                    ret[host_name].update({'message': 'Physical nic {0} not found'.format(vmknic_name)})
                    ret['success'] = False
                    continue
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 55 mins to fix
        salt/modules/vsphere.py on lines 7016..7019
        salt/modules/vsphere.py on lines 7037..7040

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

                if not host_ref:
                    ret[host_name].update({'message': 'Host {1} not found'.format(host_name)})
                    ret['success'] = False
                    continue
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 55 mins to fix
        salt/modules/vsphere.py on lines 7029..7032
        salt/modules/vsphere.py on lines 7037..7040

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

                    if network_adapter:
                        log.trace('Changing type of \'%s\' from \'%s\' to \'%s\'',
                                  network_adapter.deviceInfo.label,
                                  type(network_adapter).__name__.rsplit(".", 1)[1][7:].lower(),
                                  adapter_type)
        Severity: Minor
        Found in salt/modules/vsphere.py and 1 other location - About 55 mins to fix
        salt/cloud/clouds/vmware.py on lines 357..364

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

                    if isinstance(device.backing,
                                  vim.vm.device.VirtualCdrom.RemotePassthroughBackingInfo):
                        drive['device_type'] = 'client_device'
                        drive['client_device'] = {'mode': 'passthrough'}
        Severity: Minor
        Found in salt/modules/vsphere.py and 1 other location - About 55 mins to fix
        salt/modules/vsphere.py on lines 8737..8740

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

                    if isinstance(device.backing,
                                  vim.vm.device.VirtualCdrom.RemoteAtapiBackingInfo):
                        drive['device_type'] = 'client_device'
                        drive['client_device'] = {'mode': 'atapi'}
        Severity: Minor
        Found in salt/modules/vsphere.py and 1 other location - About 55 mins to fix
        salt/modules/vsphere.py on lines 8733..8736

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

            if not policy_names:
                policies = salt.utils.pbm.get_storage_policies(profile_manager,
                                                               get_all_policies=True)
            else:
                policies = salt.utils.pbm.get_storage_policies(profile_manager,
        Severity: Minor
        Found in salt/modules/vsphere.py and 1 other location - About 50 mins to fix
        salt/modules/vsphere.py on lines 4988..4993

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

            if not datacenter_names:
                dc_refs = salt.utils.vmware.get_datacenters(service_instance,
                                                            get_all_datacenters=True)
            else:
                dc_refs = salt.utils.vmware.get_datacenters(service_instance,
        Severity: Minor
        Found in salt/modules/vsphere.py and 1 other location - About 50 mins to fix
        salt/modules/vsphere.py on lines 4679..4684

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

                if line.startswith('network server port:'):
                    ip_port = line.split(':')
                    ret_dict['port'] = ip_port[1].strip()
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 40 mins to fix
        salt/modules/vsphere.py on lines 6545..6547
        salt/modules/vsphere.py on lines 6548..6550

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

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

                if line.startswith('network server ip:'):
                    ip = line.split(':')
                    ret_dict['ip'] = ip[1].strip()
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 40 mins to fix
        salt/modules/vsphere.py on lines 6545..6547
        salt/modules/vsphere.py on lines 6551..6553

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

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

                if line.startswith('host vnic:'):
                    host_vnic = line.split(':')
                    ret_dict['host_vnic'] = host_vnic[1].strip()
        Severity: Major
        Found in salt/modules/vsphere.py and 2 other locations - About 40 mins to fix
        salt/modules/vsphere.py on lines 6548..6550
        salt/modules/vsphere.py on lines 6551..6553

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

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

                    if objects:
                        # int list, stores the keys of the disks which are attached
                        # to this controller
                        controller['device'] = device.device
                        controller['key'] = device.key
        Severity: Minor
        Found in salt/modules/vsphere.py and 2 other locations - About 35 mins to fix
        salt/modules/vsphere.py on lines 8749..8752
        salt/modules/vsphere.py on lines 8786..8789

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

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

                    if objects:
                        drive['key'] = device.key
                        drive['controller_key'] = device.controllerKey
                        drive['object'] = device
        Severity: Minor
        Found in salt/modules/vsphere.py and 2 other locations - About 35 mins to fix
        salt/modules/vsphere.py on lines 8667..8672
        salt/modules/vsphere.py on lines 8786..8789

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

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

                    if objects:
                        sata['device'] = device.device  # keys of the connected devices
                        sata['key'] = device.key
                        sata['object'] = device
        Severity: Minor
        Found in salt/modules/vsphere.py and 2 other locations - About 35 mins to fix
        salt/modules/vsphere.py on lines 8667..8672
        salt/modules/vsphere.py on lines 8749..8752

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

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

                if 'check_beacon' in failure_criteria_conf:
                    teaming.failureCriteria.checkBeacon = vim.BoolPolicy()
                    teaming.failureCriteria.checkBeacon.value = \
                            failure_criteria_conf['check_beacon']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4378..4381
        salt/modules/vsphere.py on lines 4382..4385
        salt/modules/vsphere.py on lines 4386..4389
        salt/modules/vsphere.py on lines 4390..4393
        salt/modules/vsphere.py on lines 4394..4397
        salt/modules/vsphere.py on lines 4398..4401
        salt/modules/vsphere.py on lines 4440..4443

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

            if 'vlan_id' in pg_conf:
                pg_spec.defaultPortConfig.vlan = \
                        vim.VmwareDistributedVirtualSwitchVlanIdSpec()
                pg_spec.defaultPortConfig.vlan.vlanId = pg_conf['vlan_id']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4374..4377
        salt/modules/vsphere.py on lines 4378..4381
        salt/modules/vsphere.py on lines 4382..4385
        salt/modules/vsphere.py on lines 4386..4389
        salt/modules/vsphere.py on lines 4390..4393
        salt/modules/vsphere.py on lines 4394..4397
        salt/modules/vsphere.py on lines 4398..4401

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

                if 'check_speed' in failure_criteria_conf:
                    teaming.failureCriteria.checkSpeed = vim.StringPolicy()
                    teaming.failureCriteria.checkSpeed.value = \
                            failure_criteria_conf['check_speed']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4374..4377
        salt/modules/vsphere.py on lines 4378..4381
        salt/modules/vsphere.py on lines 4382..4385
        salt/modules/vsphere.py on lines 4390..4393
        salt/modules/vsphere.py on lines 4394..4397
        salt/modules/vsphere.py on lines 4398..4401
        salt/modules/vsphere.py on lines 4440..4443

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

                if 'check_duplex' in failure_criteria_conf:
                    teaming.failureCriteria.checkDuplex = vim.BoolPolicy()
                    teaming.failureCriteria.checkDuplex.value = \
                            failure_criteria_conf['check_duplex']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4374..4377
        salt/modules/vsphere.py on lines 4382..4385
        salt/modules/vsphere.py on lines 4386..4389
        salt/modules/vsphere.py on lines 4390..4393
        salt/modules/vsphere.py on lines 4394..4397
        salt/modules/vsphere.py on lines 4398..4401
        salt/modules/vsphere.py on lines 4440..4443

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

                if 'check_error_percent' in failure_criteria_conf:
                    teaming.failureCriteria.checkErrorPercent = vim.BoolPolicy()
                    teaming.failureCriteria.checkErrorPercent.value = \
                            failure_criteria_conf['check_error_percent']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4374..4377
        salt/modules/vsphere.py on lines 4378..4381
        salt/modules/vsphere.py on lines 4386..4389
        salt/modules/vsphere.py on lines 4390..4393
        salt/modules/vsphere.py on lines 4394..4397
        salt/modules/vsphere.py on lines 4398..4401
        salt/modules/vsphere.py on lines 4440..4443

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

                if 'full_duplex' in failure_criteria_conf:
                    teaming.failureCriteria.fullDuplex = vim.BoolPolicy()
                    teaming.failureCriteria.fullDuplex.value = \
                            failure_criteria_conf['full_duplex']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4374..4377
        salt/modules/vsphere.py on lines 4378..4381
        salt/modules/vsphere.py on lines 4382..4385
        salt/modules/vsphere.py on lines 4386..4389
        salt/modules/vsphere.py on lines 4394..4397
        salt/modules/vsphere.py on lines 4398..4401
        salt/modules/vsphere.py on lines 4440..4443

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

                if 'percentage' in failure_criteria_conf:
                    teaming.failureCriteria.percentage = vim.IntPolicy()
                    teaming.failureCriteria.percentage.value = \
                            failure_criteria_conf['percentage']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4374..4377
        salt/modules/vsphere.py on lines 4378..4381
        salt/modules/vsphere.py on lines 4382..4385
        salt/modules/vsphere.py on lines 4386..4389
        salt/modules/vsphere.py on lines 4390..4393
        salt/modules/vsphere.py on lines 4398..4401
        salt/modules/vsphere.py on lines 4440..4443

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

                if 'speed' in failure_criteria_conf:
                    teaming.failureCriteria.speed = vim.IntPolicy()
                    teaming.failureCriteria.speed.value = \
                            failure_criteria_conf['speed']
        Severity: Major
        Found in salt/modules/vsphere.py and 7 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 4374..4377
        salt/modules/vsphere.py on lines 4378..4381
        salt/modules/vsphere.py on lines 4382..4385
        salt/modules/vsphere.py on lines 4386..4389
        salt/modules/vsphere.py on lines 4390..4393
        salt/modules/vsphere.py on lines 4394..4397
        salt/modules/vsphere.py on lines 4440..4443

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

            if not target_portgroup:
                ret['message'].append('No target portgroup found with name {0}'.format(target_portgroup_name))
                ret['success'] = False
        Severity: Minor
        Found in salt/modules/vsphere.py and 2 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 6980..6982
        salt/modules/vsphere.py on lines 6992..6994

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

            if not dvs:
                ret['message'].append('No Distributed Virtual Switch found with name {0}'.format(dvs_name))
                ret['success'] = False
        Severity: Minor
        Found in salt/modules/vsphere.py and 2 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 6986..6988
        salt/modules/vsphere.py on lines 6992..6994

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

            if not uplink_portgroup:
                ret['message'].append('No uplink portgroup found with name {0}'.format(uplink_portgroup_name))
                ret['success'] = False
        Severity: Minor
        Found in salt/modules/vsphere.py and 2 other locations - About 30 mins to fix
        salt/modules/vsphere.py on lines 6980..6982
        salt/modules/vsphere.py on lines 6986..6988

        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