-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed Unmanage flow - incorporated review comments
tendrl-bug-id: #841 Signed-off-by: Anmol Sachan <anmol13694@gmail.com>
- Loading branch information
1 parent
377ed71
commit ae376ce
Showing
6 changed files
with
169 additions
and
201 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
""" This utility can be used to handle(start, stop, etc.) tendrl services. | ||
""" | ||
|
||
from tendrl.commons.utils import cmd_utils | ||
from tendrl.commons.utils import log_utils as logger | ||
|
||
|
||
def stop_service(services, params): | ||
for service in services: | ||
srv = NS.tendrl.objects.Service(service=service) | ||
if not srv.running: | ||
logger.log( | ||
"debug", | ||
NS.publisher_id, | ||
{ | ||
"message": "%s not running on " | ||
"%s" % (service, NS.node_context.fqdn) | ||
}, | ||
job_id=params['job_id'], | ||
flow_id=params['flow_id'], | ||
) | ||
continue | ||
|
||
_cmd_str = "systemctl stop %s" % service | ||
cmd = cmd_utils.Command(_cmd_str) | ||
err, out, rc = cmd.run() | ||
if err: | ||
logger.log( | ||
"error", | ||
NS.publisher_id, | ||
{ | ||
"message": "Could not stop %s" | ||
" service. Error: %s" % (service, err) | ||
}, | ||
job_id=params['job_id'], | ||
flow_id=params['flow_id'], | ||
) | ||
return False | ||
|
||
_cmd_str = "systemctl disable %s" % service | ||
cmd = cmd_utils.Command(_cmd_str) | ||
err, out, rc = cmd.run() | ||
if err: | ||
logger.log( | ||
"error", | ||
NS.publisher_id, | ||
{ | ||
"message": "Could not disable %s" | ||
" service. Error: %s" % (service, err) | ||
}, | ||
job_id=params['job_id'], | ||
flow_id=params['flow_id'], | ||
) | ||
return False | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.