Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix '--signing-service' option not allowing HREF #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tjmullicani
Copy link

fixes #38

@quba42 quba42 requested a review from hstct November 29, 2022 13:14
@quba42
Copy link
Collaborator

quba42 commented Nov 29, 2022

@hstct If you can find the time to test this locally, I am fine with merging it as is.

CHANGES/38.bugfix Outdated Show resolved Hide resolved
@quba42
Copy link
Collaborator

quba42 commented Jan 26, 2023

Now that the tests in main branch have been fixed, this should be rebased on top of latest main branch, squished into a single commit.

Normally I would also say we should add a test for the new option, but given we do not yet have any test involving signing service creation, I think this would be a bit much to ask. Instead, I have opened a new issue: #46

Copy link
Collaborator

@quba42 quba42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I test this locally (rebased on to latest main branch) I get the following error:

$ pulp deb publication create --simple --structured --repository=test --signing-service=/pulp/api/v3/signing-services/6be8b4c9-a87a-419c-8b44-95634c0843e1/
Traceback (most recent call last):
  File "/home/quirin/.virtualenvs/pulp_cli/bin/pulp", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/quirin/.virtualenvs/pulp_cli/lib/python3.11/site-packages/pulp_cli/__init__.py", line 31, in main
    load_plugins()
  File "/home/quirin/.virtualenvs/pulp_cli/lib/python3.11/site-packages/pulp_cli/__init__.py", line 17, in load_plugins
    discovered_plugins: Dict[str, ModuleType] = {
                                                ^
  File "/home/quirin/.virtualenvs/pulp_cli/lib/python3.11/site-packages/pulp_cli/__init__.py", line 18, in <dictcomp>
    entry_point.name: entry_point.load()
                      ^^^^^^^^^^^^^^^^^^
  File "/home/quirin/.virtualenvs/pulp_cli/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2468, in load
    return self.resolve()
           ^^^^^^^^^^^^^^
  File "/home/quirin/.virtualenvs/pulp_cli/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2474, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/quirin/.virtualenvs/pulp_cli/lib/python3.11/site-packages/pulpcore/cli/deb/__init__.py", line 6, in <module>
    from pulpcore.cli.deb.publication import publication
  File "/home/quirin/.virtualenvs/pulp_cli/lib/python3.11/site-packages/pulpcore/cli/deb/publication.py", line 76, in <module>
    href_pattern=PulpSigningServiceContext.HREF_PATTERN,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'PulpSigningServiceContext' has no attribute 'HREF_PATTERN'

Am I doing something wrong, or is the change missing something?

@mdellweg
Copy link
Member

mdellweg commented Mar 9, 2023

More disturbing is the question why the ci workflows did not run.

@mdellweg
Copy link
Member

mdellweg commented Mar 9, 2023

https://github.com/pulp/pulp-cli/blob/main/pulp-glue/pulp_glue/core/context.py#L341 I don't see that PulpSigningServiceContext ever had an HREF_PATTERN.

@tjmullicani
Copy link
Author

tjmullicani commented Mar 9, 2023

https://github.com/pulp/pulp-cli/blob/main/pulp-glue/pulp_glue/core/context.py#L341 I don't see that PulpSigningServiceContext ever had an HREF_PATTERN.

@mdellweg @quba42 I originally added it as part of https://github.com/pulp/pulp-cli/pull/560/files (before glue library was split out)

@tjmullicani
Copy link
Author

Created a new pull request for pulp-cli pulp/pulp-cli#652

@quba42
Copy link
Collaborator

quba42 commented Mar 13, 2023

@tjmullicani Ok, I can have another go at testing this using both PR's. Not sure if I will find the time today, though.

hstct
hstct previously approved these changes Mar 15, 2023
Copy link
Contributor

@hstct hstct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it by adding an href during publication creation and it does work.

LGTM

@@ -73,6 +73,7 @@ def publication(ctx: click.Context, pulp_ctx: PulpCLIContext, publication_type:
default_plugin="deb",
default_type="apt",
context_table={"deb:apt": PulpSigningServiceContext},
href_pattern=PulpSigningServiceContext.HREF_PATTERN,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this change is not yet released with pulp-cli, there's a question: Are we ready to bump the minimal required version here already (not until there is a release, i guess), or do we want to fudge the value here for a while with a comment to revert to this final variant once the minimal reqs allow?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tjmullicani Can you rebase this branch to latest main branch, and then adjust the following line:
https://github.com/pulp/pulp-cli-deb/blob/main/setup.py#L30
to use "pulp-cli>=0.19.0"?

@mdellweg That is what we need to do here, right? And then we can merge once pulp-cli 0.19.0 has been released?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would work.
Alternatively, something like getattr(PulpSigningServiceContext, "HREF_PATTERN", "/signing_service/") until we really bump that dependency. I just fear that kind of a workaround would possibly be forgotten to remove eventually.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix '--signing-service' option not allowing HREF
4 participants