mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 10:46:06 +02:00
Respond to PR feedback
This commit is contained in:
parent
e386a039b2
commit
39c54fa79f
5 changed files with 20 additions and 19 deletions
|
@ -88,8 +88,7 @@ openssl req -new -x509 -days 365 \
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
(Hint:
|
(If you can't use openssl on your computer directly, you can access it using Docker as `docker run --platform=linux/amd64 -it --rm -v $(pwd):/apps -w /apps alpine/openssl`.)
|
||||||
`docker run --platform=linux/amd64 -it --rm -v $(pwd):/apps -w /apps alpine/openssl`.)
|
|
||||||
|
|
||||||
Encode them using:
|
Encode them using:
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from types import SimpleNamespace
|
||||||
try:
|
try:
|
||||||
from epplib import constants
|
from epplib import constants
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
# allow epplibwrapper to load without epplib, for testing and development
|
||||||
pass
|
pass
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Provide a wrapper around epplib to handle authentication and errors."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
@ -21,12 +23,12 @@ try:
|
||||||
# Write cert and key to disk
|
# Write cert and key to disk
|
||||||
CERT = Cert()
|
CERT = Cert()
|
||||||
KEY = Key()
|
KEY = Key()
|
||||||
except Exception as err:
|
except Exception:
|
||||||
CERT = None # type: ignore
|
CERT = None # type: ignore
|
||||||
KEY = None # type: ignore
|
KEY = None # type: ignore
|
||||||
logger.warning(err)
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Problem with client certificate. Registrar cannot contact registry."
|
"Problem with client certificate. Registrar cannot contact registry.",
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,31 +70,31 @@ class EPPLibWrapper:
|
||||||
with self._connect as wire:
|
with self._connect as wire:
|
||||||
response = wire.send(command)
|
response = wire.send(command)
|
||||||
except (ValueError, ParsingError) as err:
|
except (ValueError, ParsingError) as err:
|
||||||
logger.debug(err)
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"%s failed to execute due to some syntax error."
|
"%s failed to execute due to some syntax error."
|
||||||
% command.__class__.__name__
|
% command.__class__.__name__,
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
raise RegistryError() from err
|
raise RegistryError() from err
|
||||||
except TransportError as err:
|
except TransportError as err:
|
||||||
logger.debug(err)
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"%s failed to execute due to a connection error."
|
"%s failed to execute due to a connection error."
|
||||||
% command.__class__.__name__
|
% command.__class__.__name__,
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
raise RegistryError() from err
|
raise RegistryError() from err
|
||||||
except LoginError as err:
|
except LoginError as err:
|
||||||
logger.debug(err)
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"%s failed to execute due to a registry login error."
|
"%s failed to execute due to a registry login error."
|
||||||
% command.__class__.__name__
|
% command.__class__.__name__,
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
raise RegistryError() from err
|
raise RegistryError() from err
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.debug(err)
|
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"%s failed to execute due to an unknown error."
|
"%s failed to execute due to an unknown error."
|
||||||
% command.__class__.__name__
|
% command.__class__.__name__,
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
raise RegistryError() from err
|
raise RegistryError() from err
|
||||||
else:
|
else:
|
||||||
|
@ -119,7 +121,8 @@ try:
|
||||||
# Initialize epplib
|
# Initialize epplib
|
||||||
CLIENT = EPPLibWrapper()
|
CLIENT = EPPLibWrapper()
|
||||||
logger.debug("registry client initialized")
|
logger.debug("registry client initialized")
|
||||||
except Exception as err:
|
except Exception:
|
||||||
CLIENT = None # type: ignore
|
CLIENT = None # type: ignore
|
||||||
logger.warning(err)
|
logger.warning(
|
||||||
logger.warning("Unable to configure epplib. Registrar cannot contact registry.")
|
"Unable to configure epplib. Registrar cannot contact registry.", exc_info=True
|
||||||
|
)
|
||||||
|
|
|
@ -7,8 +7,6 @@ from django.db import models
|
||||||
from django_fsm import FSMField, transition # type: ignore
|
from django_fsm import FSMField, transition # type: ignore
|
||||||
|
|
||||||
from api.views import in_domains
|
from api.views import in_domains
|
||||||
|
|
||||||
# from epplibwrapper import CLIENT as registry, commands
|
|
||||||
from registrar.utility import errors
|
from registrar.utility import errors
|
||||||
|
|
||||||
from .utility.time_stamped_model import TimeStampedModel
|
from .utility.time_stamped_model import TimeStampedModel
|
||||||
|
|
|
@ -6,4 +6,4 @@ set -o pipefail
|
||||||
# Make sure that django's `collectstatic` has been run locally before pushing up to any environment,
|
# Make sure that django's `collectstatic` has been run locally before pushing up to any environment,
|
||||||
# so that the styles and static assets to show up correctly on any environment.
|
# so that the styles and static assets to show up correctly on any environment.
|
||||||
|
|
||||||
gunicorn registrar.config.wsgi -t 60 --preload
|
gunicorn registrar.config.wsgi -t 60
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue