gitlab3.exceptions.UnauthorizedRequest
Norcoen opened this issue · comments
Im getting the following error after setting everything up and trying to create my first mirror:
$ ./add_mirror.sh --git --project-name github-gitlab-mirrors --mirror https://github.com/samrocketman/gitlab-mirrors.git
Resolving gitlab remote.
/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:732: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html (This warning will only appear once by default.)
InsecureRequestWarning)
Traceback (most recent call last):
File "lib/manage_gitlab_project.py", line 105, in <module>
found_group=findgroup(gitlab_namespace)
File "lib/manage_gitlab_project.py", line 54, in findgroup
while len(git.groups(page=page)) > 0:
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 76, in fn
objs = parent._get(api._uq_url, data=data)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 415, in _get
return self._request(requests.get, api_url, addl_keys, data)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 435, in _request
self._check_status_code(r.status_code, url, data)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 411, in _check_status_code
raise self._code_to_exc[status_code](msg)
gitlab3.exceptions.UnauthorizedRequest: URL: https://gitlab.***.de/api/v3/groups, Data: {'page': 1}
There was an unknown issue with manage_gitlab_project.py
I'm pretty sure I did everything the way the manual told me, so I have no clue what could be wrong.
Things I already checked:
- gitmirror is administrator in gitlab
- gitmirror is owner of group "Mirrors"
- SSH Key is working
- ssl_verify=false is set to "false" in config.sh, I use a self-signed certificate
- private_token containts the private_key, no password used
- file and folder permissions are all set to gitmirror:gitmirror with standard levels of access
- gitlab is able to reach github, I can already clone projects from github using Import/Omniauth
Kind regards,
Frank
Looks like I was confused over the file private_token
, I had my private key copied there.
Using the API-Token from the gitmirror account I'm now getting an other error:
$ ./add_mirror.sh --git --project-name github-gitlab-mirrors --mirror https://github.com/samrocketman/gitlab-mirrors.git
Resolving gitlab remote.
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
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 98, in createproject
new_project=git.group(found_group.id).transfer_project(new_project.id)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 248, in fn
return req_fn(_self, url, addl_keys=arg_keys, data=kwargs)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 418, in _post
return self._request(requests.post, api_url, addl_keys, data)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 435, in _request
self._check_status_code(r.status_code, url, data)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 411, in _check_status_code
raise self._code_to_exc[status_code](msg)
gitlab3.exceptions.MissingRequiredAttribute: URL: https://gitlab.***.de/api/v3/groups/5/projects/21, Data: {}
There was an unknown issue with manage_gitlab_project.py
and when I try again (I guess because some things where already created previously):
$ ./add_mirror.sh --git --project-name github-gitlab-mirrors --mirror https://github.com/samrocketman/gitlab-mirrors.git
Resolving gitlab remote.
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
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 "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 184, in fn
data = parent._post(api._uq_url, data=kwargs)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 418, in _post
return self._request(requests.post, api_url, addl_keys, data)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 435, in _request
self._check_status_code(r.status_code, url, data)
File "/usr/local/lib/python2.7/dist-packages/gitlab3/__init__.py", line 411, in _check_status_code
raise self._code_to_exc[status_code](msg)
gitlab3.exceptions.MissingRequiredAttribute: URL: https://gitlab.***.de/api/v3/projects, Data: {'wall_enabled': 'true', 'snippets_enabled': 'true', 'merge_requests_enabled': 'false', 'name': 'github-gitlab-mirrors', 'issues_enabled': 'true', 'wiki_enabled': 'true', 'public': 'false', 'description': 'Mirror of https://github.com/samrocketman/gitlab-mirrors.git'}
There was an unknown issue with manage_gitlab_project.py
Try using the development branch. Check to see if the project was created under gitmirrors user. If so then it's likely because of the error in the master branch. Should be fixed in development.
Also, what version of GitLab are you using?
Works like a charm now! Thank you!
I was hoping it would copy Issues, too. Isn't that possible?
I'm trying to keep track of libraries im using. It's rare, but some have vanished so I'd like to not only keep the latest code revisions but also the known problems safe on my own server.
Kind regards,
Frank
$ ./add_mirror.sh --git --project-name github-gitlab-mirrors --mirror https://github.com/samrocketman/gitlab-mirrors.git
Resolving gitlab remote.
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
Creating new project github-gitlab-mirrors
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
Creating mirror from https://github.com/samrocketman/gitlab-mirrors.git
Cloning into bare repository 'github-gitlab-mirrors'...
remote: Counting objects: 1100, done.
remote: Total 1100 (delta 0), reused 0 (delta 0), pack-reused 1099
Receiving objects: 100% (1100/1100), 196.90 KiB | 0 bytes/s, done.
Resolving deltas: 100% (575/575), done.
Checking connectivity... done.
Adding gitlab remote to project.
Checking the mirror into gitlab.
Counting objects: 1086, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (474/474), done.
Writing objects: 100% (1086/1086), 195.11 KiB | 0 bytes/s, done.
Total 1086 (delta 568), reused 1086 (delta 568)
To git@gitlab.***.de:Mirrors/github-gitlab-mirrors.git
* [new branch] development -> development
* [new branch] master -> master
* [new tag] v0.1 -> v0.1
* [new tag] v0.1.1 -> v0.1.1
* [new tag] v0.2 -> v0.2
* [new tag] v0.2.1 -> v0.2.1
* [new tag] v0.2.10 -> v0.2.10
* [new tag] v0.2.2 -> v0.2.2
* [new tag] v0.2.3 -> v0.2.3
* [new tag] v0.2.4 -> v0.2.4
* [new tag] v0.2.5 -> v0.2.5
* [new tag] v0.2.6 -> v0.2.6
* [new tag] v0.2.7 -> v0.2.7
* [new tag] v0.2.8 -> v0.2.8
* [new tag] v0.2.9 -> v0.2.9
* [new tag] v0.3.0 -> v0.3.0
* [new tag] v0.3.1 -> v0.3.1
* [new tag] v0.4.0 -> v0.4.0
* [new tag] v0.4.1 -> v0.4.1
* [new tag] v0.4.2 -> v0.4.2
* [new tag] v0.4.3 -> v0.4.3
* [new tag] v0.4.4 -> v0.4.4
* [new tag] v0.4.5 -> v0.4.5
* [new tag] v0.4.6 -> v0.4.6
* [new tag] v0.4.7 -> v0.4.7
* [new tag] v0.4.8 -> v0.4.8
* [new tag] v0.4.9 -> v0.4.9
* [new tag] v0.5.0 -> v0.5.0
* [new tag] v0.5.1 -> v0.5.1
All done!
Issue copying is not possible via git. It would require one to make more extensive use of the API.
What version of gitlab did you use it with?
I'm using GitLab 7.12.2 30bffd5 from the Omnibus Package on a Debian 8 VM
Issue coping might be possible if you import the project from the gitlab ui although I have not tried. This project does not make use of the import feature though because its still very new.