Revert "Added enum type in the parser file"

This reverts commit 9ff33116f230caac0442de835462456ef4533eec.

Reason for revert: although test plan states that installation works,
it's currently failing after merging this.

Change-Id: I57e3c67c927529508e6472557b373f094d9c0f1b
This commit is contained in:
Bruno Drugowick Muniz 2023-07-04 13:16:46 +00:00
parent 9ff33116f2
commit 1081624635

@ -1,5 +1,5 @@
# pylint: disable=invalid-name
# !/usr/bin/python3
#!/usr/bin/python3
#
# SPDX-License-Identifier: Apache-2.0
#
@ -7,56 +7,10 @@
"""
Parser to handle command line arguments
"""
import argparse
import re
from argparse import ArgumentParser, RawTextHelpFormatter
import getpass
from enum import Enum
class StringEnum(Enum):
"""This class aims to serve as a parent class for a parser
type checker"""
@classmethod
def get_members_values(cls):
"""Static method that returns a list of enum members values"""
return [v.value for v in cls.__members__.values()]
class SetupType(StringEnum):
"""Class aimed to help parser choose between installation
predefined types"""
AIO_SX = 'AIO-SX'
AIO_DX = 'AIO-DX'
STANDARD = 'STANDARD'
STORAGE = 'STORAGE'
class VboxNetworkType(StringEnum):
"""Class aimed to help parser choose between virtual box
network types"""
HOST_ONLY = 'hostonly'
NAT = 'nat'
class SecurityProfile(StringEnum):
"""Class aimed to help parser choose between
security profile types"""
STANDARD = 'standard'
EXTENDED = 'extended'
class LabInstallationType(StringEnum):
"""Class aimed to help parser choose between
lab installation types"""
GRAPHICAL = 'graphical'
SERIAL = 'serial'
def validate_password(pwd: str):
@ -101,9 +55,16 @@ def parse_setup_config(parser: ArgumentParser):
"""
Mutate parser with CLI arguments related to the setup type
"""
parser.add_argument("--setup-type",
help=f"Expected value is one of {SetupType.get_members_values()}",
type=SetupType,
parser.add_argument("--setup-type", help=
"""
Type of setup:
AIO-SX
AIO-DX
STANDARD
STORAGE
""",
choices=['AIO-SX', 'AIO-DX', 'STANDARD', 'STORAGE'],
type=str,
required=True)
parser.add_argument("--controllers", help=
"""
@ -213,8 +174,7 @@ def parse_config_location(parser: ArgumentParser):
parser.add_argument("--ansible-controller-config", help=
"""
Path to a local YAML file to be copied as localhost.yml
to the home directory of the controller-0.
NOTE: System password value is updated dynamically with user defined --password.
to the home directory of the controller-0. NOTE: System password value is updated dynamically with user defined --password.
""",
type=str)
parser.add_argument("--vbox-home-dir", help=
@ -284,7 +244,7 @@ def parse_networking(parser: ArgumentParser):
parser.add_argument("--vboxnet-name", help=
"""
Which network to use for setup.
Which host only network to use for setup.
""",
type=str)
parser.add_argument("--vboxnet-ip", help=
@ -298,10 +258,13 @@ def parse_networking(parser: ArgumentParser):
Add a new NAT interface to hosts.
""",
action='store_true')
parser.add_argument("--vboxnet-type",
help=f"Expected value is one of {VboxNetworkType.get_members_values()}",
type=VboxNetworkType,
default=VboxNetworkType.HOST_ONLY)
parser.add_argument("--vboxnet-type", help=
"""
Type of vbox network, either hostonly on nat
""",
choices=['hostonly', 'nat'],
type=str,
default='hostonly')
parser.add_argument("--nat-controller-floating-local-ssh-port", help=
"""
When oam network is configured as 'nat' a port on