Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
bee1f8f4
Commit
bee1f8f4
authored
Sep 02, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8788 from eest/service-service_enable_rcconf-changed
service: use self.changed in service_enable_rcconf().
parents
570425d3
e65ca687
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
library/system/service
+6
-6
No files found.
library/system/service
View file @
bee1f8f4
...
@@ -317,7 +317,7 @@ class Service(object):
...
@@ -317,7 +317,7 @@ class Service(object):
if
self
.
rcconf_file
is
None
or
self
.
rcconf_key
is
None
or
self
.
rcconf_value
is
None
:
if
self
.
rcconf_file
is
None
or
self
.
rcconf_key
is
None
or
self
.
rcconf_value
is
None
:
self
.
module
.
fail_json
(
msg
=
"service_enable_rcconf() requires rcconf_file, rcconf_key and rcconf_value"
)
self
.
module
.
fail_json
(
msg
=
"service_enable_rcconf() requires rcconf_file, rcconf_key and rcconf_value"
)
changed
=
None
self
.
changed
=
None
entry
=
'
%
s="
%
s"
\n
'
%
(
self
.
rcconf_key
,
self
.
rcconf_value
)
entry
=
'
%
s="
%
s"
\n
'
%
(
self
.
rcconf_key
,
self
.
rcconf_value
)
RCFILE
=
open
(
self
.
rcconf_file
,
"r"
)
RCFILE
=
open
(
self
.
rcconf_file
,
"r"
)
new_rc_conf
=
[]
new_rc_conf
=
[]
...
@@ -331,12 +331,12 @@ class Service(object):
...
@@ -331,12 +331,12 @@ class Service(object):
if
key
==
self
.
rcconf_key
:
if
key
==
self
.
rcconf_key
:
if
value
.
upper
()
==
self
.
rcconf_value
:
if
value
.
upper
()
==
self
.
rcconf_value
:
# Since the proper entry already exists we can stop iterating.
# Since the proper entry already exists we can stop iterating.
changed
=
False
self
.
changed
=
False
break
break
else
:
else
:
# We found the key but the value is wrong, replace with new entry.
# We found the key but the value is wrong, replace with new entry.
rcline
=
entry
rcline
=
entry
changed
=
True
self
.
changed
=
True
# Add line to the list.
# Add line to the list.
new_rc_conf
.
append
(
rcline
)
new_rc_conf
.
append
(
rcline
)
...
@@ -345,11 +345,11 @@ class Service(object):
...
@@ -345,11 +345,11 @@ class Service(object):
RCFILE
.
close
()
RCFILE
.
close
()
# If we did not see any trace of our entry we need to add it.
# If we did not see any trace of our entry we need to add it.
if
changed
is
None
:
if
self
.
changed
is
None
:
new_rc_conf
.
append
(
entry
)
new_rc_conf
.
append
(
entry
)
changed
=
True
self
.
changed
=
True
if
changed
is
True
:
if
self
.
changed
is
True
:
if
self
.
module
.
check_mode
:
if
self
.
module
.
check_mode
:
self
.
module
.
exit_json
(
changed
=
True
,
msg
=
"changing service enablement"
)
self
.
module
.
exit_json
(
changed
=
True
,
msg
=
"changing service enablement"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment