# saltstack/salt

salt/utils/kickstart.py

### Summary

F
1 mo

#### Function mksls has a Cognitive Complexity of 163 (exceeds 5 allowed). Consider refactoring. Open

def mksls(src, dst=None):
'''
Convert a kickstart file to an SLS file
'''
mode = 'command'
Found in salt/utils/kickstart.py - About 3 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"

#### File kickstart.py has 1003 lines of code (exceeds 250 allowed). Consider refactoring. Open

# -*- coding: utf-8 -*-
'''
Utilities for managing kickstart

Found in salt/utils/kickstart.py - About 2 days to fix

#### Cyclomatic complexity is too high in function mksls. (99) Open

def mksls(src, dst=None):
'''
Convert a kickstart file to an SLS file
'''
mode = 'command'

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

#### Function parse_auth has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open

def parse_auth(rule):
'''
Parses the auth/authconfig line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py - About 1 hr to fix

#### Function parse_network has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open

def parse_network(rule):
'''
Parse the network line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py - About 1 hr to fix

#### Avoid deeply nested control flow statements. Open

if 'raid' not in ks_opts.keys():
ks_opts['raid'] = []
ks_opts['raid'].append(parse_raid(line))
Found in salt/utils/kickstart.py - About 45 mins to fix

#### Avoid deeply nested control flow statements. Open

if 'no' in interface['onboot']:
sls[device]['enabled'] = False
else:
sls[device]['enabled'] = True
del interface['onboot']
Found in salt/utils/kickstart.py - About 45 mins to fix

#### Avoid deeply nested control flow statements. Open

if 'part' not in ks_opts.keys():
ks_opts['part'] = []
ks_opts['part'].append(parse_partition(line))
Found in salt/utils/kickstart.py - About 45 mins to fix

#### Avoid deeply nested control flow statements. Open

if type(interface[option]) is bool:
sls[device][option] = {'enabled': [interface[option]]}
else:
sls[device][option] = interface[option]
if 'hostname' in interface:
Found in salt/utils/kickstart.py - About 45 mins to fix

#### Avoid deeply nested control flow statements. Open

if 'network' not in ks_opts.keys():
ks_opts['network'] = []
ks_opts['network'].append(parse_network(line))
Found in salt/utils/kickstart.py - About 45 mins to fix

#### Avoid deeply nested control flow statements. Open

if 'logvol' not in ks_opts.keys():
ks_opts['logvol'] = []
ks_opts['logvol'].append(parse_logvol(line))
Found in salt/utils/kickstart.py - About 45 mins to fix

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

def parse_volgroup(rule):
'''
Parse the volgroup line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.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"

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

def parse_raid(rule):
'''
Parse the raid line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.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"

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

'''
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 1 other location - About 1 day to fix
salt/utils/kickstart.py on lines 323..342

## 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 193.

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.

## Refactorings

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

def parse_iscsi(rule):
'''
Parse the iscsi line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 1 other location - About 1 day to fix
salt/utils/kickstart.py on lines 120..138

## 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 193.

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.

## Refactorings

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

def parse_btrfs(rule):
'''
Parse the btrfs line

TODO: finish up the weird parsing on this one
Found in salt/utils/kickstart.py and 1 other location - About 1 day to fix
salt/utils/kickstart.py on lines 165..182

## 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 177.

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.

## Refactorings

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

def parse_clearpart(rule):
'''
Parse the clearpart line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 1 other location - About 1 day to fix
salt/utils/kickstart.py on lines 141..162

## 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 177.

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.

## Refactorings

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

def parse_monitor(rule):
'''
Parse the monitor line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 1 other location - About 7 hrs to fix
salt/utils/kickstart.py on lines 704..718

## 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 129.

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.

## Refactorings

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

def parse_sshpw(rule):
'''
Parse the sshpw line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 1 other location - About 7 hrs to fix
salt/utils/kickstart.py on lines 445..459

## 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 129.

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.

## Refactorings

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

def parse_selinux(rule):
'''
Parse the selinux line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 290..303
salt/utils/kickstart.py on lines 306..320
salt/utils/kickstart.py on lines 462..475
salt/utils/kickstart.py on lines 512..525
salt/utils/kickstart.py on lines 764..778
salt/utils/kickstart.py on lines 804..817
salt/utils/kickstart.py on lines 875..888

## 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 113.

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.

## Refactorings

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

