saltstack/salt

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

Summary

Maintainability
F
3 mos
Test Coverage

File opennebula.py has 3516 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
OpenNebula Cloud Module
=======================

Severity: Major
Found in salt/cloud/clouds/opennebula.py - About 1 wk to fix

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

    def create(vm_):
        r'''
        Create a single VM from a data dict.
    
        vm\_
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 create. (24)
    Open

    def create(vm_):
        r'''
        Create a single VM from a data dict.
    
        vm\_
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 template_update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def template_update(call=None, kwargs=None):
        '''
        Replaces the template contents.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 image_update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def image_update(call=None, kwargs=None):
        '''
        Replaces the image template contents.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 secgroup_update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def secgroup_update(call=None, kwargs=None):
        '''
        Replaces the security group template contents.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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_device_template has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_device_template(disk, disk_info, template=None):
        '''
        Returns the template format to create a disk in open nebula
    
        .. versionadded:: 2018.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 image_allocate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def image_allocate(call=None, kwargs=None):
        '''
        Allocates a new image in OpenNebula.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 vn_add_ar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def vn_add_ar(call=None, kwargs=None):
        '''
        Adds address ranges to a given virtual network.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 vm_deploy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def vm_deploy(name, kwargs=None, call=None):
        '''
        Initiates the instance of the given VM on the target host.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 vn_hold has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def vn_hold(call=None, kwargs=None):
        '''
        Holds a virtual network lease as used.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 vn_allocate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def vn_allocate(call=None, kwargs=None):
        '''
        Allocates a new virtual network in OpenNebula.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 vn_reserve has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def vn_reserve(call=None, kwargs=None):
        '''
        Reserve network addresses.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 vm_migrate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def vm_migrate(name, kwargs=None, call=None):
        '''
        Migrates the specified virtual machine to the specified target host.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 vn_release has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def vn_release(call=None, kwargs=None):
        '''
        Releases a virtual network lease that was previously on hold.
    
        .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.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 has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def create(vm_):
        r'''
        Create a single VM from a data dict.
    
        vm\_
    Severity: Minor
    Found in salt/cloud/clouds/opennebula.py - About 1 hr to fix

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

      def vm_update(name, kwargs=None, call=None):
          '''
          Replaces the user template contents.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      def _list_nodes(full=False):
          '''
          Helper function for the list_* query functions - Constructs the
          appropriate dictionaries to return from the API query.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 vn_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def vn_info(call=None, kwargs=None):
          '''
          Retrieves information for the virtual network.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 image_clone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def image_clone(call=None, kwargs=None):
          '''
          Clones an existing image.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 image_snapshot_delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def image_snapshot_delete(call=None, kwargs=None):
          '''
          Deletes a snapshot from the image.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 image_persistent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def image_persistent(call=None, kwargs=None):
          '''
          Sets the Image as persistent or not persistent.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 image_snapshot_flatten has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def image_snapshot_flatten(call=None, kwargs=None):
          '''
          Flattens the snapshot of an image and discards others.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 secgroup_clone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def secgroup_clone(call=None, kwargs=None):
          '''
          Clones an existing security group.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 template_clone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def template_clone(call=None, kwargs=None):
          '''
          Clones an existing virtual machine template.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 image_snapshot_revert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def image_snapshot_revert(call=None, kwargs=None):
          '''
          Reverts an image state to a previous snapshot.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 template_instantiate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def template_instantiate(call=None, kwargs=None):
          '''
          Instantiates a new virtual machine from a template.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 vn_free_ar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def vn_free_ar(call=None, kwargs=None):
          '''
          Frees a reserved address range from a virtual network.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 vm_attach_nic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def vm_attach_nic(name, kwargs=None, call=None):
          '''
          Attaches a new network interface to the given virtual machine.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 secgroup_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def secgroup_info(call=None, kwargs=None):
          '''
          Retrieves information for the given security group. Either a name or a
          secgroup_id must be supplied.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 template_delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def template_delete(call=None, kwargs=None):
          '''
          Deletes the given template from OpenNebula. Either a name or a template_id must
          be supplied.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 secgroup_delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def secgroup_delete(call=None, kwargs=None):
          '''
          Deletes the given security group from OpenNebula. Either a name or a secgroup_id
          must be supplied.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 _xml_to_dict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _xml_to_dict(xml):
          '''
          Helper function to covert xml into a data dictionary.
      
          xml
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 vm_resize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def vm_resize(name, kwargs=None, call=None):
          '''
          Changes the capacity of the virtual machine.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 vm_attach has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def vm_attach(name, kwargs=None, call=None):
          '''
          Attaches a new disk to the given virtual machine.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 image_delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def image_delete(call=None, kwargs=None):
          '''
          Deletes the given image from OpenNebula. Either a name or an image_id must
          be supplied.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 secgroup_allocate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def secgroup_allocate(call=None, kwargs=None):
          '''
          Allocates a new security group in OpenNebula.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 template_allocate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def template_allocate(call=None, kwargs=None):
          '''
          Allocates a new template in OpenNebula.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 image_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def image_info(call=None, kwargs=None):
          '''
          Retrieves information for a given image. Either a name or an image_id must be
          supplied.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 vm_allocate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def vm_allocate(call=None, kwargs=None):
          '''
          Allocates a new virtual machine in OpenNebula.
      
          .. versionadded:: 2016.3.0
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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 vn_delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def vn_delete(call=None, kwargs=None):
          '''
          Deletes the given virtual network from OpenNebula. Either a name or a vn_id must
          be supplied.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.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

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

      def image_update(call=None, kwargs=None):
          '''
          Replaces the image template contents.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 3 days to fix
      salt/cloud/clouds/opennebula.py on lines 2178..2287
      salt/cloud/clouds/opennebula.py on lines 2563..2672

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

      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 secgroup_update(call=None, kwargs=None):
          '''
          Replaces the security group template contents.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 3 days to fix
      salt/cloud/clouds/opennebula.py on lines 1789..1894
      salt/cloud/clouds/opennebula.py on lines 2563..2672

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

      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 template_update(call=None, kwargs=None):
          '''
          Replaces the template contents.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 3 days to fix
      salt/cloud/clouds/opennebula.py on lines 1789..1894
      salt/cloud/clouds/opennebula.py on lines 2178..2287

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vn_add_ar(call=None, kwargs=None):
          '''
          Adds address ranges to a given virtual network.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 4156..4239
      salt/cloud/clouds/opennebula.py on lines 4301..4384
      salt/cloud/clouds/opennebula.py on lines 4387..4470

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vn_hold(call=None, kwargs=None):
          '''
          Holds a virtual network lease as used.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 3857..3941
      salt/cloud/clouds/opennebula.py on lines 4301..4384
      salt/cloud/clouds/opennebula.py on lines 4387..4470

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vn_release(call=None, kwargs=None):
          '''
          Releases a virtual network lease that was previously on hold.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 3857..3941
      salt/cloud/clouds/opennebula.py on lines 4156..4239
      salt/cloud/clouds/opennebula.py on lines 4387..4470

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vn_reserve(call=None, kwargs=None):
          '''
          Reserve network addresses.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 3857..3941
      salt/cloud/clouds/opennebula.py on lines 4156..4239
      salt/cloud/clouds/opennebula.py on lines 4301..4384

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

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

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

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

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

      Refactorings

      Further Reading

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

      def image_snapshot_revert(call=None, kwargs=None):
          '''
          Reverts an image state to a previous snapshot.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 1585..1651
      salt/cloud/clouds/opennebula.py on lines 1721..1786
      salt/cloud/clouds/opennebula.py on lines 4087..4153

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

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

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

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

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

      Refactorings

      Further Reading

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

      def image_snapshot_delete(call=None, kwargs=None):
          '''
          Deletes a snapshot from the image.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 1654..1718
      salt/cloud/clouds/opennebula.py on lines 1721..1786
      salt/cloud/clouds/opennebula.py on lines 4087..4153

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

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

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

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

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

      Refactorings

      Further Reading

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

      def image_snapshot_flatten(call=None, kwargs=None):
          '''
          Flattens the snapshot of an image and discards others.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 1585..1651
      salt/cloud/clouds/opennebula.py on lines 1654..1718
      salt/cloud/clouds/opennebula.py on lines 4087..4153

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vn_free_ar(call=None, kwargs=None):
          '''
          Frees a reserved address range from a virtual network.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 1585..1651
      salt/cloud/clouds/opennebula.py on lines 1654..1718
      salt/cloud/clouds/opennebula.py on lines 1721..1786

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

      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 template_instantiate(call=None, kwargs=None):
          '''
          Instantiates a new virtual machine from a template.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 1331..1396
      salt/cloud/clouds/opennebula.py on lines 1990..2057

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

      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 secgroup_clone(call=None, kwargs=None):
          '''
          Clones an existing security group.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 1331..1396
      salt/cloud/clouds/opennebula.py on lines 2488..2560

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

      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 image_clone(call=None, kwargs=None):
          '''
          Clones an existing image.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 1990..2057
      salt/cloud/clouds/opennebula.py on lines 2488..2560

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_attach(name, kwargs=None, call=None):
          '''
          Attaches a new disk to the given virtual machine.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 2875..2939

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_attach_nic(name, kwargs=None, call=None):
          '''
          Attaches a new network interface to the given virtual machine.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 2 days to fix
      salt/cloud/clouds/opennebula.py on lines 2808..2872

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

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

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

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

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

      Refactorings

      Further Reading

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

      def image_info(call=None, kwargs=None):
          '''
          Retrieves information for a given image. Either a name or an image_id must be
          supplied.
      
      
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 2120..2175

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

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

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

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

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

      Refactorings

      Further Reading

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

      def secgroup_allocate(call=None, kwargs=None):
          '''
          Allocates a new security group in OpenNebula.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 2290..2353

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

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

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

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

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

      Refactorings

      Further Reading

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

      def template_allocate(call=None, kwargs=None):
          '''
          Allocates a new template in OpenNebula.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 1926..1987

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

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

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

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

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

      Refactorings

      Further Reading

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

      def secgroup_info(call=None, kwargs=None):
          '''
          Retrieves information for the given security group. Either a name or a
          secgroup_id must be supplied.
      
      
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 1458..1513

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_disk_snapshot_delete(name, kwargs=None, call=None):
          '''
          Deletes a disk snapshot based on the given VM and the disk_id.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 3317..3370

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_disk_snapshot_revert(name, kwargs=None, call=None):
          '''
          Reverts a disk state to a previously taken snapshot.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 3261..3314

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

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

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

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

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

      Refactorings

      Further Reading

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

      def template_delete(call=None, kwargs=None):
          '''
          Deletes the given template from OpenNebula. Either a name or a template_id must
          be supplied.
      
      
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 1399..1455
      salt/cloud/clouds/opennebula.py on lines 2060..2117
      salt/cloud/clouds/opennebula.py on lines 4028..4084

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

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

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

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

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

      Refactorings

      Further Reading

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

      def secgroup_delete(call=None, kwargs=None):
          '''
          Deletes the given security group from OpenNebula. Either a name or a secgroup_id
          must be supplied.
      
      
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 1399..1455
      salt/cloud/clouds/opennebula.py on lines 2429..2485
      salt/cloud/clouds/opennebula.py on lines 4028..4084

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

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

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

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

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

      Refactorings

      Further Reading

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

      def image_delete(call=None, kwargs=None):
          '''
          Deletes the given image from OpenNebula. Either a name or an image_id must
          be supplied.
      
      
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 2060..2117
      salt/cloud/clouds/opennebula.py on lines 2429..2485
      salt/cloud/clouds/opennebula.py on lines 4028..4084

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vn_delete(call=None, kwargs=None):
          '''
          Deletes the given virtual network from OpenNebula. Either a name or a vn_id must
          be supplied.
      
      
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 1399..1455
      salt/cloud/clouds/opennebula.py on lines 2060..2117
      salt/cloud/clouds/opennebula.py on lines 2429..2485

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_snapshot_delete(vm_name, kwargs=None, call=None):
          '''
          Deletes a virtual machine snapshot from the provided VM.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 3041..3085
      salt/cloud/clouds/opennebula.py on lines 3088..3132
      salt/cloud/clouds/opennebula.py on lines 3723..3767

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_detach_nic(name, kwargs=None, call=None):
          '''
          Detaches a disk from a virtual machine.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 3041..3085
      salt/cloud/clouds/opennebula.py on lines 3676..3720
      salt/cloud/clouds/opennebula.py on lines 3723..3767

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_snapshot_revert(vm_name, kwargs=None, call=None):
          '''
          Reverts a virtual machine to a snapshot
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 3041..3085
      salt/cloud/clouds/opennebula.py on lines 3088..3132
      salt/cloud/clouds/opennebula.py on lines 3676..3720

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

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

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

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

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

      Refactorings

      Further Reading

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

      def vm_detach(name, kwargs=None, call=None):
          '''
          Detaches a disk from a virtual machine.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 1 day to fix
      salt/cloud/clouds/opennebula.py on lines 3088..3132
      salt/cloud/clouds/opennebula.py on lines 3676..3720
      salt/cloud/clouds/opennebula.py on lines 3723..3767

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

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

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

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

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

      Refactorings

      Further Reading

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

      def list_vns(call=None):
          '''
          Lists all virtual networks available to the user and the user's groups.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 7 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 132..160
      salt/cloud/clouds/opennebula.py on lines 346..371
      salt/cloud/clouds/opennebula.py on lines 374..399

      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

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

      def list_security_groups(call=None):
          '''
          Lists all security groups available to the user and the user's groups.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 7 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 132..160
      salt/cloud/clouds/opennebula.py on lines 374..399
      salt/cloud/clouds/opennebula.py on lines 402..427

      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

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

      def avail_images(call=None):
          '''
          Return available OpenNebula images.
      
          CLI Example:
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 7 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 346..371
      salt/cloud/clouds/opennebula.py on lines 374..399
      salt/cloud/clouds/opennebula.py on lines 402..427

      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

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

      def list_templates(call=None):
          '''
          Lists all templates available to the user and the user's groups.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 3 other locations - About 7 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 132..160
      salt/cloud/clouds/opennebula.py on lines 346..371
      salt/cloud/clouds/opennebula.py on lines 402..427

      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

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

      def get_vm_id(kwargs=None, call=None):
          '''
          Returns a virtual machine's ID from the given virtual machine's name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 532..565
      salt/cloud/clouds/opennebula.py on lines 568..601
      salt/cloud/clouds/opennebula.py on lines 604..637
      salt/cloud/clouds/opennebula.py on lines 659..692
      salt/cloud/clouds/opennebula.py on lines 721..754
      salt/cloud/clouds/opennebula.py on lines 791..824
      salt/cloud/clouds/opennebula.py on lines 884..917

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

      def get_secgroup_id(kwargs=None, call=None):
          '''
          Returns a security group's ID from the given security group name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 532..565
      salt/cloud/clouds/opennebula.py on lines 568..601
      salt/cloud/clouds/opennebula.py on lines 604..637
      salt/cloud/clouds/opennebula.py on lines 659..692
      salt/cloud/clouds/opennebula.py on lines 791..824
      salt/cloud/clouds/opennebula.py on lines 848..881
      salt/cloud/clouds/opennebula.py on lines 884..917

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

      def get_vn_id(kwargs=None, call=None):
          '''
          Returns a virtual network's ID from the given virtual network's name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 532..565
      salt/cloud/clouds/opennebula.py on lines 568..601
      salt/cloud/clouds/opennebula.py on lines 604..637
      salt/cloud/clouds/opennebula.py on lines 659..692
      salt/cloud/clouds/opennebula.py on lines 721..754
      salt/cloud/clouds/opennebula.py on lines 791..824
      salt/cloud/clouds/opennebula.py on lines 848..881

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

      def get_template_id(kwargs=None, call=None):
          '''
          Returns a template's ID from the given template name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 532..565
      salt/cloud/clouds/opennebula.py on lines 568..601
      salt/cloud/clouds/opennebula.py on lines 604..637
      salt/cloud/clouds/opennebula.py on lines 659..692
      salt/cloud/clouds/opennebula.py on lines 721..754
      salt/cloud/clouds/opennebula.py on lines 848..881
      salt/cloud/clouds/opennebula.py on lines 884..917

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

      def get_image_id(kwargs=None, call=None):
          '''
          Returns an image's ID from the given image name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 532..565
      salt/cloud/clouds/opennebula.py on lines 568..601
      salt/cloud/clouds/opennebula.py on lines 604..637
      salt/cloud/clouds/opennebula.py on lines 721..754
      salt/cloud/clouds/opennebula.py on lines 791..824
      salt/cloud/clouds/opennebula.py on lines 848..881
      salt/cloud/clouds/opennebula.py on lines 884..917

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

      def get_cluster_id(kwargs=None, call=None):
          '''
          Returns a cluster's ID from the given cluster name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 568..601
      salt/cloud/clouds/opennebula.py on lines 604..637
      salt/cloud/clouds/opennebula.py on lines 659..692
      salt/cloud/clouds/opennebula.py on lines 721..754
      salt/cloud/clouds/opennebula.py on lines 791..824
      salt/cloud/clouds/opennebula.py on lines 848..881
      salt/cloud/clouds/opennebula.py on lines 884..917

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

      def get_datastore_id(kwargs=None, call=None):
          '''
          Returns a data store's ID from the given data store name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 532..565
      salt/cloud/clouds/opennebula.py on lines 604..637
      salt/cloud/clouds/opennebula.py on lines 659..692
      salt/cloud/clouds/opennebula.py on lines 721..754
      salt/cloud/clouds/opennebula.py on lines 791..824
      salt/cloud/clouds/opennebula.py on lines 848..881
      salt/cloud/clouds/opennebula.py on lines 884..917

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

      def get_host_id(kwargs=None, call=None):
          '''
          Returns a host's ID from the given host name.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 532..565
      salt/cloud/clouds/opennebula.py on lines 568..601
      salt/cloud/clouds/opennebula.py on lines 659..692
      salt/cloud/clouds/opennebula.py on lines 721..754
      salt/cloud/clouds/opennebula.py on lines 791..824
      salt/cloud/clouds/opennebula.py on lines 848..881
      salt/cloud/clouds/opennebula.py on lines 884..917

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

      def avail_locations(call=None):
          '''
          Return available OpenNebula locations.
      
          CLI Example:
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 212..237
      salt/cloud/clouds/opennebula.py on lines 240..265

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

      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_datastores(call=None):
          '''
          Returns a list of data stores on OpenNebula.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 163..190
      salt/cloud/clouds/opennebula.py on lines 212..237

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

      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_clusters(call=None):
          '''
          Returns a list of clusters in OpenNebula.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 6 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 163..190
      salt/cloud/clouds/opennebula.py on lines 240..265

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

      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 get_image(vm_):
          r'''
          Return the image object to use.
      
          vm\_
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 6 hrs to fix
      salt/cloud/clouds/digitalocean.py on lines 245..259
      salt/cloud/clouds/scaleway.py on lines 156..167

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

      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 response[0] is False:
              return response[1]
          else:
              info = {}
              tree = _get_xml(response[1])
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 3 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 3398..3404

      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 response[0] is False:
              return response[1]
          else:
              info = {}
              tree = _get_xml(response[1])
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 3 hrs to fix
      salt/cloud/clouds/opennebula.py on lines 4292..4298

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

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

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 66.

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

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

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

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

      Refactorings

      Further Reading

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

          __utils__['cloud.fire_event'](
              'event',
              'created instance',
              'salt/cloud/{0}/created'.format(vm_['name']),
              args=__utils__['cloud.filter_event']('created', vm_, ['name', 'profile', 'provider', 'driver']),
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 2 hrs to fix
      salt/cloud/clouds/proxmox.py on lines 858..864

      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

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

          while attempts >= 0:
              try:
                  return list_nodes_full()[name]
              except KeyError:
                  attempts -= 1
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 2 hrs to fix
      salt/cloud/clouds/aliyun.py on lines 934..944

      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

          __utils__['cloud.fire_event'](
              'event',
              'requesting instance',
              'salt/cloud/{0}/requesting'.format(vm_['name']),
              args={
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 2 hrs to fix
      salt/cloud/clouds/proxmox.py on lines 1009..1016

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 60.

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

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

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

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

      Refactorings

      Further Reading

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

      def reboot(name, call=None):
          '''
          Reboot a VM.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 1 hr to fix
      salt/cloud/clouds/opennebula.py on lines 455..477
      salt/cloud/clouds/opennebula.py on lines 480..502

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

      def stop(name, call=None):
          '''
          Stop a VM.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 1 hr to fix
      salt/cloud/clouds/opennebula.py on lines 430..452
      salt/cloud/clouds/opennebula.py on lines 455..477

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

      def start(name, call=None):
          '''
          Start a VM.
      
          .. versionadded:: 2016.3.0
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 1 hr to fix
      salt/cloud/clouds/opennebula.py on lines 430..452
      salt/cloud/clouds/opennebula.py on lines 480..502

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

      def show_instance(name, call=None):
          '''
          Show the details from OpenNebula concerning a named VM.
      
          name
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 2 other locations - About 1 hr to fix
      salt/cloud/clouds/digitalocean.py on lines 622..632
      salt/cloud/clouds/scaleway.py on lines 392..401

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 56.

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

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

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

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

      Refactorings

      Further Reading

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

          try:
              # Check for required profile parameters before sending any API calls.
              if vm_['profile'] and config.is_profile_configured(__opts__,
                                                                 __active_provider_name__ or 'opennebula',
                                                                 vm_['profile']) is False:
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 5 other locations - About 1 hr to fix
      salt/cloud/clouds/dimensiondata.py on lines 197..204
      salt/cloud/clouds/libvirt.py on lines 297..303
      salt/cloud/clouds/oneandone.py on lines 745..753
      salt/cloud/clouds/profitbricks.py on lines 821..829
      salt/cloud/clouds/virtualbox.py on lines 144..152

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 51.

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

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

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

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

      Refactorings

      Further Reading

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

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

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 44.

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

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

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

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

      Refactorings

      Further Reading

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

          if cluster_id:
              if cluster_name:
                  log.warning(
                      'Both the \'cluster_id\' and \'cluster_name\' arguments were provided. '
                      '\'cluster_id\' will take precedence.'
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 45 mins to fix
      salt/cloud/clouds/opennebula.py on lines 3011..3020

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 43.

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

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

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

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

      Refactorings

      Further Reading

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

          if datastore_id:
              if datastore_name:
                  log.warning(
                      'Both the \'datastore_id\' and \'datastore_name\' arguments were provided. '
                      '\'datastore_id\' will take precedence.'
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 45 mins to fix
      salt/cloud/clouds/opennebula.py on lines 4003..4012

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 43.

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

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

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

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

      Refactorings

      Further Reading

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

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

      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 key_filename is not None and not os.path.isfile(key_filename):
              raise SaltCloudConfigError(
                  'The defined key_filename \'{0}\' does not exist'.format(
      Severity: Major
      Found in salt/cloud/clouds/opennebula.py and 7 other locations - About 30 mins to fix
      salt/cloud/clouds/digitalocean.py on lines 327..329
      salt/cloud/clouds/libvirt.py on lines 321..323
      salt/cloud/clouds/nova.py on lines 952..954
      salt/cloud/clouds/openstack.py on lines 675..677
      salt/cloud/clouds/scaleway.py on lines 223..225
      salt/utils/cloud.py on lines 414..416
      salt/utils/cloud.py on lines 1463..1465

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 40.

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

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

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

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

      Refactorings

      Further Reading

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

      def avail_sizes(call=None):
          '''
          Because sizes are built into templates with OpenNebula, there will be no sizes to
          return here.
          '''
      Severity: Minor
      Found in salt/cloud/clouds/opennebula.py and 1 other location - About 30 mins to fix
      salt/cloud/clouds/vmware.py on lines 2072..2099

      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