Skip to content

Commit

Permalink
Renaming tls parameter names
Browse files Browse the repository at this point in the history
  • Loading branch information
David Davis committed Nov 12, 2019
1 parent 48ee6e3 commit 7bac2b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions pulpcore/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ class Remote(MasterModel):
name (models.CharField): The remote name.
url (models.TextField): The URL of an external content source.
ssl_ca_certificate (models.FileField): A PEM encoded CA certificate used to validate the
ca_cert (models.FileField): A PEM encoded CA certificate used to validate the
server certificate presented by the external source.
ssl_client_certificate (models.FileField): A PEM encoded client certificate used
client_cert (models.FileField): A PEM encoded client certificate used
for authentication.
ssl_client_key (models.FileField): A PEM encoded private key used for authentication.
ssl_validation (models.BooleanField): If True, SSL peer validation must be performed.
client_key (models.FileField): A PEM encoded private key used for authentication.
tls_validation (models.BooleanField): If True, TLS peer validation must be performed.
proxy_url (models.TextField): The optional proxy URL.
Format: scheme://user:password@host:port
username (models.TextField): The username to be used for authentication when syncing.
Expand Down Expand Up @@ -168,10 +168,10 @@ class Remote(MasterModel):

url = models.TextField()

ssl_ca_certificate = models.TextField(null=True)
ssl_client_certificate = models.TextField(null=True)
ssl_client_key = models.TextField(null=True)
ssl_validation = models.BooleanField(default=True)
ca_cert = models.TextField(null=True)
client_cert = models.TextField(null=True)
client_key = models.TextField(null=True)
tls_validation = models.BooleanField(default=True)

username = models.TextField(null=True)
password = models.TextField(null=True)
Expand Down
14 changes: 7 additions & 7 deletions pulpcore/app/serializers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,29 @@ class RemoteSerializer(ModelSerializer):
url = serializers.CharField(
help_text='The URL of an external content source.',
)
ssl_ca_certificate = SecretCharField(
ca_cert = SecretCharField(
help_text='A string containing the PEM encoded CA certificate used to validate the server '
'certificate presented by the remote server. All new line characters must be '
'escaped. Returns SHA256 sum on GET.',
write_only=False,
required=False,
allow_null=True,
)
ssl_client_certificate = SecretCharField(
client_cert = SecretCharField(
help_text='A string containing the PEM encoded client certificate used for authentication. '
'All new line characters must be escaped. Returns SHA256 sum on GET.',
write_only=False,
required=False,
allow_null=True,
)
ssl_client_key = SecretCharField(
client_key = SecretCharField(
help_text='A PEM encoded private key used for authentication. Returns SHA256 sum on GET.',
write_only=False,
required=False,
allow_null=True,
)
ssl_validation = serializers.BooleanField(
help_text='If True, SSL peer validation must be performed.',
tls_validation = serializers.BooleanField(
help_text='If True, TLS peer validation must be performed.',
required=False,
)
proxy_url = serializers.CharField(
Expand Down Expand Up @@ -113,8 +113,8 @@ class Meta:
abstract = True
model = models.Remote
fields = ModelSerializer.Meta.fields + (
'name', 'url', 'ssl_ca_certificate', 'ssl_client_certificate', 'ssl_client_key',
'ssl_validation', 'proxy_url', 'username', 'password', 'pulp_last_updated',
'name', 'url', 'ca_cert', 'client_cert', 'client_key',
'tls_validation', 'proxy_url', 'username', 'password', 'pulp_last_updated',
'download_concurrency', 'policy'
)

Expand Down
8 changes: 4 additions & 4 deletions pulpcore/download/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def _make_aiohttp_session_from_remote(self):
tcp_conn_opts = {'force_close': True}

sslcontext = None
if self._remote.ssl_ca_certificate:
sslcontext = ssl.create_default_context(cadata=self._remote.ssl_ca_certificate)
if self._remote.ssl_client_key and self._remote.ssl_client_certificate:
if self._remote.ca_cert:
sslcontext = ssl.create_default_context(cadata=self._remote.ca_cert)
if self._remote.client_key and self._remote.client_cert:
if not sslcontext:
sslcontext = ssl.create_default_context()
with NamedTemporaryFile() as key_file:
Expand All @@ -95,7 +95,7 @@ def _make_aiohttp_session_from_remote(self):
cert_file.name,
key_file.name
)
if not self._remote.ssl_validation:
if not self._remote.tls_validation:
if not sslcontext:
sslcontext = ssl.create_default_context()
sslcontext.check_hostname = False
Expand Down

0 comments on commit 7bac2b1

Please sign in to comment.