def parse_url(rule):
'''
Parse the url line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 290..303
salt/utils/kickstart.py on lines 306..320
salt/utils/kickstart.py on lines 462..475
salt/utils/kickstart.py on lines 512..525
salt/utils/kickstart.py on lines 673..686
salt/utils/kickstart.py on lines 804..817
salt/utils/kickstart.py on lines 875..888

## 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 113.

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.

## Refactorings

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

def parse_ignoredisk(rule):
'''
Parse the ignoredisk line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 290..303
salt/utils/kickstart.py on lines 462..475
salt/utils/kickstart.py on lines 512..525
salt/utils/kickstart.py on lines 673..686
salt/utils/kickstart.py on lines 764..778
salt/utils/kickstart.py on lines 804..817
salt/utils/kickstart.py on lines 875..888

## 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 113.

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.

## Refactorings

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

def parse_vnc(rule):
'''
Parse the vnc line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 290..303
salt/utils/kickstart.py on lines 306..320
salt/utils/kickstart.py on lines 462..475
salt/utils/kickstart.py on lines 512..525
salt/utils/kickstart.py on lines 673..686
salt/utils/kickstart.py on lines 764..778
salt/utils/kickstart.py on lines 875..888

## 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 113.

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.

## Refactorings

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

def parse_harddrive(rule):
'''
Parse the harddrive line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 306..320
salt/utils/kickstart.py on lines 462..475
salt/utils/kickstart.py on lines 512..525
salt/utils/kickstart.py on lines 673..686
salt/utils/kickstart.py on lines 764..778
salt/utils/kickstart.py on lines 804..817
salt/utils/kickstart.py on lines 875..888

## 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 113.

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.

## Refactorings

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

def parse_multipath(rule):
'''
Parse the multipath line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 290..303
salt/utils/kickstart.py on lines 306..320
salt/utils/kickstart.py on lines 512..525
salt/utils/kickstart.py on lines 673..686
salt/utils/kickstart.py on lines 764..778
salt/utils/kickstart.py on lines 804..817
salt/utils/kickstart.py on lines 875..888

## 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 113.

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.

## Refactorings

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

def parse_nfs(rule):
'''
Parse the nfs line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 290..303
salt/utils/kickstart.py on lines 306..320
salt/utils/kickstart.py on lines 462..475
salt/utils/kickstart.py on lines 673..686
salt/utils/kickstart.py on lines 764..778
salt/utils/kickstart.py on lines 804..817
salt/utils/kickstart.py on lines 875..888

## 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 113.

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.

## Refactorings

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

def parse_zfcp(rule):
'''
Parse the zfcp line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 7 other locations - About 6 hrs to fix
salt/utils/kickstart.py on lines 290..303
salt/utils/kickstart.py on lines 306..320
salt/utils/kickstart.py on lines 462..475
salt/utils/kickstart.py on lines 512..525
salt/utils/kickstart.py on lines 673..686
salt/utils/kickstart.py on lines 764..778
salt/utils/kickstart.py on lines 804..817

## 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 113.

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.

## Refactorings

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

for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
elif rules[count].startswith('--'):
Found in salt/utils/kickstart.py and 1 other location - About 5 hrs to fix
salt/utils/kickstart.py on lines 830..838

## 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 90.

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.

## Refactorings

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

for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
elif rules[count].startswith('--'):
Found in salt/utils/kickstart.py and 1 other location - About 5 hrs to fix
salt/utils/kickstart.py on lines 570..578

## 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 90.

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.

## Refactorings

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

def parse_dmraid(rule):
'''
Parse the dmraid line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 4 other locations - About 5 hrs to fix
salt/utils/kickstart.py on lines 275..287
salt/utils/kickstart.py on lines 641..653
salt/utils/kickstart.py on lines 689..701
salt/utils/kickstart.py on lines 858..872

## 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 97.

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.

## Refactorings

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

def parse_xconfig(rule):
'''
Parse the xconfig line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 4 other locations - About 5 hrs to fix
salt/utils/kickstart.py on lines 201..213
salt/utils/kickstart.py on lines 275..287
salt/utils/kickstart.py on lines 641..653
salt/utils/kickstart.py on lines 689..701

## 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 97.

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.

## Refactorings

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

def parse_services(rule):
'''
Parse the services line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 4 other locations - About 5 hrs to fix
salt/utils/kickstart.py on lines 201..213
salt/utils/kickstart.py on lines 275..287
salt/utils/kickstart.py on lines 641..653
salt/utils/kickstart.py on lines 858..872

## 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 97.

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.

## Refactorings

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

def parse_group(rule):
'''
Parse the group line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 4 other locations - About 5 hrs to fix
salt/utils/kickstart.py on lines 201..213
salt/utils/kickstart.py on lines 641..653
salt/utils/kickstart.py on lines 689..701
salt/utils/kickstart.py on lines 858..872

## 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 97.

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.

## Refactorings

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

def parse_rescue(rule):
'''
Parse the rescue line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 4 other locations - About 5 hrs to fix
salt/utils/kickstart.py on lines 201..213
salt/utils/kickstart.py on lines 275..287
salt/utils/kickstart.py on lines 689..701
salt/utils/kickstart.py on lines 858..872

## 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 97.

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.

## Refactorings

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

def parse_autostep(rule):
'''
Parse the autostep line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 1 other location - About 3 hrs to fix
salt/utils/kickstart.py on lines 604..615

## 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 81.

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.

## Refactorings

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

def parse_reboot(rule):
'''
Parse the reboot line
'''
parser = argparse.ArgumentParser()
Found in salt/utils/kickstart.py and 1 other location - About 3 hrs to fix
salt/utils/kickstart.py on lines 105..117

## 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 81.

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.

## Refactorings

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

if line.startswith('%include'):
rules = shlex.split(line)
if not ks_opts['include']:
ks_opts['include'] = []
ks_opts['include'].append(rules[1])
Found in salt/utils/kickstart.py and 1 other location - About 2 hrs to fix
salt/utils/kickstart.py on lines 1025..1029

## Duplicated Code

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

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

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

## Tuning

This issue has a mass of 67.

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

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

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

## Refactorings

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

if line.startswith('%ksappend'):
rules = shlex.split(line)
if not ks_opts['ksappend']:
ks_opts['ksappend'] = []
ks_opts['ksappend'].append(rules[1])
Found in salt/utils/kickstart.py and 1 other location - About 2 hrs to fix
salt/utils/kickstart.py on lines 1019..1023

## Duplicated Code

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

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

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

## Tuning

This issue has a mass of 67.

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

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

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

## Refactorings

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

elif line.startswith('part ') or line.startswith('partition'):
if 'part' not in ks_opts.keys():
ks_opts['part'] = []
ks_opts['part'].append(parse_partition(line))
Found in salt/utils/kickstart.py and 3 other locations - About 55 mins to fix
salt/utils/kickstart.py on lines 950..953
salt/utils/kickstart.py on lines 962..965
salt/utils/kickstart.py on lines 974..977

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

## Refactorings

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

elif line.startswith('raid'):
if 'raid' not in ks_opts.keys():
ks_opts['raid'] = []
ks_opts['raid'].append(parse_raid(line))
Found in salt/utils/kickstart.py and 3 other locations - About 55 mins to fix
salt/utils/kickstart.py on lines 950..953
salt/utils/kickstart.py on lines 962..965
salt/utils/kickstart.py on lines 968..971

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

## Refactorings

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

elif line.startswith('logvol'):
if 'logvol' not in ks_opts.keys():
ks_opts['logvol'] = []
ks_opts['logvol'].append(parse_logvol(line))
Found in salt/utils/kickstart.py and 3 other locations - About 55 mins to fix
salt/utils/kickstart.py on lines 962..965
salt/utils/kickstart.py on lines 968..971
salt/utils/kickstart.py on lines 974..977

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

## Refactorings

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

elif line.startswith('network'):
if 'network' not in ks_opts.keys():
ks_opts['network'] = []
ks_opts['network'].append(parse_network(line))
Found in salt/utils/kickstart.py and 3 other locations - About 55 mins to fix
salt/utils/kickstart.py on lines 950..953
salt/utils/kickstart.py on lines 968..971
salt/utils/kickstart.py on lines 974..977

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

## Refactorings

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

if 'noipv6' in interface.keys():
sls[device]['ipv6'] = {'enabled': False}
del interface['noipv6']
Found in salt/utils/kickstart.py and 1 other location - About 50 mins to fix
salt/utils/kickstart.py on lines 1131..1133

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

## Refactorings

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

if 'noipv4' in interface.keys():
sls[device]['ipv4'] = {'enabled': False}
del interface['noipv4']
Found in salt/utils/kickstart.py and 1 other location - About 50 mins to fix
salt/utils/kickstart.py on lines 1134..1136

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