Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Plugins
gitlab
Commits
a8d4485e
Commit
a8d4485e
authored
7 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Fix gitlab issue to work with API v4
parent
723e01d1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gitlab_issue.py
+7
-6
7 additions, 6 deletions
gitlab_issue.py
with
7 additions
and
6 deletions
gitlab_issue.py
+
7
−
6
View file @
a8d4485e
...
...
@@ -30,8 +30,8 @@ class GitLabProject(object):
project
=
self
.
_gitlab
.
projects
.
get
(
'
%s/%s
'
%
(
self
.
namespace
,
project_name
))
if
project
:
namespace
=
project
.
namespace
if
namespace
.
id
==
self
.
nid
:
if
(
not
self
.
is_user
and
not
hasattr
(
namespace
,
'
owner_id
'
))
or
(
self
.
is_user
and
hasattr
(
namespace
,
'
owner_id
'
)
):
if
namespace
[
'
id
'
]
==
self
.
nid
:
if
(
not
self
.
is_user
and
'
user_id
'
not
in
namespace
)
or
(
self
.
is_user
and
'
user_id
'
in
namespace
):
if
project
.
name
.
lower
()
==
project_name
or
project
.
path
.
lower
()
==
project_name
:
self
.
pid
=
project
.
id
self
.
project
=
project
...
...
@@ -187,7 +187,7 @@ def main():
return
# Validate if project exists and get its ID
project
=
GitLabProject
(
module
,
git
)
project
=
GitLabProject
(
module
,
git
)
# type: gitlab.Project
project_exists
=
project
.
exists
(
group_name
,
project_name
)
if
not
project_exists
:
module
.
fail_json
(
msg
=
"
Gitlab project does not exist
"
)
...
...
@@ -214,11 +214,12 @@ def main():
issues
=
project
.
findIssues
(
title
)
updated
=
0
if
issues
:
issue
=
None
# type: gitlab.ProjectIssue
for
issue
in
issues
:
if
issue
.
title
.
find
(
title
)
==
0
:
updated
+=
1
if
description
:
git
.
project_
issue
_
notes
.
create
({
'
body
'
:
description
}
,
project_id
=
project
.
pid
,
issue_id
=
issue
.
id
)
issue
.
notes
.
create
({
'
body
'
:
description
})
if
assignee_id
:
issue
.
assignee_id
=
assignee_id
if
milestone_id
:
...
...
@@ -243,7 +244,7 @@ def main():
"
confidential
"
:
confidential
,
"
assignee_id
"
:
assignee_id
,
"
milestone_id
"
:
milestone_id
,
"
labels
"
:
'
,
'
.
join
(
labels
)
"
labels
"
:
labels
}
# Create issue and retry up to 3 times if that fails
...
...
@@ -255,7 +256,7 @@ def main():
time
.
sleep
(
delay
)
delay
*=
2
try
:
issue
=
git
.
project
_
issues
.
create
(
arguments
,
project_id
=
project
.
pid
)
issue
=
project
.
issues
.
create
(
arguments
)
# type: gitlab.Issue
except
Exception
,
e
:
pass
if
issue
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment