Skip to content

Commit

Permalink
Merge pull request #5 from sdelements/add/verify_creds_on_init
Browse files Browse the repository at this point in the history
Add step in client init to check for creds
  • Loading branch information
ajixuan authored May 7, 2020
2 parents ae45c1e + d9c28e1 commit fb8b096
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pubtools/pulplib/_impl/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ def __init__(self, url, **kwargs):
.with_retry(retry_policy=self._RETRY_POLICY)
)

# run an initial auth request to validate url and credentials
# failed response status will raise exception
url = os.path.join(self._url, "pulp/api/v2/actions/login/")
response = self._do_request(method="POST", url=url, json={})
response.raise_for_status()

def get_repository(self, repository_id):
"""Get a repository by ID.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_requirements():

setup(
name="pubtools-pulplib",
version="2.6.1",
version="2.6.2",
packages=find_packages(exclude=["tests"]),
package_data={"pubtools.pulplib._impl.schema": ["*.yaml"]},
url="https://github.com/release-engineering/pubtools-pulplib",
Expand Down

0 comments on commit fb8b096

Please sign in to comment.