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

Add nested task subgroup to file repository #110

Merged
merged 2 commits into from
Mar 3, 2021

Conversation

mdellweg
Copy link
Member

@mdellweg mdellweg commented Feb 3, 2021

No description provided.

@daviddavis
Copy link
Contributor

Code lgtm. Is this waiting on a test?

@mdellweg
Copy link
Member Author

mdellweg commented Feb 9, 2021

Code lgtm. Is this waiting on a test?

I thought both a test as well as some more thought into design of the user facing command structure.

@mdellweg
Copy link
Member Author

mdellweg commented Feb 9, 2021

OK,i just realized, that it suffers from the interspersed parameter syndrom.
Need to change a few things to make this work. 😈

@daviddavis
Copy link
Contributor

I wonder if this pattern might be applicable to #132

@mdellweg
Copy link
Member Author

I wonder if this pattern might be applicable to #132

Maybe. We should follow a common design pattern here i think to keep the command structure consistent.

@mdellweg mdellweg force-pushed the resource_tasks branch 2 times, most recently from 48f60f0 to a732e35 Compare February 20, 2021 20:38
@mdellweg mdellweg marked this pull request as ready for review February 20, 2021 20:39
@@ -60,6 +70,9 @@ def repository(ctx: click.Context, pulp_ctx: PulpContext, repo_type: str) -> Non


lookup_options = [href_option, name_option]
nested_lookup_options = [
click.option("--repository", callback=_repository_callback, expose_value=False)
]
Copy link
Member Author

Choose a reason for hiding this comment

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

I am wondering, if this kind of lookup should be used for the version and label command groups too.

Copy link
Contributor

Choose a reason for hiding this comment

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

It might help to see some code. At least for labels, I can't visualize a benefit.

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is, that we cannot use --name and --href here because the TaskContext would ingest them.
So we are left with --repository and maybe --repository-href. For label it would be for the sake of consistency.

@mdellweg mdellweg added this to the 0.6.0 milestone Feb 22, 2021
@@ -32,6 +33,15 @@
_ = gettext.gettext


def _repository_callback(
ctx: click.Context, param: click.Parameter, value: Optional[str]
) -> Optional[Union[str, PulpEntityContext]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like it's simpler to use Union[str, PulpEntityContext, None] here. Also, I'm not sure how this would return a PulpEntityContext?

Copy link
Member Author

Choose a reason for hiding this comment

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

right!

@daviddavis
Copy link
Contributor

daviddavis commented Mar 3, 2021

Does this keep the lookup options on other label subcommands (e.g. pulp file remote label) the same? Is the goal to switch those up too eventually?

@mdellweg
Copy link
Member Author

mdellweg commented Mar 3, 2021

Does this keep the lookup options on other label subcommands (e.g. pulp file remote label) the same? Is the goal to switch those up too eventually?

Yes, in the end its meant to use the same structure everywhere.

@mdellweg mdellweg merged commit 1f1cc70 into pulp:develop Mar 3, 2021
@mdellweg mdellweg deleted the resource_tasks branch March 3, 2021 16:49
@mdellweg mdellweg modified the milestones: 0.6.0, 0.7.0 Mar 8, 2021
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.

2 participants