Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ansible
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
Nounous
Ansible
Merge requests
!143
Clean up
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Clean up
clean-up
into
newinfra
Overview
0
Commits
10
Changes
11
Merged
Maxime Bombar
requested to merge
clean-up
into
newinfra
4 years ago
Overview
0
Commits
10
Changes
3
Expand
👍
0
👎
0
Merge request reports
Viewing commit
14b35312
Prev
Next
Show latest version
3 files
+
24
−
167
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
14b35312
Pumped up MoinMoin gendoc
· 14b35312
Maxime Bombar
authored
4 years ago
action_plugins/moinmoin_page.py
+
22
−
26
Options
@@ -81,7 +81,7 @@ class ActionModule(ActionBase):
search
=
re
.
search
(
'
name=
\"
ticket
\"
value=
\"
([^
\"
]*)
\"
'
,
content
)
if
not
search
:
raise
AnsibleError
(
to_native
(
'
no edit ticket was found
'
))
return
search
.
group
(
1
)
@@ -132,12 +132,10 @@ class ActionModule(ActionBase):
if
task_vars
is
None
:
task_vars
=
dict
()
result
=
super
(
ActionModule
,
self
).
run
(
tmp
,
task_vars
)
del
tmp
result
[
'
changed
'
]
=
False
url
=
self
.
_task
.
args
.
get
(
"
url
"
)
user
=
self
.
_task
.
args
.
get
(
"
user
"
)
@@ -147,34 +145,32 @@ class ActionModule(ActionBase):
cookie
=
self
.
login
(
url
,
user
,
password
)
changed
=
False
try
:
raw
=
self
.
craft_request
(
"
?action=raw
"
)(
url
,
cookie
)
if
raw
!=
content
:
changed
=
True
except
urllib
.
error
.
HTTPError
:
# We will create the page.
changed
=
True
raw
=
""
diff
=
difflib
.
unified_diff
(
raw
.
splitlines
(),
content
.
splitlines
(),
fromfile
=
"
old
"
,
tofile
=
"
new
"
,
lineterm
=
""
)
i
=
0
# Display any change
if
changed
:
diff
=
difflib
.
unified_diff
(
raw
.
splitlines
(),
content
.
splitlines
(),
fromfile
=
"
old
"
,
tofile
=
"
new
"
,
lineterm
=
""
)
f
or
line
in
diff
:
if
line
.
startswith
(
"
-
"
)
:
display
.
display
(
line
,
"
red
"
)
elif
line
.
startswith
(
"
+
"
)
:
display
.
display
(
line
,
"
green
"
)
elif
line
.
startswith
(
"
@
"
)
:
display
.
display
(
line
,
"
yellow
"
)
else
:
display
.
display
(
line
)
# Do apply the change if not in
check
mode
if
not
self
.
_play_context
.
check_mode
:
self
.
edit
(
url
,
user
,
password
,
content
,
revision_comment
,
cookie
)
for
line
in
diff
:
i
+=
1
i
f
line
.
startswith
(
"
-
"
)
:
display
.
display
(
line
,
"
red
"
)
elif
line
.
startswith
(
"
+
"
)
:
display
.
display
(
line
,
"
green
"
)
elif
line
.
startswith
(
"
@
"
)
:
display
.
display
(
line
,
"
yellow
"
)
else
:
display
.
display
(
line
)
# Do apply the change if not in check mode
if
not
self
.
_play_context
.
check
_
mode
:
self
.
edit
(
url
,
user
,
password
,
content
,
revision_comment
,
cookie
)
result
[
'
changed
'
]
=
i
>
0
self
.
_supports_check_mode
=
True
self
.
_supports_async
=
False
Loading