documentation updates and updates to json arg

This commit is contained in:
CocoByte 2023-11-08 16:08:34 -06:00
parent e7a3124112
commit 638493a6e2
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
2 changed files with 17 additions and 14 deletions

View file

@ -243,7 +243,7 @@ Run the following command, making sure the file paths point to the right locatio
##### LOCAL COMMAND ##### LOCAL COMMAND
```shell ```shell
docker-compose exec app ./manage.py load_transition_domain migrationFilepaths.json --directory /app/tmp --debug docker-compose exec app ./manage.py load_transition_domain migrationFilepaths.json --directory /app/tmp/ --debug --limitParse 10
``` ```
##### SANDBOX COMMAND ##### SANDBOX COMMAND
```shell ```shell

View file

@ -64,9 +64,14 @@ class Command(BaseCommand):
) )
parser.add_argument( parser.add_argument(
"--directory", default="migrationdata", help="Desired directory" "--infer_filenames",
action=argparse.BooleanOptionalAction,
help="Determines if we should infer filenames or not. Recommended to be enabled only in a development or testing setting."
) )
parser.add_argument(
"--directory", default="migrationdata", help="Desired directory"
)
parser.add_argument( parser.add_argument(
"--domain_contacts_filename", "--domain_contacts_filename",
help="Data file with domain contact information" help="Data file with domain contact information"
@ -79,11 +84,6 @@ class Command(BaseCommand):
"--domain_statuses_filename", "--domain_statuses_filename",
help="Data file with domain status information" help="Data file with domain status information"
) )
parser.add_argument(
"--infer_filenames",
action=argparse.BooleanOptionalAction,
help="Determines if we should infer filenames or not. Recommended to be enabled only in a development or testing setting."
)
parser.add_argument( parser.add_argument(
"--agency_adhoc_filename", "--agency_adhoc_filename",
default=EnumFilenames.AGENCY_ADHOC.value[1], default=EnumFilenames.AGENCY_ADHOC.value[1],
@ -322,10 +322,19 @@ class Command(BaseCommand):
): ):
"""Parse the data files and create TransitionDomains.""" """Parse the data files and create TransitionDomains."""
args = TransitionDomainArguments(**options) args = TransitionDomainArguments(**options)
# Desired directory for additional TransitionDomain data
# (In the event they are stored seperately)
directory = args.directory
# Add a slash if the last character isn't one
if directory and directory[-1] != "/":
directory += "/"
json_filepath = directory + migration_json_filename
### Process JSON file ### ### Process JSON file ###
# If a JSON was provided, use its values instead of defaults. # If a JSON was provided, use its values instead of defaults.
# TODO: there is no way to discern user overrides from those args defaults. # TODO: there is no way to discern user overrides from those args defaults.
with open(migration_json_filename, "r") as jsonFile: with open(json_filepath, "r") as jsonFile:
# load JSON object as a dictionary # load JSON object as a dictionary
try: try:
data = json.load(jsonFile) data = json.load(jsonFile)
@ -361,12 +370,6 @@ class Command(BaseCommand):
## Variables for Additional TransitionDomain Information ## ## Variables for Additional TransitionDomain Information ##
# Desired directory for additional TransitionDomain data
# (In the event they are stored seperately)
directory = args.directory
# Add a slash if the last character isn't one
if directory and directory[-1] != "/":
directory += "/"
# Main script filenames - these do not have defaults # Main script filenames - these do not have defaults
domain_contacts_filename = None domain_contacts_filename = None