Skip to content

Commit

Permalink
module: perp
Browse files Browse the repository at this point in the history
 Fixing CI error "E107 Imports should be directly below
DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA".

Signed-off-by: Dimitar Ianakiev <dimitar.q@siteground.com>
  • Loading branch information
dimitarq committed May 11, 2018
1 parent d12cfc3 commit 9449f98
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/ansible/modules/system/perp.py
Expand Up @@ -25,9 +25,6 @@
'status': ['stableinterface'],
'supported_by': 'community'}


# This is a modification of @bcoca's `svc` module

DOCUMENTATION = '''
---
module: perp
Expand Down Expand Up @@ -96,8 +93,7 @@
sample: started
'''

import re

from re import search
from ansible.module_utils.basic import AnsibleModule


Expand Down Expand Up @@ -130,17 +126,17 @@ def get_status(self):
else:
self.full_state = out

m = re.search(r'main.*\(pid (\d+)\)', out)
m = search(r'main.*\(pid (\d+)\)', out)
if m:
self.pid = m.group(1)

m = re.search(r': activated (\d+)s', out)
m = search(r': activated (\d+)s', out)
if m:
self.duration = m.group(1)

if re.search(r': activated', out):
if search(r': activated', out):
self.state = 'started'
elif re.search(r'not activated', out):
elif search(r'not activated', out):
self.state = 'stopped'
else:
self.state = 'unknown'
Expand Down

0 comments on commit 9449f98

Please sign in to comment.