Skip to content

Commit 143cd77

Browse files
committed
fix pylint: invalid-name errors
changed constant names to upper case.
1 parent 743c7e6 commit 143cd77

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

marmoset/dhcp/isc_dhcp_ldap_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def __init__(self, dhcp_config):
2121

2222
@staticmethod
2323
def __get_server_connection():
24-
server = Server(config['DHCPConfig'].get('ldap_server'),
25-
port=int(config['DHCPConfig'].get('ldap_port')),
24+
server = Server(CONFIG['DHCPConfig'].get('ldap_server'),
25+
port=int(CONFIG['DHCPConfig'].get('ldap_port')),
2626
get_info=ALL)
2727

2828
conn = Connection(server,

marmoset/webserver/dhcp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from marmoset import dhcp
1010
from marmoset import validation
1111

12-
config = config_reader.load_config()
12+
CONFIG = config_reader.load_config()
1313

14-
additional_statements_str = config['DHCPConfig'].get('additional_statements')
14+
additional_statements_str = CONFIG['DHCPConfig'].get('additional_statements')
1515
additional_statements = additional_statements_str.split(',')
1616

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

38-
if ((args.gateway is None and config['DHCPConfig'].getboolean(
38+
if ((args.gateway is None and CONFIG['DHCPConfig'].getboolean(
3939
'force_gateway')) or args.networkmask is None) and not validation.is_cidr(args.ip_address):
4040
return {
4141
'message': 'missing parameter gateway and networkmask or give an ip address in CIDR notation'}, 406

marmoset/webserver/flask/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from flask import request, current_app
44
from werkzeug.exceptions import Unauthorized
55

6-
Username = 'admin'
7-
Password = 'APgo1VANd6YPqP0ZaJ0OK9A7WHbXzFBqe6Nz8MU9rTxKv6gIZ26nIW1cfn4GbR36'
6+
USERNAME = 'admin'
7+
PASSWORD = 'APgo1VANd6YPqP0ZaJ0OK9A7WHbXzFBqe6Nz8MU9rTxKv6gIZ26nIW1cfn4GbR36'
88

99

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

3737

3838
# we've to disable pep8 here because

marmoset/webserver/installimage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from ..installimage.installimage_config import InstallimageConfig
66
from ..installimage.req_argument_parser import ReqArgumentParser
77

8-
parser = ReqArgumentParser()
8+
PARSER = ReqArgumentParser()
99

1010

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

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

3434
installimage_config = InstallimageConfig(mac)
3535
installimage_config.clear_variables()

marmoset/webserver/pxe.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44
from .. import pxe
55
from marmoset import config as config_reader
66

7-
config = config_reader.load_config()
8-
immutable_pxe_config_support = config['PXEConfig'].get('ImmutableSupport')
7+
CONFIG = config_reader.load_config()
8+
IMMUTABLE_PXE_CONFIG_SUPPORT = CONFIG['PXEConfig'].get('ImmutableSupport')
99

10-
parser = reqparse.RequestParser()
11-
parser.add_argument('ip_address', type=str)
12-
parser.add_argument('password', type=str, default=None)
13-
parser.add_argument('script', type=str, default=None)
14-
parser.add_argument('uuid', type=str, default=None)
15-
parser.add_argument('ipv6_address', type=str, default=None)
16-
parser.add_argument('ipv6_gateway', type=str, default=None)
17-
parser.add_argument('ipv6_prefix', type=str, default=None)
18-
parser.add_argument(
10+
PARSER = reqparse.RequestParser()
11+
PARSER.add_argument('ip_address', type=str)
12+
PARSER.add_argument('password', type=str, default=None)
13+
PARSER.add_argument('script', type=str, default=None)
14+
PARSER.add_argument('uuid', type=str, default=None)
15+
PARSER.add_argument('ipv6_address', type=str, default=None)
16+
PARSER.add_argument('ipv6_gateway', type=str, default=None)
17+
PARSER.add_argument('ipv6_prefix', type=str, default=None)
18+
PARSER.add_argument(
1919
'label',
2020
type=str,
2121
choices=pxe.Label.names(),
2222
default=pxe.Label.names()[0])
2323

24-
if immutable_pxe_config_support == 'True':
25-
persistent_choices = ['true', 'True', 'false', 'False']
24+
if IMMUTABLE_PXE_CONFIG_SUPPORT == 'True':
25+
PERSISTENT_CHOICES = ['true', 'True', 'false', 'False']
2626
else:
27-
persistent_choices = ['false', 'False']
28-
parser.add_argument('persistent', choices=persistent_choices,
27+
PERSISTENT_CHOICES = ['false', 'False']
28+
PARSER.add_argument('persistent', choices=PERSISTENT_CHOICES,
2929
type=str, default='false')
3030

3131

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

5050
persistent = args.persistent in ['true', 'True']
5151
print(args)

0 commit comments

Comments
 (0)