mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-14 16:34:49 +02:00
PR changes
This commit is contained in:
parent
cfe177612a
commit
75f4e7f4b1
5 changed files with 21 additions and 55 deletions
|
@ -246,7 +246,7 @@ This will allow Docker to mount the files to a container (under `/app`) for our
|
||||||
*You are now ready to run migration scripts.*
|
*You are now ready to run migration scripts.*
|
||||||
|
|
||||||
## Transition Domains (Part 2) - Running the Migration Scripts
|
## Transition Domains (Part 2) - Running the Migration Scripts
|
||||||
While keeping the same ssh instance open (if you are running on a sandbox), run through the following commands. If you run into the error that. If you cannot run `manage.py` commands, try running `/tmp/lifecycle/shell` in the ssh instance.
|
While keeping the same ssh instance open (if you are running on a sandbox), run through the following commands.If you cannot run `manage.py` commands, try running `/tmp/lifecycle/shell` in the ssh instance.
|
||||||
|
|
||||||
### STEP 1: Load Transition Domains
|
### STEP 1: Load Transition Domains
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import logging
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
from registrar.management.commands.utility.epp_data_containers import EnumFilenames
|
from registrar.management.commands.utility.epp_data_containers import EnumFilenames
|
||||||
|
@ -63,6 +64,9 @@ class Command(BaseCommand):
|
||||||
action=argparse.BooleanOptionalAction,
|
action=argparse.BooleanOptionalAction,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# This option should only be available when developing locally.
|
||||||
|
# This should not be available to the end user.
|
||||||
|
if settings.DEBUG:
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--infer_filenames",
|
"--infer_filenames",
|
||||||
action=argparse.BooleanOptionalAction,
|
action=argparse.BooleanOptionalAction,
|
||||||
|
@ -322,6 +326,9 @@ class Command(BaseCommand):
|
||||||
**options,
|
**options,
|
||||||
):
|
):
|
||||||
"""Parse the data files and create TransitionDomains."""
|
"""Parse the data files and create TransitionDomains."""
|
||||||
|
if not settings.DEBUG:
|
||||||
|
options["infer_filenames"] = False
|
||||||
|
|
||||||
args = TransitionDomainArguments(**options)
|
args = TransitionDomainArguments(**options)
|
||||||
|
|
||||||
# Desired directory for additional TransitionDomain data
|
# Desired directory for additional TransitionDomain data
|
||||||
|
|
|
@ -334,12 +334,11 @@ class LoadExtraTransitionDomain:
|
||||||
if not isinstance(info.isfederal, str) or not info.isfederal.lower() == "y":
|
if not isinstance(info.isfederal, str) or not info.isfederal.lower() == "y":
|
||||||
self.parse_logs.create_log_item(
|
self.parse_logs.create_log_item(
|
||||||
EnumFilenames.DOMAIN_ADHOC,
|
EnumFilenames.DOMAIN_ADHOC,
|
||||||
LogCode.ERROR,
|
LogCode.INFO,
|
||||||
f"Could not add non-federal agency {info.agencyname} on {domain_name}",
|
f"Adding non-federal agency {info.agencyname} on {domain_name}",
|
||||||
domain_name,
|
domain_name,
|
||||||
not self.debug,
|
not self.debug,
|
||||||
)
|
)
|
||||||
return transition_domain
|
|
||||||
|
|
||||||
transition_domain.federal_agency = info.agencyname
|
transition_domain.federal_agency = info.agencyname
|
||||||
|
|
||||||
|
@ -685,6 +684,10 @@ class FileDataHolder:
|
||||||
# Object data #
|
# Object data #
|
||||||
self.data: Dict[str, type] = {}
|
self.data: Dict[str, type] = {}
|
||||||
|
|
||||||
|
# This is used ONLY for development purposes. This behaviour
|
||||||
|
# is controlled by the --infer_filename flag which is defaulted
|
||||||
|
# to false. The purpose of this check is to speed up development,
|
||||||
|
# but it cannot be used by the enduser
|
||||||
def try_infer_filename(self, current_file_name, default_file_name):
|
def try_infer_filename(self, current_file_name, default_file_name):
|
||||||
"""Tries to match a given filename to a regex,
|
"""Tries to match a given filename to a regex,
|
||||||
then uses that match to generate the filename."""
|
then uses that match to generate the filename."""
|
||||||
|
@ -850,7 +853,6 @@ class ExtraTransitionDomain:
|
||||||
infer_filenames: bool -> Determines if we should try to
|
infer_filenames: bool -> Determines if we should try to
|
||||||
infer the filename if a default is passed in
|
infer the filename if a default is passed in
|
||||||
"""
|
"""
|
||||||
self.clear_file_data()
|
|
||||||
for name, value in self.file_data.items():
|
for name, value in self.file_data.items():
|
||||||
is_domain_escrow = name == EnumFilenames.DOMAIN_ESCROW
|
is_domain_escrow = name == EnumFilenames.DOMAIN_ESCROW
|
||||||
filename = f"{value.filename}"
|
filename = f"{value.filename}"
|
||||||
|
|
|
@ -213,47 +213,3 @@ class TerminalHelper:
|
||||||
)
|
)
|
||||||
with open(f"{filepath}", "w+") as f:
|
with open(f"{filepath}", "w+") as f:
|
||||||
f.write(file_contents)
|
f.write(file_contents)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def printProgressBar(
|
|
||||||
iteration,
|
|
||||||
total,
|
|
||||||
prefix="Progress:",
|
|
||||||
suffix="Complete",
|
|
||||||
decimals=1,
|
|
||||||
length=100,
|
|
||||||
fill="█",
|
|
||||||
printEnd="\r",
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Call in a loop to create terminal progress bar
|
|
||||||
@params:
|
|
||||||
iteration - Required : current iteration (Int)
|
|
||||||
total - Required : total iterations (Int)
|
|
||||||
prefix - Optional : prefix string (Str)
|
|
||||||
suffix - Optional : suffix string (Str)
|
|
||||||
decimals - Optional : positive number of decimals in percent complete (Int)
|
|
||||||
length - Optional : character length of bar (Int)
|
|
||||||
fill - Optional : bar fill character (Str)
|
|
||||||
printEnd - Optional : end character (e.g. "\r", "\r\n") (Str)
|
|
||||||
""" # noqa
|
|
||||||
|
|
||||||
"""
|
|
||||||
# Initial call to print 0% progress
|
|
||||||
printProgressBar(0, l, prefix = 'Progress:', suffix = 'Complete', length = 50)
|
|
||||||
for i, item in enumerate(items):
|
|
||||||
# Do stuff...
|
|
||||||
time.sleep(0.1)
|
|
||||||
# Update Progress Bar
|
|
||||||
printProgressBar(i + 1, l, prefix = 'Progress:', suffix = 'Complete', length = 50)
|
|
||||||
""" # noqa
|
|
||||||
|
|
||||||
percent = ("{0:." + str(decimals) + "f}").format(
|
|
||||||
100 * (iteration / float(total))
|
|
||||||
)
|
|
||||||
filledLength = int(length * iteration // total)
|
|
||||||
bar = fill * filledLength + "-" * (length - filledLength)
|
|
||||||
print(f"\r{prefix} |{bar}| {percent}% {suffix}", end=printEnd)
|
|
||||||
# Print New Line on Complete
|
|
||||||
if iteration == total:
|
|
||||||
print()
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ class DomainInformation(TimeStampedModel):
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="Type of Organization",
|
help_text="Type of Organization",
|
||||||
)
|
)
|
||||||
|
|
||||||
federally_recognized_tribe = models.BooleanField(
|
federally_recognized_tribe = models.BooleanField(
|
||||||
null=True,
|
null=True,
|
||||||
help_text="Is the tribe federally recognized",
|
help_text="Is the tribe federally recognized",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue