prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  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
  
  
  
  
  </issue>
  <code>
  [start of contrib/linux/actions/service.py]
  1 #!/usr/bin/env python
  2 
  3 import re
  4 import sys
  5 import os
  6 import platform
  7 import subprocess
  8 
  9 distro = platform.linux_distribution()[0]
  10 
  11 args = {'act': sys.argv[1], 'service': sys.argv[2]}
  12 
  13 if re.search(distro, 'Ubuntu'):
  14     if os.path.isfile("/etc/init/%s.conf" % args['service']):
  15         cmd = args['act'] + " " + args['service']
  16     elif os.path.isfile("/etc/init.d/%s" % args['service']):
  17         cmd = "/etc/init.d/%s %s" % (args['service'], args['act'])
  18     else:
  19         print("Unknown service")
  20         sys.exit(2)
  21 elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora'):
  22     cmd = "systemctl %s %s" % (args['act'], args['service'])
  23 
  24 subprocess.call(cmd, shell=True)
  25
  [end of contrib/linux/actions/service.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/contrib/linux/actions/service.py b/contrib/linux/actions/service.py
  --- 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)
  
verification_info: {"golden_diff": "diff --git a/contrib/linux/actions/service.py b/contrib/linux/actions/service.py\n--- a/contrib/linux/actions/service.py\n+++ b/contrib/linux/actions/service.py\n@@ -18,7 +18,8 @@\n     else:\n         print(\"Unknown service\")\n         sys.exit(2)\n-elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora'):\n+elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora') or \\\n+        re.search(distro, 'CentOS Linux'):\n     cmd = \"systemctl %s %s\" % (args['act'], args['service'])\n \n subprocess.call(cmd, shell=True)\n", "issue": "Action 'linux.service' fails on Centos7\nWhen I tried to execute restart some service on the Centos7 server got the following error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/tmp/5a0459bc07ac686fb813a920/service.py\", line 24, in <module>\r\n    subprocess.call(cmd, shell=True)\r\nNameError: name 'cmd' is not defined\r\n```\r\nAfter investigation the resolution has been found:\r\nin file /opt/stackstorm/packs/linux/actions/service.py the entry\r\n\r\n`elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora'):`\r\n\r\nfixed to \r\n\r\n`elif re.search(distro, 'Redhat') or re.search(distro, 'Fedora') or re.search(distro, 'CentOS Linux'):`\r\n\r\nThe issue has gone\r\n\r\n\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n\nimport re\nimport sys\nimport os\nimport platform\nimport subprocess\n\ndistro = platform.linux_distribution()[0]\n\nargs = {'act': sys.argv[1], 'service': sys.argv[2]}\n\nif re.search(distro, 'Ubuntu'):\n    if os.path.isfile(\"/etc/init/%s.conf\" % args['service']):\n        cmd = args['act'] + \" \" + args['service']\n    elif os.path.isfile(\"/etc/init.d/%s\" % args['service']):\n        cmd = \"/etc/init.d/%s %s\" % (args['service'], args['act'])\n    else:\n        print(\"Unknown service\")\n        sys.exit(2)\nelif re.search(distro, 'Redhat') or re.search(distro, 'Fedora'):\n    cmd = \"systemctl %s %s\" % (args['act'], args['service'])\n\nsubprocess.call(cmd, shell=True)\n", "path": "contrib/linux/actions/service.py"}]}