saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

        if isinstance(opts.get('return'), six.string_types):
            if data['ret']:
                data['ret'] = ','.join((data['ret'], opts['return']))
            else:
                data['ret'] = opts['return']
Severity: Major
Found in salt/minion.py and 1 other location - About 4 hrs to fix
salt/metaproxy/proxy.py on lines 526..530

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

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

    for key in kwargs:
        if key in kwarg_map:
            opt = kwarg_map[key]
            if kwargs[key] == 'True':
                opts += '-{0} '.format(opt)
Severity: Major
Found in salt/modules/extfs.py and 1 other location - About 4 hrs to fix
salt/modules/extfs.py on lines 182..188

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

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

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

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

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

Refactorings

Further Reading

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

    if isinstance(data['fun'], six.string_types):
        if data['fun'] == 'sys.reload_modules':
            self.functions, self.returners, self.function_errors, self.executors = self._load_modules()
            self.schedule.functions = self.functions
            self.schedule.returners = self.returners
Severity: Major
Found in salt/metaproxy/proxy.py and 1 other location - About 4 hrs to fix
salt/minion.py on lines 1533..1537

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

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

    for key in kwargs:
        if key in kwarg_map:
            opt = kwarg_map[key]
            if kwargs[key] == 'True':
                opts += '-{0} '.format(opt)
Severity: Major
Found in salt/modules/extfs.py and 1 other location - About 4 hrs to fix
salt/modules/extfs.py on lines 97..103

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

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

        pub_load = {
            'fun': load['fun'],
            'arg': salt.utils.args.parse_input(
                load['arg'],
                no_parse=load.get('no_parse', [])),
Severity: Major
Found in salt/daemons/masterapi.py and 1 other location - About 4 hrs to fix
salt/daemons/masterapi.py on lines 1007..1015

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

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

def list_virtual(hostname, username, password, name):
    '''
    A function to list a specific virtual.

    hostname
Severity: Major
Found in salt/states/bigip.py and 2 other locations - About 4 hrs to fix
salt/states/bigip.py on lines 136..162
salt/states/bigip.py on lines 525..551

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

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 config_file:
        file_str = __salt__['cp.get_file_str'](config_file, saltenv=saltenv)
        if file_str is False:
            raise CommandExecutionError('Source file {} not found'.format(config_file))
    elif commands:
Severity: Major
Found in salt/modules/nxos.py and 2 other locations - About 4 hrs to fix
salt/modules/netmiko_mod.py on lines 555..562
salt/modules/nxos_api.py on lines 407..414

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

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 log_stdout is True:
            self.stdout_logger = logging.getLogger(
                '{0}.{1}.PID-{2}.STDOUT'.format(
                    __name__, self.__class__.__name__, self.pid
                )
Severity: Major
Found in salt/utils/vt.py and 2 other locations - About 4 hrs to fix
salt/utils/vt.py on lines 239..252
salt/utils/vt.py on lines 271..284

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

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

def list_node(hostname, username, password, name):
    '''
    A function to connect to a bigip device and list a specific node.

    hostname
Severity: Major
Found in salt/states/bigip.py and 2 other locations - About 4 hrs to fix
salt/states/bigip.py on lines 525..551
salt/states/bigip.py on lines 1564..1590

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

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 log_stderr is True:
            self.stderr_logger = logging.getLogger(
                '{0}.{1}.PID-{2}.STDERR'.format(
                    __name__, self.__class__.__name__, self.pid
                )
Severity: Major
Found in salt/utils/vt.py and 2 other locations - About 4 hrs to fix
salt/utils/vt.py on lines 239..252
salt/utils/vt.py on lines 255..268

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

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 config_file:
        file_str = __salt__['cp.get_file_str'](config_file, saltenv=saltenv)
        if file_str is False:
            raise CommandExecutionError('Source file {} not found'.format(config_file))
    elif commands:
Severity: Major
Found in salt/modules/nxos_api.py and 2 other locations - About 4 hrs to fix
salt/modules/netmiko_mod.py on lines 555..562
salt/modules/nxos.py on lines 530..537

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

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

def list_pool(hostname, username, password, name):
    '''
    A function to connect to a bigip device and list a specific pool.

    hostname
Severity: Major
Found in salt/states/bigip.py and 2 other locations - About 4 hrs to fix
salt/states/bigip.py on lines 136..162
salt/states/bigip.py on lines 1564..1590

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

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 config_file:
        file_str = __salt__['cp.get_file_str'](config_file, saltenv=saltenv)
        if file_str is False:
            raise CommandExecutionError('Source file {} not found'.format(config_file))
    elif config_commands:
Severity: Major
Found in salt/modules/netmiko_mod.py and 2 other locations - About 4 hrs to fix
salt/modules/nxos.py on lines 530..537
salt/modules/nxos_api.py on lines 407..414

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

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 'stp' in opts:
        if opts['stp'] in _CONFIG_TRUE:
            config.update({'stp': 'on'})
        elif opts['stp'] in _CONFIG_FALSE:
            config.update({'stp': 'off'})
Severity: Major
Found in salt/modules/debian_ip.py and 2 other locations - About 4 hrs to fix
salt/modules/debian_ip.py on lines 704..710
salt/modules/rh_ip.py on lines 141..147

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

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 log_stdin is True:
            self.stdin_logger = logging.getLogger(
                '{0}.{1}.PID-{2}.STDIN'.format(
                    __name__, self.__class__.__name__, self.pid
                )
Severity: Major
Found in salt/utils/vt.py and 2 other locations - About 4 hrs to fix
salt/utils/vt.py on lines 255..268
salt/utils/vt.py on lines 271..284

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

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 'autoneg' in opts:
        if opts['autoneg'] in _CONFIG_TRUE:
            config.update({'autoneg': 'on'})
        elif opts['autoneg'] in _CONFIG_FALSE:
            config.update({'autoneg': 'off'})
Severity: Major
Found in salt/modules/rh_ip.py and 2 other locations - About 4 hrs to fix
salt/modules/debian_ip.py on lines 704..710
salt/modules/debian_ip.py on lines 1175..1181

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

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 'autoneg' in opts:
        if opts['autoneg'] in _CONFIG_TRUE:
            config.update({'autoneg': 'on'})
        elif opts['autoneg'] in _CONFIG_FALSE:
            config.update({'autoneg': 'off'})
Severity: Major
Found in salt/modules/debian_ip.py and 2 other locations - About 4 hrs to fix
salt/modules/debian_ip.py on lines 1175..1181
salt/modules/rh_ip.py on lines 141..147

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

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

CreateManagedType('vim.cluster.VsanVcClusterHealthSystem', 'VsanVcClusterHealthSystem', 'vmodl.ManagedObject', 'vim.version.version9', [], [('queryClusterCreateVmHealthHistoryTest', 'VsanQueryVcClusterCreateVmHealthHistoryTest', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('count', 'int', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0 | F_OPTIONAL, 'vim.cluster.VsanClusterCreateVmHealthTestResult[]', 'vim.cluster.VsanClusterCreateVmHealthTestResult[]'), 'System.Read', None), ('setLogLevel', 'VsanHealthSetLogLevel', 'vim.version.version9', (('level', 'vim.cluster.VsanHealthLogLevelEnum', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'void', 'void'), 'System.Read', None), ('testVsanClusterTelemetryProxy', 'VsanHealthTestVsanClusterTelemetryProxy', 'vim.version.version9', (('proxyConfig', 'vim.cluster.VsanClusterTelemetryProxyConfig', 'vim.version.version9', 0, None), ), (0, 'boolean', 'boolean'), 'System.Read', None), ('uploadHclDb', 'VsanVcUploadHclDb', 'vim.version.version9', (('db', 'string', 'vim.version.version9', 0, None), ), (0, 'boolean', 'boolean'), 'System.Read', None), ('updateHclDbFromWeb', 'VsanVcUpdateHclDbFromWeb', 'vim.version.version9', (('url', 'string', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'boolean', 'boolean'), 'System.Read', None), ('repairClusterObjectsImmediate', 'VsanHealthRepairClusterObjectsImmediate', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('uuids', 'string[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ('queryClusterNetworkPerfTest', 'VsanQueryVcClusterNetworkPerfTest', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('multicast', 'boolean', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterNetworkLoadTestResult', 'vim.cluster.VsanClusterNetworkLoadTestResult'), 'System.Read', None), ('queryClusterVmdkLoadHistoryTest', 'VsanQueryVcClusterVmdkLoadHistoryTest', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('count', 'int', 'vim.version.version9', 0 | F_OPTIONAL, None), ('taskId', 'string', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0 | F_OPTIONAL, 'vim.cluster.VsanClusterVmdkLoadTestResult[]', 'vim.cluster.VsanClusterVmdkLoadTestResult[]'), 'System.Read', None), ('queryVsanClusterHealthCheckInterval', 'VsanHealthQueryVsanClusterHealthCheckInterval', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ), (0, 'int', 'int'), 'System.Read', None), ('queryClusterCreateVmHealthTest', 'VsanQueryVcClusterCreateVmHealthTest', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('timeout', 'int', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterCreateVmHealthTestResult', 'vim.cluster.VsanClusterCreateVmHealthTestResult'), 'System.Read', None), ('getClusterHclInfo', 'VsanVcClusterGetHclInfo', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('includeHostsResult', 'boolean', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.cluster.VsanClusterHclInfo', 'vim.cluster.VsanClusterHclInfo'), 'System.Read', None), ('queryAttachToSrHistory', 'VsanQueryAttachToSrHistory', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('count', 'int', 'vim.version.version9', 0 | F_OPTIONAL, None), ('taskId', 'string', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0 | F_OPTIONAL, 'vim.cluster.VsanAttachToSrOperation[]', 'vim.cluster.VsanAttachToSrOperation[]'), 'System.Read', None), ('rebalanceCluster', 'VsanRebalanceCluster', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('targetHosts', 'vim.HostSystem[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ('runVmdkLoadTest', 'VsanVcClusterRunVmdkLoadTest', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('runname', 'string', 'vim.version.version9', 0, None), ('durationSec', 'int', 'vim.version.version9', 0 | F_OPTIONAL, None), ('specs', 'vim.host.VsanVmdkLoadTestSpec[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ('action', 'string', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ('sendVsanTelemetry', 'VsanHealthSendVsanTelemetry', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ), (0, 'void', 'void'), 'System.Read', None), ('queryClusterNetworkPerfHistoryTest', 'VsanQueryVcClusterNetworkPerfHistoryTest', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('count', 'int', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0 | F_OPTIONAL, 'vim.cluster.VsanClusterNetworkLoadTestResult[]', 'vim.cluster.VsanClusterNetworkLoadTestResult[]'), 'System.Read', None), ('queryClusterHealthSummary', 'VsanQueryVcClusterHealthSummary', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('vmCreateTimeout', 'int', 'vim.version.version9', 0 | F_OPTIONAL, None), ('objUuids', 'string[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ('includeObjUuids', 'boolean', 'vim.version.version9', 0 | F_OPTIONAL, None), ('fields', 'string[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ('fetchFromCache', 'boolean', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.cluster.VsanClusterHealthSummary', 'vim.cluster.VsanClusterHealthSummary'), 'System.Read', None), ('stopRebalanceCluster', 'VsanStopRebalanceCluster', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('targetHosts', 'vim.HostSystem[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ('queryVsanClusterHealthConfig', 'VsanHealthQueryVsanClusterHealthConfig', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterHealthConfigs', 'vim.cluster.VsanClusterHealthConfigs'), 'System.Read', None), ('attachVsanSupportBundleToSr', 'VsanAttachVsanSupportBundleToSr', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('srNumber', 'string', 'vim.version.version9', 0, None), ), (0, 'vim.Task', 'vim.Task'), 'System.Read', None), ('queryClusterVmdkWorkloadTypes', 'VsanQueryVcClusterVmdkWorkloadTypes', 'vim.version.version9', tuple(), (0, 'vim.cluster.VsanStorageWorkloadType[]', 'vim.cluster.VsanStorageWorkloadType[]'), 'System.Read', None), ('queryVerifyClusterHealthSystemVersions', 'VsanVcClusterQueryVerifyHealthSystemVersions', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ), (0, 'vim.cluster.VsanClusterHealthSystemVersionResult', 'vim.cluster.VsanClusterHealthSystemVersionResult'), 'System.Read', None), ('isRebalanceRunning', 'VsanHealthIsRebalanceRunning', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('targetHosts', 'vim.HostSystem[]', 'vim.version.version9', 0 | F_OPTIONAL, None), ), (0, 'boolean', 'boolean'), 'System.Read', None), ('setVsanClusterHealthCheckInterval', 'VsanHealthSetVsanClusterHealthCheckInterval', 'vim.version.version9', (('cluster', 'vim.ClusterComputeResource', 'vim.version.version9', 0, None), ('vsanClusterHealthCheckInterval', 'int', 'vim.version.version9', 0, None), ), (0, 'void', 'void'), 'System.Read', None), ])
Severity: Major
Found in salt/ext/vsan/vsanmgmtObjects.py and 1 other location - About 4 hrs to fix
salt/ext/vsan/vsanmgmtObjects.py on lines 8..8

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

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 self.opts['ext_job_cache']:
            try:
                fstr = '{0}.save_load'.format(self.opts['ext_job_cache'])
                self.mminion.returners[fstr](load['jid'], load)
            except KeyError:
Severity: Major
Found in salt/daemons/masterapi.py and 1 other location - About 4 hrs to fix
salt/daemons/masterapi.py on lines 1361..1371

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

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 __salt__['lvm.vgdisplay'](name, quiet=True):
            ret['comment'] = 'Removed Volume Group {0}'.format(name)
            ret['changes']['removed'] = changes
        else:
            ret['comment'] = 'Failed to remove Volume Group {0}'.format(name)
Severity: Major
Found in salt/states/lvm.py and 1 other location - About 4 hrs to fix
salt/states/lvm.py on lines 323..328

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

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

Severity
Category
Status
Source
Language