Skip to content

import_project with override_params #552

Closed
@jgeorgeson

Description

@jgeorgeson

Description of the problem, including code/CLI snippet

I'm trying to set private visibility on the imported project, and GitLab is returning a 400 error that my override_params are invalid.

        import_params={}
        import_params['visibility'] = 'private'
        gl.projects.import_project(
            open(filename, 'rb'),
            project,
            namespace=group,
            override_params=import_params
        )

I also tried with defining the dictionary as import_params = {'visibility': 'private'} and also supplying the dictionary inline (ie without the import_params object).

I had some trouble getting the API to work with curl, but was able to accomplish it with this syntax --form "override_params[visibility]=private".

I was hoping to run the CLI version in debug mode to see what request is being made, but it looks like the is no CLI exposed for this method.

Expected Behavior

Project is imported with private visibility

Actual Behavior

Traceback (most recent call last):
  File "./main.py", line 80, in import_project
    'visibility': 'private'
  File "/usr/local/lib/python3.6/site-packages/gitlab/v4/objects.py", line 3612, in import_project
    files=files, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/gitlab/__init__.py", line 589, in http_post
    post_data=post_data, files=files, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/gitlab/__init__.py", line 495, in http_request
    response_body=result.content)
gitlab.exceptions.GitlabHttpError: 400: b'{"error":"override_params is invalid"}'

Specifications

  • python-gitlab version: 1.5.1
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 10.7.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions