Skip to content

feat: add create from template args to ProjectManager #1053

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

Merged
merged 1 commit into from
Mar 23, 2020

Conversation

lassimus
Copy link
Contributor

This commit adds the v4 Create project attributes necessary to create a
project from a project, instance, or group level template as documented
in https://docs.gitlab.com/ee/api/projects.html#create-project

This commit adds the v4 Create project attributes necessary to create a
project from a project, instance, or group level template as documented
in https://docs.gitlab.com/ee/api/projects.html#create-project
Copy link
Member

@nejch nejch left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! It looks like there are a lot of missing optional attributes, since they can be supplied in **kwargs.

Just a minor comment, but I'll let @max-wittig decide if it's really needed. It might make sense to add these in here as well for consistency:

class UserProjectManager(ListMixin, CreateMixin, RESTManager):
_path = "/projects/user/%(user_id)s"
_obj_cls = UserProject
_from_parent_attrs = {"user_id": "id"}
_create_attrs = (
("name",),
(
"default_branch",
"issues_enabled",
"wall_enabled",
"merge_requests_enabled",
"wiki_enabled",
"snippets_enabled",
"public",
"visibility",
"description",
"builds_enabled",
"public_builds",
"import_url",
"only_allow_merge_if_build_succeeds",
),

(although the GitLab docs are a bit inconsistent there, I think the same 4 attributes apply, but some of these are EE features, so hard to test)

@nejch nejch requested a review from max-wittig March 21, 2020 16:53
@lassimus
Copy link
Contributor Author

**kwargs is useful when you're using the library, but if the optional attributes aren't added, they aren't usable in the cli.

I'm currently using the cli for chatops ci jobs, as it's much less maintenance than a purpose-built script that uses the library. I know you guys have talked about removing the cli completely, so I understand if you don't want to accept the PR for those reasons.

If you accept this PR, I'm certainly open to contributing more api updates.

@nejch
Copy link
Member

nejch commented Mar 23, 2020

**kwargs is useful when you're using the library, but if the optional attributes aren't added, they aren't usable in the cli.

I'm currently using the cli for chatops ci jobs, as it's much less maintenance than a purpose-built script that uses the library. I know you guys have talked about removing the cli completely, so I understand if you don't want to accept the PR for those reasons.

If you accept this PR, I'm certainly open to contributing more api updates.

Ah I might have worded that strangely, it was a general comment that we have some catching up to do across the entire library to match the current GitLab API attributes ;) Sorry if that came out wrong!

That's a good point about CLI usage as well, thanks. We should probably review all the missing attributes and add more as a follow-up to this PR.

@nejch nejch merged commit c5904c4 into python-gitlab:master Mar 23, 2020
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