#!/usr/bin/env python

import re
import sys
import os
import platform
import subprocess

distro = platform.linux_distribution()[0]

args = {'act': sys.argv[1], 'service': sys.argv[2]}

if re.search(distro, 'Ubuntu'):
    if os.path.isfile("/etc/init/%s.conf" % args['service']):
        cmd = args['act'] + " " + args['service']
    elif os.path.isfile("/etc/init.d/%s" % args['service']):
        cmd = "/etc/init.d/%s %s" % (args['service'], args['act'])
    else:
        print("Unknown service")
        sys.exit(2)
elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora'):
    cmd = "systemctl %s %s" % (args['act'], args['service'])

subprocess.call(cmd, shell=True)

contrib/linux/actions/service.py
#!/usr/bin/env python

import re
import sys
import os
import platform
import subprocess

distro = platform.linux_distribution()[0]

args = {'act': sys.argv[1], 'service': sys.argv[2]}

if re.search(distro, 'Ubuntu'):
    if os.path.isfile("/etc/init/%s.conf" % args['service']):
        cmd = args['act'] + " " + args['service']
    elif os.path.isfile("/etc/init.d/%s" % args['service']):
        cmd = "/etc/init.d/%s %s" % (args['service'], args['act'])
    else:
        print("Unknown service")
        sys.exit(2)
elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora') or \
        re.search(distro, 'CentOS Linux'):
    cmd = "systemctl %s %s" % (args['act'], args['service'])

subprocess.call(cmd, shell=True)

contrib/linux/actions/service.py
diff --git a/contrib/linux/actions/service.py b/contrib/linux/actions/service.py
index 3bef0b50bc..50716b7799 100644
--- a/contrib/linux/actions/service.py
+++ b/contrib/linux/actions/service.py
@@ -18,7 +18,8 @@
     else:
         print("Unknown service")
         sys.exit(2)
-elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora'):
+elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora') or \
+        re.search(distro, 'CentOS Linux'):
     cmd = "systemctl %s %s" % (args['act'], args['service'])
 
 subprocess.call(cmd, shell=True)

Action 'linux.service' fails on Centos7
When I tried to execute restart some service on the Centos7 server got the following error:
```
Traceback (most recent call last):
  File "/tmp/5a0459bc07ac686fb813a920/service.py", line 24, in <module>
    subprocess.call(cmd, shell=True)
NameError: name 'cmd' is not defined
```
After investigation the resolution has been found:
in file /opt/stackstorm/packs/linux/actions/service.py the entry

`elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora'):`

fixed to 

`elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora') or re.search(distro, 'CentOS Linux'):`

The issue has gone



