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
0b600fd2
Commit
0b600fd2
authored
6 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Manage devop issues in host specific inventories not in company specific ones
parent
8a0adde5
No related branches found
Branches containing commit
Tags
v0.1.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gitlab_issue.py
+14
-2
14 additions, 2 deletions
gitlab_issue.py
with
14 additions
and
2 deletions
gitlab_issue.py
+
14
−
2
View file @
0b600fd2
...
...
@@ -23,10 +23,18 @@ class GitLabProject(object):
self
.
_module
=
module
self
.
_gitlab
=
git
def
exists
(
self
,
group_name
,
project_name
):
def
exists
(
self
,
group_name
,
project_name
,
host_name
):
if
not
self
.
findNamespace
(
group_name
):
return
False
if
host_name
:
projects
=
self
.
_gitlab
.
projects
.
list
(
search
=
host_name
)
if
len
(
projects
)
==
1
:
project
=
projects
[
0
]
self
.
pid
=
project
.
id
self
.
project
=
project
return
True
project
=
self
.
_gitlab
.
projects
.
get
(
'
%s/%s
'
%
(
self
.
namespace
,
project_name
))
if
project
:
namespace
=
project
.
namespace
...
...
@@ -127,6 +135,7 @@ def main():
login_token
=
dict
(
required
=
False
,
no_log
=
True
),
group
=
dict
(
required
=
False
),
name
=
dict
(
required
=
True
),
hostname
=
dict
(
required
=
False
),
title
=
dict
(
required
=
True
),
append_timestamp
=
dict
(
required
=
False
,
default
=
False
,
type
=
'
bool
'
),
description
=
dict
(
required
=
False
),
...
...
@@ -150,6 +159,7 @@ def main():
login_token
=
module
.
params
[
'
login_token
'
]
group_name
=
module
.
params
[
'
group
'
]
project_name
=
module
.
params
[
'
name
'
]
host_name
=
module
.
params
[
'
hostname
'
]
title
=
module
.
params
[
'
title
'
]
append_timestamp
=
module
.
params
[
'
append_timestamp
'
]
description
=
module
.
params
[
'
description
'
]
...
...
@@ -173,6 +183,8 @@ def main():
project_name
=
project_name
.
lower
()
if
group_name
is
not
None
:
group_name
=
group_name
.
lower
()
if
host_name
is
not
None
:
host_name
=
host_name
.
lower
()
# Lets make an connection to the Gitlab server_url, with either login_user and login_password
# or with login_token
...
...
@@ -188,7 +200,7 @@ def main():
# Validate if project exists and get its ID
metaProject
=
GitLabProject
(
module
,
git
)
# type: GitLabProject
project_exists
=
metaProject
.
exists
(
group_name
,
project_name
)
project_exists
=
metaProject
.
exists
(
group_name
,
project_name
,
host_name
)
if
not
project_exists
:
module
.
fail_json
(
msg
=
"
Gitlab project does not exist
"
)
...
...
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