saltstack/salt

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

Summary

Maintainability
F
1 mo
Test Coverage

File ec2.py has 4114 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The EC2 Cloud Module
====================

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

    Function request_instance has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

    def request_instance(vm_=None, call=None):
        '''
        Put together all of the information necessary to request an instance on EC2,
        and then fire off the request the instance.
    
    
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 2 days to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def create(vm_=None, call=None):
        '''
        Create a single VM from a data dict
        '''
        if call:
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function wait_for_instance has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

    def wait_for_instance(
            vm_=None,
            data=None,
            ip_address=None,
            display_ssh_output=True,
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in function request_instance. (58)
    Open

    def request_instance(vm_=None, call=None):
        '''
        Put together all of the information necessary to request an instance on EC2,
        and then fire off the request the instance.
    
    
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py by radon

    Cyclomatic Complexity

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

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

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

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

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

    def create(vm_=None, call=None):
        '''
        Create a single VM from a data dict
        '''
        if call:
    Severity: Minor
    Found in salt/cloud/clouds/ec2.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 query has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def query(params=None, setname=None, requesturl=None, location=None,
              return_url=False, return_root=False):
    
        provider = get_configured_provider()
        service_url = provider.get('service_url', 'amazonaws.com')
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function set_tags has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_tags(name=None,
                 tags=None,
                 call=None,
                 location=None,
                 instance_id=None,
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function _create_eni_if_necessary has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def _create_eni_if_necessary(interface, vm_):
        '''
        Create an Elastic Interface if necessary and return a Network Interface Specification
        '''
        if 'NetworkInterfaceId' in interface and interface['NetworkInterfaceId'] is not None:
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function create_attach_volumes has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_attach_volumes(name, kwargs, call=None, wait_to_finish=True):
        '''
        Create and attach volumes to created node
        '''
        if call != 'action':
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def query_instance(vm_=None, call=None):
        '''
        Query an instance upon creation from the EC2 API
        '''
        if call == 'function':
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def show_pricing(kwargs=None, call=None):
        '''
        Show pricing for a particular profile. This is only an estimate, based on
        unofficial pricing sources.
    
    
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function get_password_data has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_password_data(
            name=None,
            kwargs=None,
            instance_id=None,
            call=None,
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function create_volume has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_volume(kwargs=None, call=None, wait_to_finish=False):
        '''
        Create a volume.
    
        zone
    Severity: Minor
    Found in salt/cloud/clouds/ec2.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_subnet_id_for_interface has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_subnet_id_for_interface(subnet_query, interface):
        for subnet_query_result in subnet_query:
            if 'item' in subnet_query_result:
                if isinstance(subnet_query_result['item'], dict):
                    subnet_id = _get_subnet_from_subnet_query(subnet_query_result['item'],
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in function wait_for_instance. (26)
    Open

    def wait_for_instance(
            vm_=None,
            data=None,
            ip_address=None,
            display_ssh_output=True,
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py by radon

    Cyclomatic Complexity

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

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

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

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

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

    def _create_eni_if_necessary(interface, vm_):
        '''
        Create an Elastic Interface if necessary and return a Network Interface Specification
        '''
        if 'NetworkInterfaceId' in interface and interface['NetworkInterfaceId'] is not None:
    Severity: Minor
    Found in salt/cloud/clouds/ec2.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 _xml_to_dict has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _xml_to_dict(xmltree):
        '''
        Convert an XML tree into a dict
        '''
        children_len = len(xmltree)
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _wait_for_spot_instance(update_callback,
                                update_args=None,
                                update_kwargs=None,
                                timeout=10 * 60,
                                interval=30,
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _update_enis(interfaces, instance, vm_=None):
        config_enis = {}
        instance_enis = []
        for interface in interfaces:
            if 'DeviceIndex' in interface:
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def create(vm_=None, call=None):
        '''
        Create a single VM from a data dict
        '''
        if call:
    Severity: Minor
    Found in salt/cloud/clouds/ec2.py - About 2 hrs to fix

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

      def register_image(kwargs=None, call=None):
          '''
          Create an ami from a snapshot
      
          CLI Example:
      Severity: Minor
      Found in salt/cloud/clouds/ec2.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 request_instance has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def request_instance(vm_=None, call=None):
          '''
          Put together all of the information necessary to request an instance on EC2,
          and then fire off the request the instance.
      
      
      Severity: Minor
      Found in salt/cloud/clouds/ec2.py - About 1 hr to fix

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

        def create_volume(kwargs=None, call=None, wait_to_finish=False):
            '''
            Create a volume.
        
            zone
        Severity: Minor
        Found in salt/cloud/clouds/ec2.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 optimize_providers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def optimize_providers(providers):
            '''
            Return an optimized list of providers.
        
            We want to reduce the duplication of querying
        Severity: Minor
        Found in salt/cloud/clouds/ec2.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 _param_from_config has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def _param_from_config(key, data):
            '''
            Return EC2 API parameters based on the given config data.
        
            Examples:
        Severity: Minor
        Found in salt/cloud/clouds/ec2.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 _extract_name_tag has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def _extract_name_tag(item):
            if 'tagSet' in item and item['tagSet'] is not None:
                tagset = item['tagSet']
                if isinstance(tagset['item'], list):
                    for tag in tagset['item']:
        Severity: Minor
        Found in salt/cloud/clouds/ec2.py - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        def get_console_output(
                name=None,
                location=None,
                instance_id=None,
                call=None,
        Severity: Minor
        Found in salt/cloud/clouds/ec2.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 describe_snapshots has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def describe_snapshots(kwargs=None, call=None):
            '''
            Describe a snapshot (or snapshots)
        
            snapshot_id
        Severity: Minor
        Found in salt/cloud/clouds/ec2.py - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        def get_tags(name=None,
                     instance_id=None,
                     call=None,
                     location=None,
                     kwargs=None,
        Severity: Minor
        Found in salt/cloud/clouds/ec2.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 show_pricing has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def show_pricing(kwargs=None, call=None):
            '''
            Show pricing for a particular profile. This is only an estimate, based on
            unofficial pricing sources.
        
        
        Severity: Minor
        Found in salt/cloud/clouds/ec2.py - About 1 hr to fix

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

          def _get_subnetname_id(subnetname):
              '''
              Returns the SubnetId of a SubnetName to use
              '''
              params = {'Action': 'DescribeSubnets'}
          Severity: Minor
          Found in salt/cloud/clouds/ec2.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 _toggle_delvol has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _toggle_delvol(name=None, instance_id=None, device=None, volume_id=None,
                             value=None, requesturl=None):
          
              if not instance_id:
                  instance_id = _get_node(name)['instanceId']
          Severity: Minor
          Found in salt/cloud/clouds/ec2.py - About 55 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

          def create_snapshot(kwargs=None, call=None, wait_to_finish=False):
              '''
              Create a snapshot.
          
              volume_id
          Severity: Minor
          Found in salt/cloud/clouds/ec2.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 show_delvol_on_destroy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def show_delvol_on_destroy(name, kwargs=None, call=None):
              '''
              Do not delete all/specified EBS volumes upon instance termination
          
              CLI Example:
          Severity: Minor
          Found in salt/cloud/clouds/ec2.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 securitygroupid has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def securitygroupid(vm_):
              '''
              Returns the SecurityGroupId
              '''
              securitygroupid_set = set()
          Severity: Minor
          Found in salt/cloud/clouds/ec2.py - About 55 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Avoid deeply nested control flow statements.
          Open

                              if subnet_id is not None:
                                  return subnet_id
          
          
          Severity: Major
          Found in salt/cloud/clouds/ec2.py - About 45 mins to fix

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

            def list_nodes_min(location=None, call=None):
                '''
                Return a list of the VMs that are on the provider. Only a list of VM names,
                and their state, is returned. This is the minimum amount of information
                needed to check for existing VMs.
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 show_term_protect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def show_term_protect(name=None, instance_id=None, call=None, quiet=False):
                '''
                Show the details from EC2 concerning an instance's termination protection state
            
                '''
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 _get_node has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def _get_node(name=None, instance_id=None, location=None):
                if location is None:
                    location = get_location()
            
                params = {'Action': 'DescribeInstances'}
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 _parse_pricing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def _parse_pricing(url, name):
                '''
                Download and parse an individual pricing file from AWS
            
                .. versionadded:: 2015.8.0
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 del_tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def del_tags(name=None,
                         kwargs=None,
                         call=None,
                         instance_id=None,
                         resource_id=None):  # pylint: disable=W0613
            Severity: Minor
            Found in salt/cloud/clouds/ec2.py - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            def _list_interface_private_addrs(eni_desc):
                '''
                Returns a list of all of the private IP addresses attached to a
                network interface. The 'primary' address will be listed first.
                '''
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 copy_snapshot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def copy_snapshot(kwargs=None, call=None):
                '''
                Copy a snapshot
                '''
                if call != 'function':
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 attach_volume has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def attach_volume(name=None, kwargs=None, instance_id=None, call=None):
                '''
                Attach a volume to an instance
                '''
                if call != 'action':
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 _extract_instance_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _extract_instance_info(instances):
                '''
                Given an instance query, return a dict of all instance data
                '''
                ret = {}
            Severity: Minor
            Found in salt/cloud/clouds/ec2.py - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

            def _get_subnet_from_subnet_query(subnet_query, interface):
                if 'subnetId' in subnet_query:
                    if interface.get('SubnetId'):
                        if subnet_query['subnetId'] == interface['SubnetId']:
                            return subnet_query['subnetId']
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 show_detailed_monitoring has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def show_detailed_monitoring(name=None, instance_id=None, call=None, quiet=False):
                '''
                Show the details from EC2 regarding cloudwatch detailed monitoring.
                '''
                if call != 'action':
            Severity: Minor
            Found in salt/cloud/clouds/ec2.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 ssm_create_association has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def ssm_create_association(name=None, kwargs=None, instance_id=None, call=None):
                '''
                Associates the specified SSM document with the specified instance
            
                http://docs.aws.amazon.com/ssm/latest/APIReference/API_CreateAssociation.html
            Severity: Minor
            Found in salt/cloud/clouds/ec2.py - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            Avoid too many return statements within this function.
            Open

                        return {'error': data}, requesturl
            Severity: Major
            Found in salt/cloud/clouds/ec2.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

                        return ret, requesturl
                Severity: Major
                Found in salt/cloud/clouds/ec2.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return {'error': data}
                  Severity: Major
                  Found in salt/cloud/clouds/ec2.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return {profile['profile']: ret}
                    Severity: Major
                    Found in salt/cloud/clouds/ec2.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

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

                          def import_keypair(kwargs=None, call=None):
                              '''
                              Import an SSH public key.
                          
                              .. versionadded:: 2015.8.3
                          Severity: Minor
                          Found in salt/cloud/clouds/ec2.py - About 25 mins to fix

                          Cognitive Complexity

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

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

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

                          Further reading

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

                          def ssm_describe_association(name=None, kwargs=None, instance_id=None, call=None):
                              '''
                              Describes the associations for the specified SSM document or instance.
                          
                              http://docs.aws.amazon.com/ssm/latest/APIReference/API_DescribeAssociation.html
                          Severity: Minor
                          Found in salt/cloud/clouds/ec2.py - About 25 mins to fix

                          Cognitive Complexity

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

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

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

                          Further reading

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

                          def _wait_for_spot_instance(update_callback,
                                                      update_args=None,
                                                      update_kwargs=None,
                                                      timeout=10 * 60,
                                                      interval=30,
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 2 days to fix
                          salt/utils/cloud.py on lines 2489..2559

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

                          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 ssm_create_association(name=None, kwargs=None, instance_id=None, call=None):
                              '''
                              Associates the specified SSM document with the specified instance
                          
                              http://docs.aws.amazon.com/ssm/latest/APIReference/API_CreateAssociation.html
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 day to fix
                          salt/cloud/clouds/ec2.py on lines 5161..5208

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

                          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 ssm_describe_association(name=None, kwargs=None, instance_id=None, call=None):
                              '''
                              Describes the associations for the specified SSM document or instance.
                          
                              http://docs.aws.amazon.com/ssm/latest/APIReference/API_DescribeAssociation.html
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 day to fix
                          salt/cloud/clouds/ec2.py on lines 5110..5158

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

                          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 stop(name, call=None):
                              '''
                              Stop a node
                              '''
                              if call != 'action':
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 day to fix
                          salt/cloud/clouds/ec2.py on lines 3060..3090

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

                          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 start(name, call=None):
                              '''
                              Start a node
                              '''
                              if call != 'action':
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 day to fix
                          salt/cloud/clouds/ec2.py on lines 3027..3057

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

                          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 delete_keypair(kwargs=None, call=None):
                              '''
                              Delete an SSH keypair
                              '''
                              if call != 'function':
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 7 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 4529..4555

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 121.

                          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 show_keypair(kwargs=None, call=None):
                              '''
                              Show the details of an SSH keypair
                              '''
                              if call != 'function':
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 7 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 4558..4584

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

                          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 disable_detailed_monitoring(name, call=None):
                              '''
                              Enable/disable detailed monitoring on a node
                          
                              CLI Example:
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 5 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3866..3890

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

                          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 enable_detailed_monitoring(name, call=None):
                              '''
                              Enable/disable detailed monitoring on a node
                          
                              CLI Example:
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 5 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3840..3863

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                              for sg in aws.query(params, location=get_location(),
                                                  provider=get_provider(), opts=__opts__, sigver='4'):
                                  if sg['groupName'] in securitygroupname_list:
                                      log.debug(
                                          'AWS SecurityGroup ID of %s is %s',
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 4 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 1311..1318

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  for sg in aws.query(params, location=get_location(),
                                                      provider=get_provider(), opts=__opts__, sigver='4'):
                                      if sg['groupName'] in securitygroupname_list:
                                          log.debug(
                                              'AWS SecurityGroup ID of %s is %s',
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 4 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 1275..1282

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

                          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

                                      ret[name].update(
                                          dict(
                                              id=item['instanceId'],
                                              image=item['imageId'],
                                              size=item['instanceType'],
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 4 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3585..3592

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

                          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

                                          ret[name].update(
                                              dict(
                                                  id=item['instanceId'],
                                                  image=item['imageId'],
                                                  size=item['instanceType'],
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 4 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3600..3607

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

                          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 keepvol_on_destroy(name, kwargs=None, call=None):
                              '''
                              Do not delete all/specified EBS volumes upon instance termination
                          
                              CLI Example:
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 4 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3981..4002

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

                          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 delvol_on_destroy(name, kwargs=None, call=None):
                              '''
                              Delete all/specified EBS volumes upon instance termination
                          
                              CLI Example:
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 4 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3956..3977

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

                          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 'reactor' in vm_ and vm_['reactor'] is True:
                                  __utils__['cloud.fire_event'](
                                      'event',
                                      'instance queried',
                                      'salt/cloud/{0}/query_reactor'.format(vm_['name']),
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 3 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 2507..2514

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

                          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 'reactor' in vm_ and vm_['reactor'] is True:
                                  __utils__['cloud.fire_event'](
                                      'event',
                                      'ssh is available',
                                      'salt/cloud/{0}/ssh_ready_reactor'.format(vm_['name']),
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 3 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 2284..2291

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if 'instance_id' in vm_:
                                  # This was probably created via another process, and doesn't have
                                  # things like salt keys created yet, so let's create them now.
                                  if 'pub_key' not in vm_ and 'priv_key' not in vm_:
                                      log.debug('Generating minion keys for \'%s\'', vm_['name'])
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 2 other locations - About 3 hrs to fix
                          salt/cloud/clouds/lxc.py on lines 450..454
                          salt/cloud/clouds/nova.py on lines 974..980

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 77.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if ex_securitygroup:
                                  if not isinstance(ex_securitygroup, list):
                                      params[spot_prefix + 'SecurityGroup.1'] = ex_securitygroup
                                  else:
                                      for counter, sg_ in enumerate(ex_securitygroup):
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 3 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 1873..1879

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

                          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 ex_securitygroupid:
                                  if not isinstance(ex_securitygroupid, list):
                                      params[spot_prefix + 'SecurityGroupId.1'] = ex_securitygroupid
                                  else:
                                      for counter, sg_ in enumerate(ex_securitygroupid):
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 3 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 1832..1837

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

                          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/ec2.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/gce.py on lines 2461..2467
                          salt/cloud/clouds/gce.py on lines 2551..2557
                          salt/cloud/clouds/gce.py on lines 2635..2641
                          salt/cloud/clouds/gogrid.py on lines 96..102
                          salt/cloud/clouds/gogrid.py on lines 180..186
                          salt/cloud/clouds/joyent.py on lines 274..280
                          salt/cloud/clouds/joyent.py on lines 325..331
                          salt/cloud/clouds/lxc.py on lines 440..446
                          salt/cloud/clouds/lxc.py on lines 460..466
                          salt/cloud/clouds/lxc.py on lines 488..494
                          salt/cloud/clouds/msazure.py on lines 429..435
                          salt/cloud/clouds/msazure.py on lines 683..689
                          salt/cloud/clouds/nova.py on lines 961..967
                          salt/cloud/clouds/opennebula.py on lines 1006..1012
                          salt/cloud/clouds/openstack.py on lines 684..690
                          salt/cloud/clouds/packet.py on lines 347..353
                          salt/cloud/clouds/parallels.py on lines 287..293
                          salt/cloud/clouds/parallels.py on lines 356..362
                          salt/cloud/clouds/proxmox.py on lines 578..585
                          salt/cloud/clouds/qingcloud.py on lines 668..674
                          salt/cloud/clouds/qingcloud.py on lines 738..744
                          salt/cloud/clouds/scaleway.py on lines 200..206
                          salt/cloud/clouds/scaleway.py on lines 304..310
                          salt/cloud/clouds/virtualbox.py on lines 176..182
                          salt/cloud/clouds/vmware.py on lines 2543..2549
                          salt/cloud/clouds/vmware.py on lines 3072..3078
                          salt/cloud/clouds/vultrpy.py on lines 292..298
                          salt/cloud/clouds/vultrpy.py on lines 465..471

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 66.

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

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

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

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

                          Refactorings

                          Further Reading

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

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

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 65.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  for item in range(0, children_len):
                                      comps = root[item].tag.split('}')
                                      if comps[1] == setname:
                                          items = root[item]
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 2 hrs to fix
                          salt/utils/aws.py on lines 528..531

                          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

                              if six.text_type(name).startswith('i-') and (len(name) == 10 or len(name) == 19):
                                  instance_id = name
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 2 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3766..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 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

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

                              if six.text_type(name).startswith('i-') and (len(name) == 10 or len(name) == 19):
                                  instance_id = name
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 2 hrs to fix
                          salt/cloud/clouds/ec2.py on lines 3515..3516

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 51.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  data = salt.utils.cloud.wait_for_ip(
                                      __query_ip_address,
                                      update_args=(params, requesturl),
                                      timeout=config.get_cloud_config_value(
                                          'wait_for_ip_timeout', vm_, __opts__, default=10 * 60),
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 2 hrs to fix
                          salt/cloud/clouds/dimensiondata.py on lines 282..290

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 58.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if 'volume_id' in kwargs:
                                  volume_id = kwargs['volume_id'].split(',')
                                  for volume_index, volume_id in enumerate(volume_id):
                                      params['VolumeId.{0}'.format(volume_index)] = volume_id
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 3 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4760..4763
                          salt/cloud/clouds/ec2.py on lines 4765..4768
                          salt/cloud/clouds/ec2.py on lines 4770..4774

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

                              if 'owner' in kwargs:
                                  owners = kwargs['owner'].split(',')
                                  for owner_index, owner in enumerate(owners):
                                      params['Owner.{0}'.format(owner_index)] = owner
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 3 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4437..4440
                          salt/cloud/clouds/ec2.py on lines 4760..4763
                          salt/cloud/clouds/ec2.py on lines 4770..4774

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

                              if 'snapshot_id' in kwargs:
                                  snapshot_ids = kwargs['snapshot_id'].split(',')
                                  for snapshot_index, snapshot_id in enumerate(snapshot_ids):
                                      params['SnapshotId.{0}'.format(snapshot_index)] = snapshot_id
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 3 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4437..4440
                          salt/cloud/clouds/ec2.py on lines 4765..4768
                          salt/cloud/clouds/ec2.py on lines 4770..4774

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

                              if 'restorable_by' in kwargs:
                                  restorable_bys = kwargs['restorable_by'].split(',')
                                  for restorable_by_index, restorable_by in enumerate(restorable_bys):
                                      params[
                                          'RestorableBy.{0}'.format(restorable_by_index)
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 3 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4437..4440
                          salt/cloud/clouds/ec2.py on lines 4760..4763
                          salt/cloud/clouds/ec2.py on lines 4765..4768

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 57.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                      if endpoint == '':
                                          endpoint_err = (
                                                  'Could not find a valid endpoint in the '
                                                  'requesturl: {0}. Looking for something '
                                                  'like https://some.ec2.endpoint/?args').format(requesturl)
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/utils/aws.py on lines 435..444

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

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

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 55.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if ssh_interface(vm_) == 'public_ips':
                                      if 'ipAddress' in data[0]['instancesSet']['item']:
                                          return data
                                      else:
                                          log.error(
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 2256..2260

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 55.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if ssh_interface(vm_) == 'private_ips':
                                      if 'privateIpAddress' in data[0]['instancesSet']['item']:
                                          return data
                                      else:
                                          log.error(
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 2248..2252

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 55.

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

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

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

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

                          Refactorings

                          Further Reading

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

                          def script(vm_):
                              '''
                              Return the script deployment object
                              '''
                              return salt.utils.cloud.os_script(
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 4 other locations - About 1 hr to fix
                          salt/cloud/clouds/msazure.py on lines 139..148
                          salt/cloud/clouds/oneandone.py on lines 485..494
                          salt/cloud/clouds/parallels.py on lines 435..444
                          salt/cloud/clouds/scaleway.py on lines 379..387

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 54.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  'Dense Storage': {
                                      'd2.xlarge': {
                                          'id': 'd2.xlarge',
                                          'cores': '4',
                                          'disk': '6 TiB (3 x 2 TiB hard disk drives)',
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 702..725

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 51.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  'High I/O': {
                                      'i2.xlarge': {
                                          'id': 'i2.xlarge',
                                          'cores': '4',
                                          'disk': 'SSD (1 x 800 GiB)',
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 642..665

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 51.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  try:
                                      result = requests.get(requesturl, headers=headers, params=params_with_headers)
                                      log.debug(
                                          'EC2 Response Status Code: %s',
                                          # result.getcode()
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/utils/aws.py on lines 476..484

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

                                  if isinstance(kwargs['tags'], six.string_types):
                                      tags = salt.utils.yaml.safe_load(kwargs['tags'])
                                  else:
                                      tags = kwargs['tags']
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 5 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 2954..2957
                          salt/cloud/clouds/msazure.py on lines 708..711
                          salt/cloud/clouds/msazure.py on lines 802..805
                          salt/states/boto_iam.py on lines 1506..1509
                          salt/states/boto_iot.py on lines 368..371

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 50.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if isinstance(kwargs['volumes'], six.string_types):
                                  volumes = salt.utils.yaml.safe_load(kwargs['volumes'])
                              else:
                                  volumes = kwargs['volumes']
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 5 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4252..4255
                          salt/cloud/clouds/msazure.py on lines 708..711
                          salt/cloud/clouds/msazure.py on lines 802..805
                          salt/states/boto_iam.py on lines 1506..1509
                          salt/states/boto_iot.py on lines 368..371

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 50.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if instance_id is None:
                                  if 'instance_id' in kwargs:
                                      instance_id = kwargs['instance_id']
                                      del kwargs['instance_id']
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4879..4882

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 40.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if os.path.exists(userdata_file):
                                      with salt.utils.files.fopen(userdata_file, 'r') as fh_:
                                          userdata = salt.utils.stringutils.to_unicode(fh_.read())
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 2 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4513..4515
                          salt/modules/state.py on lines 186..188

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 48.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if instance_id is None:
                                  if 'instance_id' in kwargs:
                                      instance_id = kwargs['instance_id']
                                      del kwargs['instance_id']
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 4816..4819

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 40.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if os.path.exists(public_key_file):
                                  with salt.utils.files.fopen(public_key_file, 'r') as fh_:
                                      public_key = salt.utils.stringutils.to_unicode(fh_.read())
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 2 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 1808..1810
                          salt/modules/state.py on lines 186..188

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 48.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if 'key_file' in kwargs:
                                      with salt.utils.files.fopen(kwargs['key_file'], 'r') as kf_:
                                          kwargs['key'] = salt.utils.stringutils.to_unicode(kf_.read())
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/joyent.py on lines 960..961

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 48.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if 'error' in nodes:
                                  raise SaltCloudSystemExit(
                                      'An error occurred while listing nodes: {0}'.format(
                                          nodes['error']['Errors']['Error']['Message']
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 5 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 3629..3632
                          salt/cloud/clouds/ec2.py on lines 3660..3663
                          salt/cloud/clouds/softlayer.py on lines 556..559
                          salt/cloud/clouds/softlayer_hw.py on lines 460..463
                          salt/utils/cloud.py on lines 2572..2575

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 47.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if 'error' in instances:
                                  raise SaltCloudSystemExit(
                                      'An error occurred while listing nodes: {0}'.format(
                                          instances['error']['Errors']['Error']['Message']
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 5 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 3629..3632
                          salt/cloud/clouds/ec2.py on lines 3692..3695
                          salt/cloud/clouds/softlayer.py on lines 556..559
                          salt/cloud/clouds/softlayer_hw.py on lines 460..463
                          salt/utils/cloud.py on lines 2572..2575

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 47.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if 'error' in instances:
                                  raise SaltCloudSystemExit(
                                      'An error occurred while listing nodes: {0}'.format(
                                          instances['error']['Errors']['Error']['Message']
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 5 other locations - About 1 hr to fix
                          salt/cloud/clouds/ec2.py on lines 3660..3663
                          salt/cloud/clouds/ec2.py on lines 3692..3695
                          salt/cloud/clouds/softlayer.py on lines 556..559
                          salt/cloud/clouds/softlayer_hw.py on lines 460..463
                          salt/utils/cloud.py on lines 2572..2575

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 47.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  __utils__['cloud.fire_event'](
                                      'event',
                                      'waiting for spot instance',
                                      'salt/cloud/{0}/waiting_for_spot'.format(vm_['name']),
                                      sock_dir=__opts__['sock_dir'],
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 1 hr to fix
                          salt/cloud/clouds/joyent.py on lines 198..203

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

                          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 'encrypted' in kwargs and 'snapshot' not in kwargs:
                                  params['Encrypted'] = kwargs['encrypted']
                                  if 'kmskeyid' in kwargs:
                                      params['KmsKeyId'] = kwargs['kmskeyid']
                          Severity: Minor
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 55 mins to fix
                          salt/modules/x509.py on lines 1476..1479

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 45.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if __opts__.get('update_cachedir', False) is True:
                                  __utils__['cloud.delete_minion_cachedir'](name, __active_provider_name__.split(':')[0], __opts__)
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.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/gce.py on lines 2377..2378
                          salt/cloud/clouds/gogrid.py on lines 421..422
                          salt/cloud/clouds/joyent.py on lines 429..430
                          salt/cloud/clouds/linode.py on lines 758..759
                          salt/cloud/clouds/lxc.py on lines 415..416
                          salt/cloud/clouds/msazure.py on lines 947..948
                          salt/cloud/clouds/nova.py on lines 569..570
                          salt/cloud/clouds/oneandone.py on lines 918..922
                          salt/cloud/clouds/opennebula.py on lines 1226..1230
                          salt/cloud/clouds/openstack.py on lines 816..817
                          salt/cloud/clouds/parallels.py on lines 561..562
                          salt/cloud/clouds/profitbricks.py on lines 1023..1027
                          salt/cloud/clouds/proxmox.py on lines 1194..1196
                          salt/cloud/clouds/scaleway.py on lines 456..458
                          salt/cloud/clouds/softlayer.py on lines 637..638
                          salt/cloud/clouds/softlayer_hw.py on lines 547..548
                          salt/cloud/clouds/vagrant.py on lines 308..310
                          salt/cloud/clouds/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

                              while attempts < aws.AWS_MAX_RETRIES:
                                  params_with_headers = params.copy()
                                  timestamp = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
                          
                                  if not location:
                          Severity: Minor
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 50 mins to fix
                          salt/utils/aws.py on lines 473..515

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 44.

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

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

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

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

                          Refactorings

                          Further Reading

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

                          def get_location(vm_=None):
                              '''
                              Return the EC2 region to use, in this order:
                                  - CLI parameter
                                  - VM parameter
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 2 other locations - About 45 mins to fix
                          salt/cloud/clouds/aliyun.py on lines 204..216
                          salt/cloud/clouds/joyent.py on lines 550..562

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

                                      if name:
                                          instance_id = _get_node(name)['instanceId']
                                      elif 'instance_id' in kwargs:
                                          instance_id = kwargs['instance_id']
                                      elif 'resource_id' in kwargs:
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.py and 2 other locations - About 45 mins to fix
                          salt/modules/freebsdjail.py on lines 188..191
                          salt/utils/boto3mod.py on lines 256..261

                          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 'SubnetId' not in interface and 'subnetname' in interface:
                                  interface['SubnetId'] = _get_subnetname_id(interface['subnetname'])
                          Severity: Minor
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 40 mins to fix
                          salt/cloud/clouds/ec2.py on lines 1424..1425

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 42.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              if 'SecurityGroupId' not in interface and 'securitygroupname' in interface:
                                  interface['SecurityGroupId'] = _get_securitygroupname_id(interface['securitygroupname'])
                          Severity: Minor
                          Found in salt/cloud/clouds/ec2.py and 1 other location - About 40 mins to fix
                          salt/cloud/clouds/ec2.py on lines 1426..1427

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 42.

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

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

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

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

                          Refactorings

                          Further Reading

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

                          def __virtual__():
                              '''
                              Set up the libcloud functions and check for EC2 configurations
                              '''
                              if get_configured_provider() is False:
                          Severity: Major
                          Found in salt/cloud/clouds/ec2.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/msazure.py on lines 79..89
                          salt/cloud/clouds/oneandone.py on lines 156..166
                          salt/cloud/clouds/opennebula.py on lines 98..108
                          salt/cloud/clouds/openstack.py on lines 248..256
                          salt/cloud/clouds/profitbricks.py on lines 138..148
                          salt/cloud/clouds/proxmox.py on lines 70..80
                          salt/cloud/clouds/pyrax.py on lines 29..39
                          salt/cloud/clouds/qingcloud.py on lines 71..81
                          salt/cloud/clouds/softlayer.py on lines 55..65
                          salt/cloud/clouds/softlayer_hw.py on lines 53..63
                          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

                          There are no issues that match your filters.

                          Category
                          Status