samrocketman / gitlab-mirrors

A set of scripts adding the ability of managing remote mirrors to GitLab.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gitlab3.exceptions.MissingRequiredAttribute

icyleaf opened this issue · comments

i using gitlab-mirrors to mirror github repo, it always throw exception during mirror https://github.com/AFNetworking/AFNetworking.git, other repo is ok

Traceback (most recent call last):
  File "lib/manage_gitlab_project.py", line 109, in <module>
    found_project=createproject(project_name)
  File "lib/manage_gitlab_project.py", line 95, in createproject
    new_project=git.add_project(pname,description=description,**project_options)
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 184, in fn
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 418, in _post
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 435, in _request
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 411, in _check_status_code
gitlab3.exceptions.MissingRequiredAttribute: URL: http://gitlab.dev/api/v3/projects, Data: {'wall_enabled': 'false', 'snippets_enabled': 'false', 'merge_requests_enabled': 'false', 'name': 'AFNetworking-AFNetworking', 'issues_enabled': 'false', 'wiki_enabled': 'false', 'public': 'true', 'description': 'Mirror of https://github.com/AFNetworking/AFNetworking.git'}

mirror github/mruby-ios using gitmirror is ok

Resolving gitlab remote.
Creating mirror from https://github.com/jzzocc/mruby-iOS.git
remote: Counting objects: 588, done.
remote: Total 588 (delta 0), reused 0 (delta 0), pack-reused 588
接收对象中: 100% (588/588), 20.69 MiB | 353 KiB/s, done.
处理 delta 中: 100% (268/268), done.
Adding gitlab remote to project.
Checking the mirror into gitlab.
Counting objects: 588, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (303/303), done.
Writing objects: 100% (588/588), 20.69 MiB | 19.32 MiB/s, done.
Total 588 (delta 268), reused 588 (delta 268)
To git@gitlab.dev:mirrors/jzzocc-mruby-ios.git
 * [new branch]      master -> master
 * [new tag]         0.0.1 -> 0.0.1
 * [new tag]         0.0.2 -> 0.0.2
 * [new tag]         0.1 -> 0.1
 * [new tag]         1.0.0 -> 1.0.0
 * [new tag]         1.1.0 -> 1.1.0

Gitlab: 7.8.1
Gitlab3: 0.5.4

Also seeing the same issue with version 7.8.0. Took a look and everything that is being POSTed to /projects seems correct according to the documentation. I will try and debug later today/tomorrow if time permits.

Edit: typo/spelling

@shampine thanks for offering to debug. At some point I'll try to open a VM and debug this as well. I currently don't run GitLab any longer but I still maintain this project for people who do.

Well thanks for maintaining @samrocketman -- it's a rad repo. I'm a fan. What I noticed happening in my quick session was:

  • run the git shell script
  • it fails with the error above
  • a repo IS created but under the users namespace, not the config namespace (default is Mirrors iirc)

What I'm leaning towards is that the parameters have slightly changed in these recent releases and the POST data needs to declare the namespace. I was in the API code poking through the endpoint in the controller but it seems like "name" is the only required data point still.

In recent releases they have changed the create project page and slimmed down input data, so I do think this is a fairly straightforward mismatch. If I find anything I'll open up a PR.

Cheers!

Ah yes, I've addressed this in #66 and opened an issue with alexvh/python-gitlab3#20.

Fantastic, I'll keep an eye on that issue as well.

I ran into this issue as well. As a work around you can just transfer the project from the user to the group.

It's useful,I transfer the namespace manually when I get this error,then add mirror again,succed.

This might be fixed in #78

Great works! but i test just now, this problem was still be there. i cloned and merged branch transfer_project via mojombo/github-flavored-markdown@febcfce , and run code again:

Resolving gitlab remote.
Traceback (most recent call last):
  File "lib/manage_gitlab_project.py", line 100, in <module>
    found_project = transfer_project(found_project, found_group)
  File "lib/manage_gitlab_project.py", line 53, in transfer_project
    value = group.transfer_project(src_project.id)
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 248, in fn
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 418, in _post
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 435, in _request
  File "build/bdist.linux-x86_64/egg/gitlab3/__init__.py", line 411, in _check_status_code
gitlab3.exceptions.MissingRequiredAttribute: URL: http://gitlab.dev/api/v3/groups/8/projects/113, Data: {}
There was an unknown issue with manage_gitlab_project.py

http://gitlab.dev/api/v3/groups/8/projects/113 api missed required attribute, not projects api above

yea, the transfer is broken in the gitlab api which needs to be fixed by gitlab not in this or the gitlab3 project.

roger, thanx

@logicminds So how do you make this work without transfer? It's creating by default in User namespace not Group namespace

Using 7.14.2 and still having issue?

The development branch of this project fixes the issue by creating the project in the desired namespace so that it doesn't need to transfer the project in the first place. So you will need to ensure the gitlab mirrors config points to your desired namespace. Also make sure you are using the development branch which contains the updated code. @cdenneen

@logicminds I'm using your module, which version does your module install?

It uses the master branch by default but it checks out from git directly. https://github.com/logicminds/gitlab_mirrors/blob/master/manifests/init.pp#L63

Just change the branch to 'development'

I did and now am getting a Forbidden error for a group which gitmirror user is the Owner of :(

gitlab3.exceptions.ForbiddenRequest: URL: https://gitlab.domain.loc/api/v3/groups/76/projects/143, Data: {}

@logicminds need new version pushed to forge since that param isn't available :(

@logicminds still with using your master branch same ForbiddenRequest error

Ill push the new version today with some fixes to the cron jobs as well.

So if your using the gitlab-mirrors development branch you will still experience this error if the project already exists in gitlab. Just remove the project from gitlab and under the mirrors directory so the mirrors scripts knows to create the project anew.

@logicminds hmm instead of deleting, what's keeping it from blowing up when it creates it? I'd rather just fix whatever that is then go through and delete all these ones i've manually done.

You would ha to just manually transfer the project.

@logicminds awesome it works. I have to agree development needs to get merged!

Just released v0.5.2 which is certified with GitLab 8.1.4. master reflects the latest stable release.