Skip to content

Commit

Permalink
fix pylint: invalid-name errors
Browse files Browse the repository at this point in the history
changed constant names to upper case.
  • Loading branch information
Ablesius committed Oct 30, 2019
1 parent 743c7e6 commit 143cd77
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions marmoset/dhcp/isc_dhcp_ldap_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def __init__(self, dhcp_config):

@staticmethod
def __get_server_connection():
server = Server(config['DHCPConfig'].get('ldap_server'),
port=int(config['DHCPConfig'].get('ldap_port')),
server = Server(CONFIG['DHCPConfig'].get('ldap_server'),
port=int(CONFIG['DHCPConfig'].get('ldap_port')),
get_info=ALL)

conn = Connection(server,
Expand Down
6 changes: 3 additions & 3 deletions marmoset/webserver/dhcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from marmoset import dhcp
from marmoset import validation

config = config_reader.load_config()
CONFIG = config_reader.load_config()

additional_statements_str = config['DHCPConfig'].get('additional_statements')
additional_statements_str = CONFIG['DHCPConfig'].get('additional_statements')
additional_statements = additional_statements_str.split(',')

parser = reqparse.RequestParser()
Expand All @@ -35,7 +35,7 @@ def post(self):
"""Create a new PXE record."""
args = parser.parse_args()

if ((args.gateway is None and config['DHCPConfig'].getboolean(
if ((args.gateway is None and CONFIG['DHCPConfig'].getboolean(
'force_gateway')) or args.networkmask is None) and not validation.is_cidr(args.ip_address):
return {
'message': 'missing parameter gateway and networkmask or give an ip address in CIDR notation'}, 406
Expand Down
6 changes: 3 additions & 3 deletions marmoset/webserver/flask/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from flask import request, current_app
from werkzeug.exceptions import Unauthorized

Username = 'admin'
Password = 'APgo1VANd6YPqP0ZaJ0OK9A7WHbXzFBqe6Nz8MU9rTxKv6gIZ26nIW1cfn4GbR36'
USERNAME = 'admin'
PASSWORD = 'APgo1VANd6YPqP0ZaJ0OK9A7WHbXzFBqe6Nz8MU9rTxKv6gIZ26nIW1cfn4GbR36'


def required(f):
Expand Down Expand Up @@ -32,7 +32,7 @@ def __check_auth(username, password): # nopep8
This function is called to check if a username /
password combination is valid.
"""
return username == Username and password == Password
return username == USERNAME and password == PASSWORD


# we've to disable pep8 here because
Expand Down
4 changes: 2 additions & 2 deletions marmoset/webserver/installimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ..installimage.installimage_config import InstallimageConfig
from ..installimage.req_argument_parser import ReqArgumentParser

parser = ReqArgumentParser()
PARSER = ReqArgumentParser()


class InstallimageCollection(Resource):
Expand All @@ -29,7 +29,7 @@ def get(self, mac):

def post(self, mac):
"""Create or updates a config based on the provided MAC."""
args = parser.parse_args(request)
args = PARSER.parse_args(request)

installimage_config = InstallimageConfig(mac)
installimage_config.clear_variables()
Expand Down
32 changes: 16 additions & 16 deletions marmoset/webserver/pxe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
from .. import pxe
from marmoset import config as config_reader

config = config_reader.load_config()
immutable_pxe_config_support = config['PXEConfig'].get('ImmutableSupport')
CONFIG = config_reader.load_config()
IMMUTABLE_PXE_CONFIG_SUPPORT = CONFIG['PXEConfig'].get('ImmutableSupport')

parser = reqparse.RequestParser()
parser.add_argument('ip_address', type=str)
parser.add_argument('password', type=str, default=None)
parser.add_argument('script', type=str, default=None)
parser.add_argument('uuid', type=str, default=None)
parser.add_argument('ipv6_address', type=str, default=None)
parser.add_argument('ipv6_gateway', type=str, default=None)
parser.add_argument('ipv6_prefix', type=str, default=None)
parser.add_argument(
PARSER = reqparse.RequestParser()
PARSER.add_argument('ip_address', type=str)
PARSER.add_argument('password', type=str, default=None)
PARSER.add_argument('script', type=str, default=None)
PARSER.add_argument('uuid', type=str, default=None)
PARSER.add_argument('ipv6_address', type=str, default=None)
PARSER.add_argument('ipv6_gateway', type=str, default=None)
PARSER.add_argument('ipv6_prefix', type=str, default=None)
PARSER.add_argument(
'label',
type=str,
choices=pxe.Label.names(),
default=pxe.Label.names()[0])

if immutable_pxe_config_support == 'True':
persistent_choices = ['true', 'True', 'false', 'False']
if IMMUTABLE_PXE_CONFIG_SUPPORT == 'True':
PERSISTENT_CHOICES = ['true', 'True', 'false', 'False']
else:
persistent_choices = ['false', 'False']
parser.add_argument('persistent', choices=persistent_choices,
PERSISTENT_CHOICES = ['false', 'False']
PARSER.add_argument('persistent', choices=PERSISTENT_CHOICES,
type=str, default='false')


Expand All @@ -45,7 +45,7 @@ def post(self):
only when all of them are provided. Missing password or uuid will
be auto generated by ClientConfig.
"""
args = parser.parse_args()
args = PARSER.parse_args()

persistent = args.persistent in ['true', 'True']
print(args)
Expand Down

0 comments on commit 143cd77

Please sign in to comment.