Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible FreeIPA
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Ansible FreeIPA
Commits
d1c3ecc9
Unverified
Commit
d1c3ecc9
authored
3 years ago
by
Thomas Woerner
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #658 from t-woerner/fix_galaxyfy_roles_after_vars
galaxyfy: Fix roles after vars
parents
be78368e
c92e9a5c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/galaxyfy.py
+16
-12
16 additions, 12 deletions
utils/galaxyfy.py
with
16 additions
and
12 deletions
utils/galaxyfy.py
+
16
−
12
View file @
d1c3ecc9
...
@@ -24,8 +24,8 @@ import re
...
@@ -24,8 +24,8 @@ import re
def
galaxyfy_playbook
(
project_prefix
,
collection_prefix
,
lines
):
def
galaxyfy_playbook
(
project_prefix
,
collection_prefix
,
lines
):
p1
=
re
.
compile
(
'
(%s.*:)$
'
%
project_prefix
)
p
o
1
=
re
.
compile
(
'
(%s.*:)$
'
%
project_prefix
)
p2
=
re
.
compile
(
'
(.*:) (%s.*)$
'
%
project_prefix
)
p
o
2
=
re
.
compile
(
'
(.*:) (%s.*)$
'
%
project_prefix
)
out_lines
=
[]
out_lines
=
[]
pattern1
=
r
'
%s.\1
'
%
collection_prefix
pattern1
=
r
'
%s.\1
'
%
collection_prefix
...
@@ -35,30 +35,34 @@ def galaxyfy_playbook(project_prefix, collection_prefix, lines):
...
@@ -35,30 +35,34 @@ def galaxyfy_playbook(project_prefix, collection_prefix, lines):
changeable
=
False
changeable
=
False
include_role
=
False
include_role
=
False
for
line
in
lines
:
for
line
in
lines
:
stripped
=
line
.
strip
()
line
=
line
.
rstrip
()
stripped
=
line
.
lstrip
()
if
stripped
.
startswith
(
"
- name:
"
)
or
\
if
stripped
.
startswith
(
"
- name:
"
)
or
\
stripped
.
startswith
(
"
- block:
"
):
stripped
.
startswith
(
"
- block:
"
):
changeable
=
True
changeable
=
True
elif
stripped
in
[
"
set_fact:
"
,
"
vars:
"
]:
elif
stripped
in
[
"
set_fact:
"
,
"
vars:
"
]:
changeable
=
False
changeable
=
False
include_role
=
False
include_role
=
False
elif
stripped
==
"
roles:
"
:
changeable
=
True
include_role
=
False
elif
stripped
.
startswith
(
"
include_role:
"
):
elif
stripped
.
startswith
(
"
include_role:
"
):
include_role
=
True
include_role
=
True
elif
include_role
and
stripped
.
startswith
(
"
name:
"
):
elif
include_role
and
stripped
.
startswith
(
"
name:
"
):
line
=
p2
.
sub
(
pattern2
,
line
)
line
=
p
o
2
.
sub
(
pattern2
,
line
)
changed
=
True
changed
=
True
elif
changeable
and
stripped
.
startswith
(
"
- role:
"
):
elif
changeable
and
stripped
.
startswith
(
"
- role:
"
):
line
=
p2
.
sub
(
pattern2
,
line
)
line
=
p
o
2
.
sub
(
pattern2
,
line
)
changed
=
True
changed
=
True
elif
(
changeable
and
stripped
.
startswith
(
project_prefix
)
and
elif
(
changeable
and
stripped
.
startswith
(
project_prefix
)
not
stripped
.
startswith
(
collection_prefix
)
and
and
not
stripped
.
startswith
(
collection_prefix
)
# noqa
stripped
.
endswith
(
"
:
"
)):
and
stripped
.
endswith
(
"
:
"
)):
# noqa
line
=
p1
.
sub
(
pattern1
,
line
)
line
=
p
o
1
.
sub
(
pattern1
,
line
)
changed
=
True
changed
=
True
changeable
=
False
# Only change first line in task
changeable
=
False
# Only change first line in task
elif
(
stripped
.
startswith
(
"
- %s
"
%
project_prefix
)
and
elif
(
stripped
.
startswith
(
"
- %s
"
%
project_prefix
)
stripped
.
endswith
(
"
:
"
)):
and
stripped
.
endswith
(
"
:
"
)):
# noqa
line
=
p1
.
sub
(
pattern1
,
line
)
line
=
p
o
1
.
sub
(
pattern1
,
line
)
changed
=
True
changed
=
True
out_lines
.
append
(
line
)
out_lines
.
append
(
line
)
...
...
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