saltstack/salt

View on GitHub
salt/states/trafficserver.py

Summary

Maintainability
F
1 wk
Test Coverage

File trafficserver.py has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Control Apache Traffic Server
=============================

Severity: Minor
Found in salt/states/trafficserver.py - About 3 hrs to fix

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

    def bounce_local(name, drain=False):
        '''
        Bounce Traffic Server on the local node. Bouncing Traffic Server shuts down
        and immediately restarts the Traffic Server node.
    
    
    Severity: Major
    Found in salt/states/trafficserver.py and 1 other location - About 1 day to fix
    salt/states/trafficserver.py on lines 163..199

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 132.

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

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

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ 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 restart_local(name, drain=False):
        '''
        Restart the traffic_manager and traffic_server processes on the local node.
    
        This option modifies the behavior of traffic_line -b and traffic_line -L
    Severity: Major
    Found in salt/states/trafficserver.py and 1 other location - About 1 day to fix
    salt/states/trafficserver.py on lines 46..83

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 132.

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

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

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ 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 9 locations. Consider refactoring.
    Open

    def clear_cluster(name):
        '''
        Clears accumulated statistics on all nodes in the cluster.
    
        .. code-block:: yaml
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 318..340
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def startup(name):
        '''
        Start Traffic Server on the local node.
    
        .. code-block:: yaml
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 318..340
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def refresh(name):
        '''
        Initiate a Traffic Server configuration file reread. Use this command to
        update the running configuration after any configuration file modification.
    
    
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 318..340
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def zero_node(name):
        '''
        Reset performance statistics to zero on the local node.
    
        .. code-block:: yaml
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 318..340

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def clear_node(name):
        '''
        Clears accumulated statistics on the local node.
    
        .. code-block:: yaml
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 318..340
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def bounce_cluster(name):
        '''
        Bounce all Traffic Server nodes in the cluster. Bouncing Traffic Server
        shuts down and immediately restarts Traffic Server, node-by-node.
    
    
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 318..340
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def shutdown(name):
        '''
        Shut down Traffic Server on the local node.
    
        .. code-block:: yaml
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 318..340
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def restart_cluster(name):
        '''
        Restart the traffic_manager process and the traffic_server process on all
        the nodes in a cluster.
    
    
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 318..340
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

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

    def zero_cluster(name):
        '''
        Reset performance statistics to zero across the cluster.
    
        .. code-block:: yaml
    Severity: Major
    Found in salt/states/trafficserver.py and 8 other locations - About 4 hrs to fix
    salt/states/trafficserver.py on lines 20..43
    salt/states/trafficserver.py on lines 86..108
    salt/states/trafficserver.py on lines 111..133
    salt/states/trafficserver.py on lines 136..160
    salt/states/trafficserver.py on lines 239..261
    salt/states/trafficserver.py on lines 264..286
    salt/states/trafficserver.py on lines 289..315
    salt/states/trafficserver.py on lines 343..365

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 84.

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

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

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

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

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status