pulp / pulp/pulpcore

Can't "unset" a remotes certs

Open
#2,025 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API Bindings Issue
Dominant language
Python
Stars
598
Forks
168
Avg merge
1d 4h
Merged PRs (30d)
86

Description

Author: wibbit (wibbit)

Redmine Issue: 9061, https://pulp.plan.io/issues/9061


After erroneously creating a remote with a ca_cert, client_cert and client_key, I attempted to unset these values, however, it appeared to have no impact.

Below is a simple test to show the issue.

In [17]: remote_model = RpmRpmRemote(name="TestRemote", url='DuffURL', ca_cert="DuffCACert", client_cert="DuffClientCert", client_key="DuffClientKey")

In [18]: rpm_remote.create(rpm_rpm_remote=remote_model)
Out[18]:
{'ca_cert': 'DuffCACert',
'client_cert': 'DuffClientCert',
'connect_timeout': None,
'download_concurrency': None,
'headers': None,
'name': 'TestRemote',
'policy': 'immediate',
'proxy_url': None,
'pulp_created': datetime.datetime(2021, 7, 11, 20, 35, 52, 825025, tzinfo=tzutc()),
'pulp_href': '/pulp/api/v3/remotes/rpm/rpm/2ccbe163-75e5-4288-bd48-8ddca1e31fd8/',
'pulp_labels': {},
'pulp_last_updated': datetime.datetime(2021, 7, 11, 20, 35, 52, 825040, tzinfo=tzutc()),
'rate_limit': None,
'sles_auth_token': None,
'sock_connect_timeout': None,
'sock_read_timeout': None,
'tls_validation': True,
'total_timeout': None,
'url': 'DuffURL'}

In [19]: updated_remote_model = RpmRpmRemote(name="TestRemote", url='DuffURL', ca_cert=None, client_cert=None, client_key=None)

In [20]: rpm_remote.update(rpm_rpm_remote_href='/pulp/api/v3/remotes/rpm/rpm/2ccbe163-75e5-4288-bd48-8ddca1e31fd8/', rpm_rpm_remote=updated_remote_model)
Out[20]: {'task': '/pulp/api/v3/tasks/f1e654a4-4f64-4a18-8311-60827b8be13a/'}

In [21]: rpm_remote.read(rpm_rpm_remote_href='/pulp/api/v3/remotes/rpm/rpm/2ccbe163-75e5-4288-bd48-8ddca1e31fd8/')
Out[21]:
{'ca_cert': 'DuffCACert',
'client_cert': 'DuffClientCert',
'connect_timeout': None,
'download_concurrency': None,
'headers': None,
'name': 'TestRemote',
'policy': 'immediate',
'proxy_url': None,
'pulp_created': datetime.datetime(2021, 7, 11, 20, 35, 52, 825025, tzinfo=tzutc()),
'pulp_href': '/pulp/api/v3/remotes/rpm/rpm/2ccbe163-75e5-4288-bd48-8ddca1e31fd8/',
'pulp_labels': {},
'pulp_last_updated': datetime.datetime(2021, 7, 11, 20, 37, 1, 169677, tzinfo=tzutc()),
'rate_limit': None,
'sles_auth_token': None,
'sock_connect_timeout': None,
'sock_read_timeout': None,
'tls_validation': True,
'total_timeout': None,
'url': 'DuffURL'}

In [23]: rpm_remote.update(rpm_rpm_remote_href='/pulp/api/v3/remotes/rpm/rpm/2ccbe163-75e5-4288-bd48-8ddca1e31fd8/', rpm_rpm_remote=updated_remote_model2)
Out[23]: {'task': '/pulp/api/v3/tasks/956a90d6-91e5-4820-a6bf-2b7aed4bb0a8/'}

In [24]: rpm_remote.read(rpm_rpm_remote_href='/pulp/api/v3/remotes/rpm/rpm/2ccbe163-75e5-4288-bd48-8ddca1e31fd8/')
Out[24]:
{'ca_cert': 'DuffCACert2',
'client_cert': 'DuffClientCert2',
'connect_timeout': None,
'download_concurrency': None,
'headers': None,
'name': 'TestRemote',
'policy': 'immediate',
'proxy_url': None,
'pulp_created': datetime.datetime(2021, 7, 11, 20, 35, 52, 825025, tzinfo=tzutc()),
'pulp_href': '/pulp/api/v3/remotes/rpm/rpm/2ccbe163-75e5-4288-bd48-8ddca1e31fd8/',
'pulp_labels': {},
'pulp_last_updated': datetime.datetime(2021, 7, 11, 20, 43, 1, 910725, tzinfo=tzutc()),
'rate_limit': None,
'sles_auth_token': None,
'sock_connect_timeout': None,
'sock_read_timeout': None,
'tls_validation': True,
'total_timeout': None,
'url': 'DuffURL'}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rpm_remote.update and rpm_remote.read calls shown in the report, then trace how the remote update handles ca_cert, client_cert, and client_key values of None. Reproduce the create, update, and read sequence and consider the issue done when reading the remote shows those certificate fields unset after the update.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.